[fidl][cpp] Use std:: types for non-nullable strings and vectors.
See: https://fuchsia-review.googlesource.com/c/garnet/+/236996
Test: built everything, booted system and poked around
Change-Id: I4fca25859a98cbaa2edc968b04e17c8e876b64f6
diff --git a/app/term/view_controller.cc b/app/term/view_controller.cc
index 9b9782d..9a99f2c 100644
--- a/app/term/view_controller.cc
+++ b/app/term/view_controller.cc
@@ -40,7 +40,6 @@
fuchsia::fonts::Request font_request;
font_request.family = "RobotoMono";
- font_request.language = fidl::VectorPtr<fidl::StringPtr>::New(0);
font_loader_.LoadFont(
std::move(font_request), [this](sk_sp<SkTypeface> typeface) {
FXL_CHECK(typeface); // TODO(jpoichet): Fail gracefully.
diff --git a/auth_providers/google/google_auth_provider_impl.cc b/auth_providers/google/google_auth_provider_impl.cc
index 357c001..9dfa378 100644
--- a/auth_providers/google/google_auth_provider_impl.cc
+++ b/auth_providers/google/google_auth_provider_impl.cc
@@ -170,17 +170,17 @@
}
void GoogleAuthProviderImpl::GetAppAccessToken(
- fidl::StringPtr credential, fidl::StringPtr app_client_id,
- const fidl::VectorPtr<fidl::StringPtr> app_scopes,
+ std::string credential, fidl::StringPtr app_client_id,
+ const std::vector<std::string> app_scopes,
GetAppAccessTokenCallback callback) {
- if (credential->empty()) {
+ if (credential.empty()) {
callback(AuthProviderStatus::BAD_REQUEST, nullptr);
return;
}
auto request =
OAuthRequestBuilder(kGoogleOAuthTokenEndpoint, "POST")
- .SetUrlEncodedBody("refresh_token=" + credential.get() +
+ .SetUrlEncodedBody("refresh_token=" + credential +
"&client_id=" + GetClientId(app_client_id.get()) +
"&grant_type=refresh_token");
@@ -209,17 +209,17 @@
});
}
-void GoogleAuthProviderImpl::GetAppIdToken(fidl::StringPtr credential,
+void GoogleAuthProviderImpl::GetAppIdToken(std::string credential,
fidl::StringPtr audience,
GetAppIdTokenCallback callback) {
- if (credential->empty()) {
+ if (credential.empty()) {
callback(AuthProviderStatus::BAD_REQUEST, nullptr);
return;
}
auto request =
OAuthRequestBuilder(kGoogleOAuthTokenEndpoint, "POST")
- .SetUrlEncodedBody("refresh_token=" + credential.get() +
+ .SetUrlEncodedBody("refresh_token=" + credential +
"&client_id=" + GetClientId(audience.get()) +
"&grant_type=refresh_token");
@@ -247,19 +247,19 @@
}
void GoogleAuthProviderImpl::GetAppFirebaseToken(
- fidl::StringPtr id_token, fidl::StringPtr firebase_api_key,
+ std::string id_token, std::string firebase_api_key,
GetAppFirebaseTokenCallback callback) {
- if (id_token->empty() || firebase_api_key->empty()) {
+ if (id_token.empty() || firebase_api_key.empty()) {
callback(AuthProviderStatus::BAD_REQUEST, nullptr);
return;
}
std::map<std::string, std::string> query_params;
- query_params["key"] = firebase_api_key.get();
+ query_params["key"] = firebase_api_key;
auto request =
OAuthRequestBuilder(kFirebaseAuthEndpoint, "POST")
.SetQueryParams(query_params)
- .SetJsonBody(R"({"postBody": "id_token=)" + id_token.get() +
+ .SetJsonBody(R"({"postBody": "id_token=)" + id_token +
R"(&providerId=google.com",)" +
R"("returnIdpCredential": true,)" +
R"("returnSecureToken": true,)" +
@@ -291,15 +291,15 @@
}
void GoogleAuthProviderImpl::RevokeAppOrPersistentCredential(
- fidl::StringPtr credential,
+ std::string credential,
RevokeAppOrPersistentCredentialCallback callback) {
- if (credential->empty()) {
+ if (credential.empty()) {
callback(AuthProviderStatus::BAD_REQUEST);
return;
}
std::string url =
- kGoogleRevokeTokenEndpoint + std::string("?token=") + credential.get();
+ kGoogleRevokeTokenEndpoint + std::string("?token=") + credential;
auto request = OAuthRequestBuilder(url, "POST").SetUrlEncodedBody("");
auto request_factory = fxl::MakeCopyable(
@@ -332,19 +332,19 @@
void GoogleAuthProviderImpl::GetAppAccessTokenFromAssertionJWT(
fidl::InterfaceHandle<AttestationSigner> attestation_signer,
- AssertionJWTParams jwt_params, fidl::StringPtr credential,
- const fidl::VectorPtr<fidl::StringPtr> scopes,
+ AssertionJWTParams jwt_params, std::string credential,
+ const std::vector<std::string> scopes,
GetAppAccessTokenFromAssertionJWTCallback callback) {
// Remote attestation flow not supported for traditional OAuth.
callback(AuthProviderStatus::BAD_REQUEST, nullptr, nullptr, nullptr);
}
-void GoogleAuthProviderImpl::WillSendRequest(fidl::StringPtr incoming_url) {
+void GoogleAuthProviderImpl::WillSendRequest(std::string incoming_url) {
FXL_CHECK(get_persistent_credential_callback_);
std::string auth_code;
AuthProviderStatus status =
- ParseAuthCodeFromUrl(incoming_url.get(), auth_code);
+ ParseAuthCodeFromUrl(incoming_url, auth_code);
// If either an error occured or the user successfully received an auth code
// we need to close the WebView.
diff --git a/auth_providers/google/google_auth_provider_impl.h b/auth_providers/google/google_auth_provider_impl.h
index ac4cf33..98964fc 100644
--- a/auth_providers/google/google_auth_provider_impl.h
+++ b/auth_providers/google/google_auth_provider_impl.h
@@ -50,23 +50,23 @@
GetPersistentCredentialCallback callback) override;
// |AuthProvider|
- void GetAppAccessToken(fidl::StringPtr credential,
+ void GetAppAccessToken(std::string credential,
fidl::StringPtr app_client_id,
- const fidl::VectorPtr<fidl::StringPtr> app_scopes,
+ const std::vector<std::string> app_scopes,
GetAppAccessTokenCallback callback) override;
// |AuthProvider|
- void GetAppIdToken(fidl::StringPtr credential, fidl::StringPtr audience,
+ void GetAppIdToken(std::string credential, fidl::StringPtr audience,
GetAppIdTokenCallback callback) override;
// |AuthProvider|
- void GetAppFirebaseToken(fidl::StringPtr id_token,
- fidl::StringPtr firebase_api_key,
+ void GetAppFirebaseToken(std::string id_token,
+ std::string firebase_api_key,
GetAppFirebaseTokenCallback callback) override;
// |AuthProvider|
void RevokeAppOrPersistentCredential(
- fidl::StringPtr credential,
+ std::string credential,
RevokeAppOrPersistentCredentialCallback callback) override;
// |AuthProvider|
@@ -80,12 +80,12 @@
// |AuthProvider|
void GetAppAccessTokenFromAssertionJWT(
fidl::InterfaceHandle<AttestationSigner> attestation_signer,
- AssertionJWTParams jwt_params, fidl::StringPtr credential,
- fidl::VectorPtr<fidl::StringPtr> scopes,
+ AssertionJWTParams jwt_params, std::string credential,
+ std::vector<std::string> scopes,
GetAppAccessTokenFromAssertionJWTCallback callback) override;
// |fuchsia::webview::WebRequestDelegate|
- void WillSendRequest(fidl::StringPtr incoming_url) override;
+ void WillSendRequest(std::string incoming_url) override;
// |chromium::Web::NavigationEventObserver|
void OnNavigationStateChanged(
diff --git a/auth_providers/google/google_auth_provider_impl_unittest.cc b/auth_providers/google/google_auth_provider_impl_unittest.cc
index 4bda286..c8f0368 100644
--- a/auth_providers/google/google_auth_provider_impl_unittest.cc
+++ b/auth_providers/google/google_auth_provider_impl_unittest.cc
@@ -54,7 +54,7 @@
bool callback_called = false;
auto status = AuthProviderStatus::INTERNAL_ERROR;
AuthTokenPtr access_token;
- auto scopes = fidl::VectorPtr<fidl::StringPtr>::New(0);
+ std::vector<std::string> scopes;
scopes.push_back("https://www.googleapis.com/auth/gmail.modify");
scopes.push_back("https://www.googleapis.com/auth/userinfo.email");
@@ -82,7 +82,7 @@
bool callback_called = false;
auto status = AuthProviderStatus::INTERNAL_ERROR;
fuchsia::auth::AuthTokenPtr access_token;
- auto scopes = fidl::VectorPtr<fidl::StringPtr>::New(0);
+ std::vector<std::string> scopes;
scopes.push_back("https://www.googleapis.com/auth/gmail.modify");
auth_provider_->GetAppAccessToken(
@@ -100,7 +100,7 @@
bool callback_called = false;
auto status = AuthProviderStatus::INTERNAL_ERROR;
AuthTokenPtr access_token;
- auto scopes = fidl::VectorPtr<fidl::StringPtr>::New(0);
+ std::vector<std::string> scopes;
scopes.push_back("https://www.googleapis.com/auth/gmail.modify");
scopes.push_back("https://www.googleapis.com/auth/userinfo.email");
@@ -124,7 +124,7 @@
bool callback_called = false;
auto status = AuthProviderStatus::INTERNAL_ERROR;
AuthTokenPtr access_token;
- auto scopes = fidl::VectorPtr<fidl::StringPtr>::New(0);
+ std::vector<std::string> scopes;
scopes.push_back("https://www.googleapis.com/auth/gmail.modify");
scopes.push_back("https://www.googleapis.com/auth/userinfo.email");
diff --git a/auth_providers/oauth/oauth_request_builder_unittest.cc b/auth_providers/oauth/oauth_request_builder_unittest.cc
index 9953a16..dd152c3 100644
--- a/auth_providers/oauth/oauth_request_builder_unittest.cc
+++ b/auth_providers/oauth/oauth_request_builder_unittest.cc
@@ -40,14 +40,14 @@
.SetJsonBody(strbuf.GetString())
.Build();
- EXPECT_TRUE(req.url.get().find("example.org") != std::string::npos);
+ EXPECT_TRUE(req.url.find("example.org") != std::string::npos);
EXPECT_EQ(req.method, kPostMethod);
for (const auto& header : *req.headers) {
- auto hdr_name = header.name.get();
+ auto hdr_name = header.name;
if (hdr_name == "content-type") {
EXPECT_EQ(header.value, "application/json");
} else if (hdr_name == "content-length") {
- EXPECT_TRUE(atoi(header.value.get().c_str()) > 0);
+ EXPECT_TRUE(atoi(header.value.c_str()) > 0);
}
}
}
@@ -57,15 +57,15 @@
.SetUrlEncodedBody("test_data")
.Build();
- EXPECT_TRUE(req.url.get().find("example.org") != std::string::npos);
+ EXPECT_TRUE(req.url.find("example.org") != std::string::npos);
EXPECT_EQ(req.method, kPostMethod);
EXPECT_TRUE(req.body);
for (const auto& header : *req.headers) {
- auto hdr_name = header.name.get();
+ auto hdr_name = header.name;
if (hdr_name == "content-type") {
EXPECT_EQ(header.value, "application/x-www-form-urlencoded");
} else if (hdr_name == "content-length") {
- EXPECT_TRUE(atoi(header.value.get().c_str()) > 0);
+ EXPECT_TRUE(atoi(header.value.c_str()) > 0);
}
}
}
@@ -74,14 +74,14 @@
auto req =
OAuthRequestBuilder(kTestUrl, kPostMethod).SetUrlEncodedBody("").Build();
- EXPECT_TRUE(req.url.get().find("example.org") != std::string::npos);
+ EXPECT_TRUE(req.url.find("example.org") != std::string::npos);
EXPECT_EQ(req.method, kPostMethod);
for (const auto& header : *req.headers) {
- auto hdr_name = header.name.get();
+ auto hdr_name = header.name;
if (hdr_name == "content-type") {
EXPECT_EQ(header.value, "application/x-www-form-urlencoded");
} else if (hdr_name == "content-length") {
- EXPECT_TRUE(atoi(header.value.get().c_str()) == 0);
+ EXPECT_TRUE(atoi(header.value.c_str()) == 0);
} else {
ASSERT_TRUE("This header should never been set");
}
@@ -94,13 +94,13 @@
.SetAuthorizationHeader("test_token")
.Build();
- EXPECT_TRUE(req.url.get().find("example.org") != std::string::npos);
+ EXPECT_TRUE(req.url.find("example.org") != std::string::npos);
EXPECT_EQ(req.method, kPostMethod);
EXPECT_TRUE(req.body);
for (const auto& header : *req.headers) {
- auto hdr_name = header.name.get();
+ auto hdr_name = header.name;
if (hdr_name == "Authorization") {
- EXPECT_TRUE(header.value.get().find("test_token") != std::string::npos);
+ EXPECT_TRUE(header.value.find("test_token") != std::string::npos);
}
}
}
@@ -108,7 +108,7 @@
TEST_F(OAuthRequestBuilderTest, GetRequest) {
auto req = OAuthRequestBuilder(kTestUrl, kGetMethod).Build();
- EXPECT_TRUE(req.url.get().find("example.org") != std::string::npos);
+ EXPECT_TRUE(req.url.find("example.org") != std::string::npos);
EXPECT_EQ(req.method, kGetMethod);
}
@@ -120,11 +120,11 @@
auto req =
OAuthRequestBuilder(kTestUrl, kGetMethod).SetQueryParams(params).Build();
- EXPECT_TRUE(req.url.get().find("example.org") != std::string::npos);
- EXPECT_TRUE(req.url.get().find("foo1") != std::string::npos);
- EXPECT_TRUE(req.url.get().find("foo2") != std::string::npos);
+ EXPECT_TRUE(req.url.find("example.org") != std::string::npos);
+ EXPECT_TRUE(req.url.find("foo1") != std::string::npos);
+ EXPECT_TRUE(req.url.find("foo2") != std::string::npos);
// check if the param values are url encoded
- EXPECT_TRUE(req.url.get().find("bar%203") != std::string::npos);
+ EXPECT_TRUE(req.url.find("bar%203") != std::string::npos);
EXPECT_EQ(req.method, kGetMethod);
}
diff --git a/auth_providers/spotify/spotify_auth_provider_impl.cc b/auth_providers/spotify/spotify_auth_provider_impl.cc
index e2e16f1..7dfa367 100644
--- a/auth_providers/spotify/spotify_auth_provider_impl.cc
+++ b/auth_providers/spotify/spotify_auth_provider_impl.cc
@@ -104,10 +104,10 @@
}
void SpotifyAuthProviderImpl::GetAppAccessToken(
- const fidl::StringPtr credential, const fidl::StringPtr app_client_id,
- const fidl::VectorPtr<fidl::StringPtr> app_scopes,
+ const std::string credential, const fidl::StringPtr app_client_id,
+ const std::vector<std::string> app_scopes,
GetAppAccessTokenCallback callback) {
- if (credential->empty()) {
+ if (credential.empty()) {
callback(AuthProviderStatus::BAD_REQUEST, nullptr);
return;
}
@@ -118,7 +118,7 @@
}
auto request = OAuthRequestBuilder(kSpotifyOAuthTokenEndpoint, "POST")
- .SetUrlEncodedBody("refresh_token=" + credential.get() +
+ .SetUrlEncodedBody("refresh_token=" + credential +
"&client_id=" + app_client_id.get() +
"&grant_type=refresh_token");
@@ -147,7 +147,7 @@
});
}
-void SpotifyAuthProviderImpl::GetAppIdToken(const fidl::StringPtr credential,
+void SpotifyAuthProviderImpl::GetAppIdToken(const std::string credential,
const fidl::StringPtr audience,
GetAppIdTokenCallback callback) {
// Id Tokens are not supported by Spotify.
@@ -155,14 +155,14 @@
}
void SpotifyAuthProviderImpl::GetAppFirebaseToken(
- const fidl::StringPtr id_token, const fidl::StringPtr firebase_api_key,
+ const std::string id_token, const std::string firebase_api_key,
GetAppFirebaseTokenCallback callback) {
// Firebase Token doesn't exist for Spotify.
callback(AuthProviderStatus::BAD_REQUEST, nullptr);
}
void SpotifyAuthProviderImpl::RevokeAppOrPersistentCredential(
- const fidl::StringPtr credential,
+ const std::string credential,
RevokeAppOrPersistentCredentialCallback callback) {
// There is no programmatic way to revoke tokens. Instead, Spotify users have
// to manually revoke access from this page here:
@@ -182,18 +182,18 @@
void SpotifyAuthProviderImpl::GetAppAccessTokenFromAssertionJWT(
fidl::InterfaceHandle<AttestationSigner> attestation_signer,
- AssertionJWTParams jwt_params, fidl::StringPtr credential,
- const fidl::VectorPtr<fidl::StringPtr> app_scopes,
+ AssertionJWTParams jwt_params, std::string credential,
+ const std::vector<std::string> app_scopes,
GetAppAccessTokenFromAssertionJWTCallback callback) {
// Remote attestation flow not supported.
callback(AuthProviderStatus::BAD_REQUEST, nullptr, nullptr, nullptr);
}
void SpotifyAuthProviderImpl::WillSendRequest(
- const fidl::StringPtr incoming_url) {
+ const std::string incoming_url) {
FXL_DCHECK(get_persistent_credential_callback_);
- const std::string& uri = incoming_url.get();
+ const std::string& uri = incoming_url;
const std::string prefix = std::string{kRedirectUri} + "?code=";
const std::string cancel_prefix =
std::string{kRedirectUri} + "?error=access_denied";
diff --git a/auth_providers/spotify/spotify_auth_provider_impl.h b/auth_providers/spotify/spotify_auth_provider_impl.h
index 7f12778..5cbbfb3 100644
--- a/auth_providers/spotify/spotify_auth_provider_impl.h
+++ b/auth_providers/spotify/spotify_auth_provider_impl.h
@@ -49,24 +49,24 @@
GetPersistentCredentialCallback callback) override;
// |AuthProvider|
- void GetAppAccessToken(const fidl::StringPtr credential,
+ void GetAppAccessToken(const std::string credential,
const fidl::StringPtr app_client_id,
- const fidl::VectorPtr<fidl::StringPtr> app_scopes,
+ const std::vector<std::string> app_scopes,
GetAppAccessTokenCallback callback) override;
// |AuthProvider|
- void GetAppIdToken(const fidl::StringPtr credential,
+ void GetAppIdToken(const std::string credential,
const fidl::StringPtr audience,
GetAppIdTokenCallback callback) override;
// |AuthProvider|
- void GetAppFirebaseToken(const fidl::StringPtr id_token,
- const fidl::StringPtr firebase_api_key,
+ void GetAppFirebaseToken(const std::string id_token,
+ const std::string firebase_api_key,
GetAppFirebaseTokenCallback callback) override;
// |AuthProvider|
void RevokeAppOrPersistentCredential(
- const fidl::StringPtr credential,
+ const std::string credential,
RevokeAppOrPersistentCredentialCallback callback) override;
// |AuthProvider|
@@ -80,12 +80,12 @@
// |AuthProvider|
void GetAppAccessTokenFromAssertionJWT(
fidl::InterfaceHandle<AttestationSigner> attestation_signer,
- AssertionJWTParams jwt_params, const fidl::StringPtr credential,
- const fidl::VectorPtr<fidl::StringPtr> app_scopes,
+ AssertionJWTParams jwt_params, const std::string credential,
+ const std::vector<std::string> app_scopes,
GetAppAccessTokenFromAssertionJWTCallback callback) override;
// |fuchsia::webview::WebRequestDelegate|
- void WillSendRequest(const fidl::StringPtr incoming_url) override;
+ void WillSendRequest(const std::string incoming_url) override;
void GetUserProfile(const fidl::StringPtr credential,
const fidl::StringPtr access_token);
diff --git a/auth_providers/spotify/spotify_auth_provider_impl_unittest.cc b/auth_providers/spotify/spotify_auth_provider_impl_unittest.cc
index 2027675..ecfcaf2 100644
--- a/auth_providers/spotify/spotify_auth_provider_impl_unittest.cc
+++ b/auth_providers/spotify/spotify_auth_provider_impl_unittest.cc
@@ -53,7 +53,7 @@
bool callback_called = false;
auto status = AuthProviderStatus::INTERNAL_ERROR;
AuthTokenPtr access_token;
- auto scopes = fidl::VectorPtr<fidl::StringPtr>::New(0);
+ std::vector<std::string> scopes;
scopes.push_back("http://spotifyapis.test.com/scope1");
scopes.push_back("http://spotifyapis.test.com/scope2");
@@ -80,7 +80,7 @@
bool callback_called = false;
auto status = AuthProviderStatus::INTERNAL_ERROR;
AuthTokenPtr access_token;
- auto scopes = fidl::VectorPtr<fidl::StringPtr>::New(0);
+ std::vector<std::string> scopes;
scopes.push_back("http://spotifyapis.test.com/scope1");
scopes.push_back("http://spotifyapis.test.com/scope2");
diff --git a/examples/mediaplayer/mediaplayer_skia/mediaplayer_view.cc b/examples/mediaplayer/mediaplayer_skia/mediaplayer_view.cc
index 52cd245..5abca21 100644
--- a/examples/mediaplayer/mediaplayer_skia/mediaplayer_view.cc
+++ b/examples/mediaplayer/mediaplayer_skia/mediaplayer_view.cc
@@ -382,7 +382,7 @@
if (status.metadata && !metadata_shown_) {
FXL_DLOG(INFO) << "duration " << std::fixed << std::setprecision(1)
<< double(duration_ns_) / 1000000000.0 << " seconds";
- for (auto& property : *status.metadata->properties) {
+ for (auto& property : status.metadata->properties) {
FXL_DLOG(INFO) << property.label << ": " << property.value;
}
diff --git a/public/lib/ui/flutter/sdk_ext/src/natives.cc b/public/lib/ui/flutter/sdk_ext/src/natives.cc
index db96e89..cbd5114 100644
--- a/public/lib/ui/flutter/sdk_ext/src/natives.cc
+++ b/public/lib/ui/flutter/sdk_ext/src/natives.cc
@@ -108,7 +108,7 @@
if (Dart_IsError(result)) {
return;
}
- fidl::VectorPtr<fidl::StringPtr> services;
+ std::vector<std::string> services;
services.resize(list_length);
for (intptr_t index = 0; index < list_length; ++index) {
Dart_Handle value = Dart_ListGetAt(list, index);
@@ -125,7 +125,7 @@
}
buffer[length] = '\0';
- services->at(index) = std::string(buffer);
+ services.at(index) = std::string(buffer);
}
NativesDelegate* delegate = reinterpret_cast<NativesDelegate*>(context);
diff --git a/public/lib/ui/flutter/sdk_ext/src/natives.h b/public/lib/ui/flutter/sdk_ext/src/natives.h
index 430effa..e8edeed 100644
--- a/public/lib/ui/flutter/sdk_ext/src/natives.h
+++ b/public/lib/ui/flutter/sdk_ext/src/natives.h
@@ -15,7 +15,7 @@
public:
virtual void OfferServiceProvider(
fidl::InterfaceHandle<fuchsia::sys::ServiceProvider>,
- fidl::VectorPtr<fidl::StringPtr> services) = 0;
+ std::vector<std::string> services) = 0;
protected:
virtual ~NativesDelegate();
diff --git a/runtime/dart_runner/dart_component_controller.cc b/runtime/dart_runner/dart_component_controller.cc
index 1a2a44e..a80b205 100644
--- a/runtime/dart_runner/dart_component_controller.cc
+++ b/runtime/dart_runner/dart_component_controller.cc
@@ -60,8 +60,8 @@
binding_(this) {
for (size_t i = 0; i < startup_info_.program_metadata->size(); ++i) {
auto pg = startup_info_.program_metadata->at(i);
- if (pg.key.get().compare(kDataKey) == 0) {
- data_path_ = "pkg/" + pg.value.get();
+ if (pg.key.compare(kDataKey) == 0) {
+ data_path_ = "pkg/" + pg.value;
}
}
if (data_path_.empty()) {
@@ -131,19 +131,19 @@
fuchsia::dart::SetupComponentTemp(namespace_);
- for (size_t i = 0; i < flat->paths->size(); ++i) {
- if ((flat->paths->at(i) == kTmpPath) ||
- (flat->paths->at(i) == kServiceRootPath)) {
+ for (size_t i = 0; i < flat->paths.size(); ++i) {
+ if ((flat->paths.at(i) == kTmpPath) ||
+ (flat->paths.at(i) == kServiceRootPath)) {
// /tmp is covered by the local memfs.
// Ownership of /svc goes to the StartupContext created below.
continue;
}
- zx::channel dir = std::move(flat->directories->at(i));
+ zx::channel dir = std::move(flat->directories.at(i));
zx_handle_t dir_handle = dir.release();
- const char* path = flat->paths->at(i)->data();
+ const char* path = flat->paths.at(i).data();
status = fdio_ns_bind(namespace_, path, dir_handle);
if (status != ZX_OK) {
- FXL_LOG(ERROR) << "Failed to bind " << flat->paths->at(i)
+ FXL_LOG(ERROR) << "Failed to bind " << flat->paths.at(i)
<< " to namespace: " << zx_status_get_string(status);
zx_handle_close(dir_handle);
return false;
@@ -336,7 +336,7 @@
tonic::DartMicrotaskQueue::StartForCurrentThread();
deprecated_loop::MessageLoop::GetCurrent()->SetAfterTaskCallback(AfterTask);
- fidl::VectorPtr<fidl::StringPtr> arguments =
+ std::vector<std::string> arguments =
std::move(startup_info_.launch_info.arguments);
// TODO(abarth): Remove service_provider_bridge once we have an
@@ -376,16 +376,16 @@
Dart_EnterScope();
Dart_Handle dart_arguments =
- Dart_NewListOf(Dart_CoreType_String, arguments->size());
+ Dart_NewListOf(Dart_CoreType_String, arguments.size());
if (Dart_IsError(dart_arguments)) {
FXL_LOG(ERROR) << "Failed to allocate Dart arguments list: "
<< Dart_GetError(dart_arguments);
Dart_ExitScope();
return false;
}
- for (size_t i = 0; i < arguments->size(); i++) {
+ for (size_t i = 0; i < arguments.size(); i++) {
tonic::LogIfError(
- Dart_ListSetAt(dart_arguments, i, ToDart(arguments->at(i).get())));
+ Dart_ListSetAt(dart_arguments, i, ToDart(arguments.at(i))));
}
Dart_Handle argv[] = {
diff --git a/runtime/flutter_runner/component.cc b/runtime/flutter_runner/component.cc
index ae49328..deac4d5 100644
--- a/runtime/flutter_runner/component.cc
+++ b/runtime/flutter_runner/component.cc
@@ -95,8 +95,8 @@
std::string data_path;
for (size_t i = 0; i < startup_info.program_metadata->size(); ++i) {
auto pg = startup_info.program_metadata->at(i);
- if (pg.key.get().compare(kDataKey) == 0) {
- data_path = "pkg/" + pg.value.get();
+ if (pg.key.compare(kDataKey) == 0) {
+ data_path = "pkg/" + pg.value;
}
}
if (data_path.empty()) {
@@ -109,15 +109,15 @@
fuchsia::dart::SetupComponentTemp(fdio_ns_.get());
// LaunchInfo::flat_namespace optional.
- for (size_t i = 0; i < startup_info.flat_namespace.paths->size(); ++i) {
- const auto& path = startup_info.flat_namespace.paths->at(i);
+ for (size_t i = 0; i < startup_info.flat_namespace.paths.size(); ++i) {
+ const auto& path = startup_info.flat_namespace.paths.at(i);
if (path == "/tmp" || path == "/svc") {
continue;
}
- zx::channel dir = std::move(startup_info.flat_namespace.directories->at(i));
+ zx::channel dir = std::move(startup_info.flat_namespace.directories.at(i));
zx_handle_t dir_handle = dir.release();
- if (fdio_ns_bind(fdio_ns_.get(), path->data(), dir_handle) != ZX_OK) {
+ if (fdio_ns_bind(fdio_ns_.get(), path.data(), dir_handle) != ZX_OK) {
FML_DLOG(ERROR) << "Could not bind path to namespace: " << path;
zx_handle_close(dir_handle);
}
diff --git a/runtime/flutter_runner/engine.cc b/runtime/flutter_runner/engine.cc
index 08c1d88..b5be9c8 100644
--- a/runtime/flutter_runner/engine.cc
+++ b/runtime/flutter_runner/engine.cc
@@ -427,7 +427,7 @@
// |mozart::NativesDelegate|
void Engine::OfferServiceProvider(
fidl::InterfaceHandle<fuchsia::sys::ServiceProvider> service_provider,
- fidl::VectorPtr<fidl::StringPtr> services) {
+ std::vector<std::string> services) {
#ifndef SCENIC_VIEWS2
if (!shell_) {
return;
diff --git a/runtime/flutter_runner/engine.h b/runtime/flutter_runner/engine.h
index ece1a1a..b2beed7 100644
--- a/runtime/flutter_runner/engine.h
+++ b/runtime/flutter_runner/engine.h
@@ -64,7 +64,7 @@
// |mozart::NativesDelegate|
void OfferServiceProvider(
fidl::InterfaceHandle<fuchsia::sys::ServiceProvider> service_provider,
- fidl::VectorPtr<fidl::StringPtr> services);
+ std::vector<std::string> services);
FML_DISALLOW_COPY_AND_ASSIGN(Engine);
};
diff --git a/runtime/flutter_runner/fuchsia_font_manager.cc b/runtime/flutter_runner/fuchsia_font_manager.cc
index aefe282..80fc69f 100644
--- a/runtime/flutter_runner/fuchsia_font_manager.cc
+++ b/runtime/flutter_runner/fuchsia_font_manager.cc
@@ -98,10 +98,10 @@
}
}
-fidl::VectorPtr<fidl::StringPtr> BuildLanguageList(const char* bcp47[],
+fidl::VectorPtr<std::string> BuildLanguageList(const char* bcp47[],
int bcp47_count) {
FXL_DCHECK(bcp47 != nullptr || bcp47_count == 0);
- auto languages = fidl::VectorPtr<fidl::StringPtr>::New(0);
+ auto languages = fidl::VectorPtr<std::string>::New(0);
for (int i = 0; i < bcp47_count; i++) {
languages.push_back(bcp47[i]);
}
@@ -317,7 +317,7 @@
return nullptr;
std::vector<SkFontStyle> styles;
- for (auto& style : *(family_info->styles)) {
+ for (auto& style : family_info->styles) {
styles.push_back(
SkFontStyle(style.weight, style.width, FuchsiaToSkSlant(style.slant)));
}
diff --git a/runtime/flutter_runner/platform_view.cc b/runtime/flutter_runner/platform_view.cc
index a2adc5a..4fb4a4c 100644
--- a/runtime/flutter_runner/platform_view.cc
+++ b/runtime/flutter_runner/platform_view.cc
@@ -120,7 +120,7 @@
#ifndef SCENIC_VIEWS2
void PlatformView::OfferServiceProvider(
fidl::InterfaceHandle<fuchsia::sys::ServiceProvider> service_provider,
- fidl::VectorPtr<fidl::StringPtr> services) {
+ std::vector<std::string> services) {
view_->OfferServiceProvider(std::move(service_provider), std::move(services));
}
#endif
@@ -230,7 +230,7 @@
rapidjson::Document document;
auto& allocator = document.GetAllocator();
rapidjson::Value encoded_state(rapidjson::kObjectType);
- encoded_state.AddMember("text", state.text.get(), allocator);
+ encoded_state.AddMember("text", state.text, allocator);
encoded_state.AddMember("selectionBase", state.selection.base, allocator);
encoded_state.AddMember("selectionExtent", state.selection.extent, allocator);
switch (state.selection.affinity) {
@@ -307,14 +307,14 @@
);
}
-void PlatformView::OnScenicError(fidl::StringPtr error) {
+void PlatformView::OnScenicError(std::string error) {
FML_LOG(ERROR) << "Session error: " << error;
session_listener_error_callback_();
}
void PlatformView::OnScenicEvent(
- fidl::VectorPtr<fuchsia::ui::scenic::Event> events) {
- for (const auto& event : *events) {
+ std::vector<fuchsia::ui::scenic::Event> events) {
+ for (const auto& event : events) {
switch (event.Which()) {
case fuchsia::ui::scenic::Event::Tag::kGfx:
switch (event.gfx().Which()) {
diff --git a/runtime/flutter_runner/platform_view.h b/runtime/flutter_runner/platform_view.h
index c0e1616..d869139 100644
--- a/runtime/flutter_runner/platform_view.h
+++ b/runtime/flutter_runner/platform_view.h
@@ -75,7 +75,7 @@
#ifndef SCENIC_VIEWS2
void OfferServiceProvider(
fidl::InterfaceHandle<fuchsia::sys::ServiceProvider> service_provider,
- fidl::VectorPtr<fidl::StringPtr> services);
+ std::vector<std::string> services);
#endif
private:
@@ -151,9 +151,9 @@
void OnAction(fuchsia::ui::input::InputMethodAction action) override;
// |fuchsia::ui::scenic::SessionListener|
- void OnScenicError(fidl::StringPtr error) override;
+ void OnScenicError(std::string error) override;
void OnScenicEvent(
- fidl::VectorPtr<fuchsia::ui::scenic::Event> events) override;
+ std::vector<fuchsia::ui::scenic::Event> events) override;
bool OnHandlePointerEvent(const fuchsia::ui::input::PointerEvent& pointer);
diff --git a/runtime/web_runner_prototype/runner_unittest.cc b/runtime/web_runner_prototype/runner_unittest.cc
index c271e77..cca4510 100644
--- a/runtime/web_runner_prototype/runner_unittest.cc
+++ b/runtime/web_runner_prototype/runner_unittest.cc
@@ -49,7 +49,7 @@
// |fuchsia::webview::WebView|:
void ClearCookies() final {}
- void SetUrl(fidl::StringPtr url) final { last_url_ = *url; }
+ void SetUrl(std::string url) final { last_url_ = url; }
void SetWebRequestDelegate(
fidl::InterfaceHandle<fuchsia::webview::WebRequestDelegate> delegate)
diff --git a/runtime/web_view/web_view_impl.cpp b/runtime/web_view/web_view_impl.cpp
index e2a8edc..9a8905e 100644
--- a/runtime/web_view/web_view_impl.cpp
+++ b/runtime/web_view/web_view_impl.cpp
@@ -151,7 +151,7 @@
}
// |WebView|:
-void WebViewImpl::SetUrl(fidl::StringPtr url) {
+void WebViewImpl::SetUrl(std::string url) {
url_ = url;
// Reset url_set_ so that the next OnDraw() knows to call
// web_view_.setURL()
diff --git a/runtime/web_view/web_view_impl.h b/runtime/web_view/web_view_impl.h
index 17545d1..7bf1a52 100644
--- a/runtime/web_view/web_view_impl.h
+++ b/runtime/web_view/web_view_impl.h
@@ -62,7 +62,7 @@
void OnAction(fuchsia::ui::input::InputMethodAction action) override;
// |WebView|:
- void SetUrl(fidl::StringPtr url) override;
+ void SetUrl(std::string url) override;
private:
// |WebView|: