diff --git a/DEPS b/DEPS index 17910c2..1f34e185 100644 --- a/DEPS +++ b/DEPS
@@ -44,7 +44,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling V8 # and whatever else without interference from each other. - 'v8_revision': '75c2c8d4282f6948697447b4c98d55b25098687d', + 'v8_revision': '62479fdbd5435cf7a0176f535f445b25d6266bb1', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling swarming_client # and whatever else without interference from each other.
diff --git a/ash/mus/window_manager_unittest.cc b/ash/mus/window_manager_unittest.cc index ae7db1a0..168bb4b 100644 --- a/ash/mus/window_manager_unittest.cc +++ b/ash/mus/window_manager_unittest.cc
@@ -106,7 +106,7 @@ // Create another WindowTreeClient by way of embedding in // |child_window|. This blocks until it succeeds. ui::mojom::WindowTreeClientPtr tree_client; - auto tree_client_request = GetProxy(&tree_client); + auto tree_client_request = MakeRequest(&tree_client); client.Embed(child_window, std::move(tree_client), 0u, base::Bind(&OnEmbed)); aura::WindowTreeClient child_client(connector(), &window_tree_delegate, nullptr, std::move(tree_client_request));
diff --git a/blimp/engine/mojo/font_fetcher_mojo_impl_unittest.cc b/blimp/engine/mojo/font_fetcher_mojo_impl_unittest.cc index 9db66b5..4d59c83 100644 --- a/blimp/engine/mojo/font_fetcher_mojo_impl_unittest.cc +++ b/blimp/engine/mojo/font_fetcher_mojo_impl_unittest.cc
@@ -62,7 +62,7 @@ TEST_F(FontFetcherMojoImplUnittest, VerifyWriteToDataPipe) { mojom::FontFetcherPtr mojo_ptr; - font_fetcher_mojo_impl_.BindRequest(GetProxy(&mojo_ptr)); + font_fetcher_mojo_impl_.BindRequest(MakeRequest(&mojo_ptr)); // Expect that dummy font data is written correctly to a Mojo DataPipe. mojo_ptr->GetFontStream(kFakeHash, base::Bind(&VerifyDataWriteCorrectly));
diff --git a/blimp/engine/renderer/blob_channel_sender_proxy_unittest.cc b/blimp/engine/renderer/blob_channel_sender_proxy_unittest.cc index 2d6910e..72397b5 100644 --- a/blimp/engine/renderer/blob_channel_sender_proxy_unittest.cc +++ b/blimp/engine/renderer/blob_channel_sender_proxy_unittest.cc
@@ -38,7 +38,7 @@ // blob_channel_sender_proxy_ => (mojo) => mojo_service_impl_ => // mock_sender_; mojom::BlobChannelPtr mojo_ptr; - mojo_service_impl_->BindRequest(GetProxy(&mojo_ptr)); + mojo_service_impl_->BindRequest(MakeRequest(&mojo_ptr)); blob_channel_sender_proxy_ = BlobChannelSenderProxy::CreateForTest(std::move(mojo_ptr)); }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabActivity.java b/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabActivity.java index e843ff9..7c09524 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabActivity.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabActivity.java
@@ -517,7 +517,7 @@ webContents = WarmupManager.getInstance().takeSpareWebContents(false, false); if (webContents != null) webContentsStateOnLaunch = WEBCONTENTS_STATE_SPARE_WEBCONTENTS; } - RecordHistogram.recordEnumeratedHistogram("CustomTabs.WebcontentsStateOnLaunch", + RecordHistogram.recordEnumeratedHistogram("CustomTabs.WebContentsStateOnLaunch", webContentsStateOnLaunch, WEBCONTENTS_STATE_MAX); if (webContents == null) webContents = WebContentsFactory.createWebContents(false, false); if (!mHasPrerendered) {
diff --git a/chrome/browser/android/webapps/add_to_homescreen_manager.cc b/chrome/browser/android/webapps/add_to_homescreen_manager.cc index d55eb611..bf29e31 100644 --- a/chrome/browser/android/webapps/add_to_homescreen_manager.cc +++ b/chrome/browser/android/webapps/add_to_homescreen_manager.cc
@@ -123,7 +123,7 @@ // Fire the appinstalled event. blink::mojom::InstallationServicePtr installation_service; web_contents->GetMainFrame()->GetRemoteInterfaces()->GetInterface( - mojo::GetProxy(&installation_service)); + mojo::MakeRequest(&installation_service)); DCHECK(installation_service); installation_service->OnInstall(); }
diff --git a/chrome/browser/banners/app_banner_manager.cc b/chrome/browser/banners/app_banner_manager.cc index 2038125..6dc577b 100644 --- a/chrome/browser/banners/app_banner_manager.cc +++ b/chrome/browser/banners/app_banner_manager.cc
@@ -135,7 +135,7 @@ void AppBannerManager::OnInstall() { blink::mojom::InstallationServicePtr installation_service; web_contents()->GetMainFrame()->GetRemoteInterfaces()->GetInterface( - mojo::GetProxy(&installation_service)); + mojo::MakeRequest(&installation_service)); DCHECK(installation_service); installation_service->OnInstall(); } @@ -358,10 +358,10 @@ event_request_id_ = ++gCurrentRequestID; web_contents()->GetMainFrame()->GetRemoteInterfaces()->GetInterface( - mojo::GetProxy(&controller_)); + mojo::MakeRequest(&controller_)); controller_->BannerPromptRequest( - binding_.CreateInterfacePtrAndBind(), mojo::GetProxy(&event_), + binding_.CreateInterfacePtrAndBind(), mojo::MakeRequest(&event_), {GetBannerType()}, base::Bind(&AppBannerManager::OnBannerPromptReply, GetWeakPtr())); }
diff --git a/chrome/browser/chromeos/app_mode/arc/arc_kiosk_app_service.cc b/chrome/browser/chromeos/app_mode/arc/arc_kiosk_app_service.cc index 3e54f43..c98036f 100644 --- a/chrome/browser/chromeos/app_mode/arc/arc_kiosk_app_service.cc +++ b/chrome/browser/chromeos/app_mode/arc/arc_kiosk_app_service.cc
@@ -15,9 +15,8 @@ namespace chromeos { // static -ArcKioskAppService* ArcKioskAppService::Create(Profile* profile, - ArcAppListPrefs* prefs) { - return new ArcKioskAppService(profile, prefs); +ArcKioskAppService* ArcKioskAppService::Create(Profile* profile) { + return new ArcKioskAppService(profile); } // static @@ -25,6 +24,11 @@ return ArcKioskAppServiceFactory::GetForBrowserContext(context); } +void ArcKioskAppService::Shutdown() { + ArcAppListPrefs::Get(profile_)->RemoveObserver(this); + app_manager_->RemoveObserver(this); +} + void ArcKioskAppService::OnAppRegistered( const std::string& app_id, const ArcAppListPrefs::AppInfo& app_info) { @@ -62,14 +66,21 @@ } } -ArcKioskAppService::ArcKioskAppService(Profile* profile, ArcAppListPrefs* prefs) - : profile_(profile), prefs_(prefs) { - if (prefs_) - prefs_->AddObserver(this); +void ArcKioskAppService::OnMaintenanceSessionCreated() { + maintenance_session_running_ = true; + PreconditionsChanged(); +} + +void ArcKioskAppService::OnMaintenanceSessionFinished() { + maintenance_session_running_ = false; + PreconditionsChanged(); +} + +ArcKioskAppService::ArcKioskAppService(Profile* profile) : profile_(profile) { + ArcAppListPrefs::Get(profile_)->AddObserver(this); app_manager_ = ArcKioskAppManager::Get(); - if (app_manager_) { - app_manager_->AddObserver(this); - } + DCHECK(app_manager_); + app_manager_->AddObserver(this); pref_change_registrar_.reset(new PrefChangeRegistrar()); pref_change_registrar_->Init(profile_->GetPrefs()); // Try to start/stop kiosk app on policy compliance state change. @@ -80,22 +91,19 @@ PreconditionsChanged(); } -ArcKioskAppService::~ArcKioskAppService() { - if (prefs_) - prefs_->RemoveObserver(this); - if (app_manager_) - app_manager_->RemoveObserver(this); -} +ArcKioskAppService::~ArcKioskAppService() = default; void ArcKioskAppService::PreconditionsChanged() { app_id_ = GetAppId(); if (app_id_.empty()) return; - app_info_ = prefs_->GetApp(app_id_); + app_info_ = ArcAppListPrefs::Get(profile_)->GetApp(app_id_); if (app_info_ && app_info_->ready && - profile_->GetPrefs()->GetBoolean(prefs::kArcPolicyCompliant)) { + profile_->GetPrefs()->GetBoolean(prefs::kArcPolicyCompliant) && + !maintenance_session_running_) { if (!app_launcher_) - app_launcher_.reset(new ArcKioskAppLauncher(profile_, prefs_, app_id_)); + app_launcher_.reset(new ArcKioskAppLauncher( + profile_, ArcAppListPrefs::Get(profile_), app_id_)); } else if (task_id_ != -1) { arc::CloseTask(task_id_); } @@ -108,7 +116,8 @@ if (!app) return std::string(); std::unordered_set<std::string> app_ids = - prefs_->GetAppsForPackage(app->app_info().package_name()); + ArcAppListPrefs::Get(profile_)->GetAppsForPackage( + app->app_info().package_name()); if (app_ids.empty()) return std::string(); // TODO(poromov@): Choose appropriate app id to launch. See
diff --git a/chrome/browser/chromeos/app_mode/arc/arc_kiosk_app_service.h b/chrome/browser/chromeos/app_mode/arc/arc_kiosk_app_service.h index 79ed66a..384505b9 100644 --- a/chrome/browser/chromeos/app_mode/arc/arc_kiosk_app_service.h +++ b/chrome/browser/chromeos/app_mode/arc/arc_kiosk_app_service.h
@@ -9,9 +9,15 @@ #include "chrome/browser/chromeos/app_mode/arc/arc_kiosk_app_launcher.h" #include "chrome/browser/chromeos/app_mode/arc/arc_kiosk_app_manager.h" #include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h" +#include "components/arc/kiosk/arc_kiosk_bridge.h" #include "components/keyed_service/core/keyed_service.h" #include "components/prefs/pref_change_registrar.h" -#include "content/public/browser/browser_context.h" + +class Profile; + +namespace content { +class BrowserContext; +} // namespace content namespace chromeos { @@ -24,11 +30,15 @@ class ArcKioskAppService : public KeyedService, public ArcAppListPrefs::Observer, - public ArcKioskAppManager::ArcKioskAppManagerObserver { + public ArcKioskAppManager::ArcKioskAppManagerObserver, + public arc::ArcKioskBridge::Delegate { public: - static ArcKioskAppService* Create(Profile* profile, ArcAppListPrefs* prefs); + static ArcKioskAppService* Create(Profile* profile); static ArcKioskAppService* Get(content::BrowserContext* context); + // KeyedService overrides + void Shutdown() override; + // ArcAppListPrefs::Observer overrides void OnAppRegistered(const std::string& app_id, const ArcAppListPrefs::AppInfo& app_info) override; @@ -43,8 +53,12 @@ // ArcKioskAppManager::Observer overrides void OnArcKioskAppsChanged() override; + // ArcKioskBridge::Delegate overrides + void OnMaintenanceSessionCreated() override; + void OnMaintenanceSessionFinished() override; + private: - ArcKioskAppService(Profile* profile, ArcAppListPrefs* prefs); + explicit ArcKioskAppService(Profile* profile); ~ArcKioskAppService() override; std::string GetAppId(); @@ -52,7 +66,7 @@ void PreconditionsChanged(); Profile* const profile_; - ArcAppListPrefs* const prefs_; + bool maintenance_session_running_ = false; ArcKioskAppManager* app_manager_; std::string app_id_; std::unique_ptr<ArcAppListPrefs::AppInfo> app_info_;
diff --git a/chrome/browser/chromeos/app_mode/arc/arc_kiosk_app_service_factory.cc b/chrome/browser/chromeos/app_mode/arc/arc_kiosk_app_service_factory.cc index 1f43363..3b3d2ce 100644 --- a/chrome/browser/chromeos/app_mode/arc/arc_kiosk_app_service_factory.cc +++ b/chrome/browser/chromeos/app_mode/arc/arc_kiosk_app_service_factory.cc
@@ -37,7 +37,7 @@ Profile* profile = static_cast<Profile*>(context); DCHECK(profile); - return ArcKioskAppService::Create(profile, ArcAppListPrefs::Get(profile)); + return ArcKioskAppService::Create(profile); } } // namespace chromeos
diff --git a/chrome/browser/chromeos/arc/arc_service_launcher.cc b/chrome/browser/chromeos/arc/arc_service_launcher.cc index 891dc842..758e6d5 100644 --- a/chrome/browser/chromeos/arc/arc_service_launcher.cc +++ b/chrome/browser/chromeos/arc/arc_service_launcher.cc
@@ -8,6 +8,7 @@ #include "base/logging.h" #include "base/memory/ptr_util.h" +#include "chrome/browser/chromeos/app_mode/arc/arc_kiosk_app_service.h" #include "chrome/browser/chromeos/arc/arc_auth_service.h" #include "chrome/browser/chromeos/arc/arc_session_manager.h" #include "chrome/browser/chromeos/arc/downloads_watcher/arc_downloads_watcher_service.h" @@ -21,6 +22,7 @@ #include "chrome/browser/chromeos/arc/tts/arc_tts_service.h" #include "chrome/browser/chromeos/arc/video/gpu_arc_video_service_host.h" #include "chrome/browser/chromeos/arc/wallpaper/arc_wallpaper_service.h" +#include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/ash/multi_user/multi_user_util.h" #include "components/arc/arc_service_manager.h" #include "components/arc/audio/arc_audio_bridge.h" @@ -37,6 +39,7 @@ #include "components/arc/power/arc_power_bridge.h" #include "components/arc/storage_manager/arc_storage_manager.h" #include "components/prefs/pref_member.h" +#include "components/user_manager/user_manager.h" #include "content/public/browser/browser_thread.h" #include "ui/arc/notification/arc_notification_manager.h" @@ -109,8 +112,6 @@ arc_service_manager_->AddService( base::MakeUnique<ArcImeService>(arc_bridge_service)); arc_service_manager_->AddService( - base::MakeUnique<ArcKioskBridge>(arc_bridge_service)); - arc_service_manager_->AddService( base::MakeUnique<ArcMetricsService>(arc_bridge_service)); arc_service_manager_->AddService( base::MakeUnique<ArcNetHostImpl>(arc_bridge_service)); @@ -141,6 +142,16 @@ arc_service_manager_->AddService(base::MakeUnique<ArcNotificationManager>( arc_service_manager_->arc_bridge_service(), multi_user_util::GetAccountIdFromProfile(profile))); + + // Kiosk apps should be run only for kiosk sessions. + if (user_manager::UserManager::Get()->IsLoggedInAsArcKioskApp()) { + // ArcKioskAppService is BrowserContextKeyedService so that it's destroyed + // on destroying the Profile, that is after ArcServiceLauncher::Shutdown(). + arc_service_manager_->AddService(base::MakeUnique<ArcKioskBridge>( + arc_service_manager_->arc_bridge_service(), + chromeos::ArcKioskAppService::Get(profile))); + } + arc_session_manager_->OnPrimaryUserProfilePrepared(profile); }
diff --git a/chrome/browser/importer/external_process_importer_client.cc b/chrome/browser/importer/external_process_importer_client.cc index 2ad13d4..c4894cf 100644 --- a/chrome/browser/importer/external_process_importer_client.cc +++ b/chrome/browser/importer/external_process_importer_client.cc
@@ -45,7 +45,7 @@ AddRef(); // balanced in Cleanup. chrome::mojom::ProfileImportRequest request = - mojo::GetProxy(&profile_import_); + mojo::MakeRequest(&profile_import_); BrowserThread::ID thread_id; CHECK(BrowserThread::GetCurrentThreadIdentifier(&thread_id));
diff --git a/chrome/browser/media/cast_remoting_connector_unittest.cc b/chrome/browser/media/cast_remoting_connector_unittest.cc index f2e178e..bf613be2 100644 --- a/chrome/browser/media/cast_remoting_connector_unittest.cc +++ b/chrome/browser/media/cast_remoting_connector_unittest.cc
@@ -258,10 +258,10 @@ protected: RemoterPtr CreateRemoter(MockRemotingSource* source) { RemotingSourcePtr source_ptr; - source->Bind(mojo::GetProxy(&source_ptr)); + source->Bind(mojo::MakeRequest(&source_ptr)); RemoterPtr remoter_ptr; connector_.CreateBridge(std::move(source_ptr), - mojo::GetProxy(&remoter_ptr)); + mojo::MakeRequest(&remoter_ptr)); return remoter_ptr; }
diff --git a/chrome/browser/media/cast_remoting_sender_unittest.cc b/chrome/browser/media/cast_remoting_sender_unittest.cc index 8a9d4ad..9a4a716 100644 --- a/chrome/browser/media/cast_remoting_sender_unittest.cc +++ b/chrome/browser/media/cast_remoting_sender_unittest.cc
@@ -132,7 +132,7 @@ CastRemotingSender::FindAndBind( transport_config_.rtp_stream_id, std::move(consumer_end), - GetProxy(&sender_), + MakeRequest(&sender_), base::Bind(&CastRemotingSenderTest::OnError, base::Unretained(this))); RunPendingTasks();
diff --git a/chrome/browser/media/router/mojo/media_router_mojo_impl_unittest.cc b/chrome/browser/media/router/mojo/media_router_mojo_impl_unittest.cc index d0b302ae..4837c6a1 100644 --- a/chrome/browser/media/router/mojo/media_router_mojo_impl_unittest.cc +++ b/chrome/browser/media/router/mojo/media_router_mojo_impl_unittest.cc
@@ -1227,14 +1227,14 @@ void BindMediaRouteProvider() { binding_.reset(new mojo::Binding<mojom::MediaRouteProvider>( &mock_media_route_provider_, - mojo::GetProxy(&media_route_provider_proxy_))); - media_router_->BindToMojoRequest(mojo::GetProxy(&media_router_proxy_), + mojo::MakeRequest(&media_route_provider_proxy_))); + media_router_->BindToMojoRequest(mojo::MakeRequest(&media_router_proxy_), *extension_); } void ResetMediaRouteProvider() { binding_.reset(); - media_router_->BindToMojoRequest(mojo::GetProxy(&media_router_proxy_), + media_router_->BindToMojoRequest(mojo::MakeRequest(&media_router_proxy_), *extension_); }
diff --git a/chrome/browser/media/router/mojo/media_router_mojo_test.cc b/chrome/browser/media/router/mojo/media_router_mojo_test.cc index 6b9bb128..305877dd 100644 --- a/chrome/browser/media/router/mojo/media_router_mojo_test.cc +++ b/chrome/browser/media/router/mojo/media_router_mojo_test.cc
@@ -40,14 +40,14 @@ void MediaRouterMojoTest::ConnectProviderManagerService() { // Bind the |media_route_provider| interface to |media_route_provider_|. - auto request = mojo::GetProxy(&media_router_proxy_); + auto request = mojo::MakeRequest(&media_router_proxy_); mock_media_router_->BindToMojoRequest(std::move(request), *extension_); // Bind the Mojo MediaRouter interface used by |mock_media_router_| to // |mock_media_route_provider_service_|. mojom::MediaRouteProviderPtr mojo_media_router; binding_.reset(new mojo::Binding<mojom::MediaRouteProvider>( - &mock_media_route_provider_, mojo::GetProxy(&mojo_media_router))); + &mock_media_route_provider_, mojo::MakeRequest(&mojo_media_router))); media_router_proxy_->RegisterMediaRouteProvider( std::move(mojo_media_router), base::Bind(&ExpectEqualStrings, kInstanceId));
diff --git a/chrome/browser/process_resource_usage.h b/chrome/browser/process_resource_usage.h index 0a838088..9c37540 100644 --- a/chrome/browser/process_resource_usage.h +++ b/chrome/browser/process_resource_usage.h
@@ -28,7 +28,7 @@ // 1. Create a chrome::mojom::ResourceUsageReporterPtr and obtain an // InterfaceRequest<> // using -// mojo::GetProxy. +// mojo::MakeRequest. // 2. Use the child process's service registry to connect to the service using // the InterfaceRequest<>. Note, ServiceRegistry is thread hostile and // must always be accessed from the same thread. However, InterfaceRequest<> @@ -46,7 +46,7 @@ // ... // chrome::mojom::ResourceUsageReporterPtr service; // mojo::InterfaceRequest<chrome::mojom::ResourceUsageReporter> request = -// mojo::GetProxy(&service); +// mojo::MakeRequest(&service); // content::BrowserThread::PostTask( // content::BrowserThread::IO, FROM_HERE, // base::Bind(&Foo::ConnectToService, this, base::Passed(&request)));
diff --git a/chrome/browser/task_manager/providers/child_process_task.cc b/chrome/browser/task_manager/providers/child_process_task.cc index 3738128..b4ed48f 100644 --- a/chrome/browser/task_manager/providers/child_process_task.cc +++ b/chrome/browser/task_manager/providers/child_process_task.cc
@@ -137,7 +137,7 @@ int unique_child_process_id) { chrome::mojom::ResourceUsageReporterPtr usage_reporter; chrome::mojom::ResourceUsageReporterRequest request = - mojo::GetProxy(&usage_reporter); + mojo::MakeRequest(&usage_reporter); content::BrowserThread::PostTask( content::BrowserThread::IO, FROM_HERE,
diff --git a/chrome/browser/ui/app_list/arc/arc_app_list_prefs.cc b/chrome/browser/ui/app_list/arc/arc_app_list_prefs.cc index 56017ef..d672c13 100644 --- a/chrome/browser/ui/app_list/arc/arc_app_list_prefs.cc +++ b/chrome/browser/ui/app_list/arc/arc_app_list_prefs.cc
@@ -12,7 +12,6 @@ #include "base/metrics/histogram_macros.h" #include "base/strings/string_number_conversions.h" #include "base/task_runner_util.h" -#include "chrome/browser/chromeos/app_mode/arc/arc_kiosk_app_service.h" #include "chrome/browser/chromeos/arc/policy/arc_policy_util.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/app_list/app_list_service.h" @@ -668,12 +667,6 @@ // Note, sync_service_ may be nullptr in testing. sync_service_ = arc::ArcPackageSyncableService::Get(profile_); - // Kiosk apps should be run only for kiosk sessions. - if (user_manager::UserManager::Get()->IsLoggedInAsArcKioskApp()) { - kiosk_app_service_ = chromeos::ArcKioskAppService::Get(profile_); - DCHECK(kiosk_app_service_); - } - // In some tests app_instance may not be set. if (!app_instance) return; @@ -693,7 +686,6 @@ sync_service_ = nullptr; } - kiosk_app_service_ = nullptr; is_initialized_ = false; package_list_initial_refreshed_ = false; }
diff --git a/chrome/browser/ui/app_list/arc/arc_app_list_prefs.h b/chrome/browser/ui/app_list/arc/arc_app_list_prefs.h index 49c4ceda..ae51dede 100644 --- a/chrome/browser/ui/app_list/arc/arc_app_list_prefs.h +++ b/chrome/browser/ui/app_list/arc/arc_app_list_prefs.h
@@ -34,10 +34,6 @@ class ArcPackageSyncableService; } // namespace arc -namespace chromeos { -class ArcKioskAppService; -} // namespace chromeos - namespace content { class BrowserContext; } // namespace content @@ -381,8 +377,6 @@ bool package_list_initial_refreshed_ = false; arc::ArcPackageSyncableService* sync_service_ = nullptr; - // Track ARC kiosk app and auto-launches it if needed. - chromeos::ArcKioskAppService* kiosk_app_service_ = nullptr; mojo::Binding<arc::mojom::AppHost> binding_;
diff --git a/chrome/browser/ui/passwords/manage_passwords_bubble_model.cc b/chrome/browser/ui/passwords/manage_passwords_bubble_model.cc index 5d5a6b8..5dd71865 100644 --- a/chrome/browser/ui/passwords/manage_passwords_bubble_model.cc +++ b/chrome/browser/ui/passwords/manage_passwords_bubble_model.cc
@@ -80,8 +80,8 @@ ~InteractionKeeper() = default; - // Records UMA events and updates the interaction statistics when the bubble - // is closed. + // Records UMA events, updates the interaction statistics and sends + // notifications to the delegate when the bubble is closed. void ReportInteractions(const ManagePasswordsBubbleModel* model); void set_dismissal_reason( @@ -200,15 +200,22 @@ if (model->state() == password_manager::ui::PENDING_PASSWORD_UPDATE_STATE || model->state() == password_manager::ui::PENDING_PASSWORD_STATE) { + // Send a notification if there was no interaction with the bubble. + bool no_interaction = + model->state() == password_manager::ui::PENDING_PASSWORD_UPDATE_STATE + ? update_password_submission_event_ == + metrics_util::NO_UPDATE_SUBMISSION + : dismissal_reason_ == metrics_util::NO_DIRECT_INTERACTION; + if (no_interaction && model->delegate_) { + model->delegate_->OnNoInteraction(); + } + + // Send UMA. if (update_password_submission_event_ == metrics_util::NO_UPDATE_SUBMISSION) { update_password_submission_event_ = model->GetUpdateDismissalReason(NO_INTERACTION); - if (model->delegate_ && - model->state() == password_manager::ui::PENDING_PASSWORD_UPDATE_STATE) - model->delegate_->OnNoInteractionOnUpdate(); } - if (update_password_submission_event_ != metrics_util::NO_UPDATE_SUBMISSION) LogUpdatePasswordSubmissionEvent(update_password_submission_event_); }
diff --git a/chrome/browser/ui/passwords/manage_passwords_bubble_model_unittest.cc b/chrome/browser/ui/passwords/manage_passwords_bubble_model_unittest.cc index a2b661f..16b4c3b4 100644 --- a/chrome/browser/ui/passwords/manage_passwords_bubble_model_unittest.cc +++ b/chrome/browser/ui/passwords/manage_passwords_bubble_model_unittest.cc
@@ -258,6 +258,7 @@ stats.dismissal_count++; stats.update_time = now; EXPECT_CALL(*GetStore(), AddSiteStatsImpl(stats)); + EXPECT_CALL(*controller(), OnNoInteraction()); EXPECT_CALL(*controller(), SavePassword()).Times(0); EXPECT_CALL(*controller(), NeverSavePassword()).Times(0); DestroyModelExpectReason( @@ -332,6 +333,7 @@ EXPECT_TRUE(model()->ShouldShowGoogleSmartLockWelcome()); EXPECT_CALL(*GetStore(), AddSiteStatsImpl(_)); + EXPECT_CALL(*controller(), OnNoInteraction()); DestroyModel(); PretendPasswordWaiting(); @@ -352,6 +354,7 @@ EXPECT_FALSE(model()->ShouldShowGoogleSmartLockWelcome()); EXPECT_CALL(*GetStore(), AddSiteStatsImpl(_)); + EXPECT_CALL(*controller(), OnNoInteraction()); DestroyModel(); PretendPasswordWaiting();
diff --git a/chrome/browser/ui/passwords/manage_passwords_ui_controller.cc b/chrome/browser/ui/passwords/manage_passwords_ui_controller.cc index 30b714c..5aa83e9b 100644 --- a/chrome/browser/ui/passwords/manage_passwords_ui_controller.cc +++ b/chrome/browser/ui/passwords/manage_passwords_ui_controller.cc
@@ -263,16 +263,19 @@ UpdateBubbleAndIconVisibility(); } -void ManagePasswordsUIController::OnNoInteractionOnUpdate() { - if (GetState() != password_manager::ui::PENDING_PASSWORD_UPDATE_STATE) { +void ManagePasswordsUIController::OnNoInteraction() { + if (GetState() != password_manager::ui::PENDING_PASSWORD_UPDATE_STATE && + GetState() != password_manager::ui::PENDING_PASSWORD_STATE) { // Do nothing if the state was changed. It can happen for example when the - // update bubble is active and a page navigation happens. + // bubble is active and a page navigation happens. return; } + bool is_update = + GetState() == password_manager::ui::PENDING_PASSWORD_UPDATE_STATE; password_manager::PasswordFormManager* form_manager = passwords_data_.form_manager(); DCHECK(form_manager); - form_manager->OnNoInteractionOnUpdate(); + form_manager->OnNoInteraction(is_update); } void ManagePasswordsUIController::OnNopeUpdateClicked() { @@ -382,7 +385,7 @@ password_manager::PasswordFormManager* form_manager = passwords_data_.form_manager(); DCHECK(form_manager); - form_manager->PermanentlyBlacklist(); + form_manager->OnNeverClicked(); } void ManagePasswordsUIController::UpdateBubbleAndIconVisibility() {
diff --git a/chrome/browser/ui/passwords/manage_passwords_ui_controller.h b/chrome/browser/ui/passwords/manage_passwords_ui_controller.h index 188bc30..4226b23 100644 --- a/chrome/browser/ui/passwords/manage_passwords_ui_controller.h +++ b/chrome/browser/ui/passwords/manage_passwords_ui_controller.h
@@ -94,7 +94,7 @@ const override; void OnBubbleShown() override; void OnBubbleHidden() override; - void OnNoInteractionOnUpdate() override; + void OnNoInteraction() override; void OnNopeUpdateClicked() override; void NeverSavePassword() override; void SavePassword() override;
diff --git a/chrome/browser/ui/passwords/manage_passwords_ui_controller_mock.h b/chrome/browser/ui/passwords/manage_passwords_ui_controller_mock.h index 02a157d09..14f8e6e3 100644 --- a/chrome/browser/ui/passwords/manage_passwords_ui_controller_mock.h +++ b/chrome/browser/ui/passwords/manage_passwords_ui_controller_mock.h
@@ -30,7 +30,7 @@ password_manager::InteractionsStats*()); MOCK_METHOD0(OnBubbleShown, void()); MOCK_METHOD0(OnBubbleHidden, void()); - MOCK_METHOD0(OnNoInteractionOnUpdate, void()); + MOCK_METHOD0(OnNoInteraction, void()); MOCK_METHOD0(OnNopeUpdateClicked, void()); MOCK_METHOD0(NeverSavePassword, void()); MOCK_METHOD0(SavePassword, void());
diff --git a/chrome/browser/ui/passwords/passwords_model_delegate.h b/chrome/browser/ui/passwords/passwords_model_delegate.h index 9fdcdd7..e1bf8349 100644 --- a/chrome/browser/ui/passwords/passwords_model_delegate.h +++ b/chrome/browser/ui/passwords/passwords_model_delegate.h
@@ -60,8 +60,8 @@ // Called from the model when the bubble is hidden. virtual void OnBubbleHidden() = 0; - // Called when the user didn't interact with the Update UI. - virtual void OnNoInteractionOnUpdate() = 0; + // Called when the user didn't interact with UI. + virtual void OnNoInteraction() = 0; // Called when the user chose not to update password. virtual void OnNopeUpdateClicked() = 0;
diff --git a/chrome/browser/ui/passwords/passwords_model_delegate_mock.h b/chrome/browser/ui/passwords/passwords_model_delegate_mock.h index 502be282..622ed981 100644 --- a/chrome/browser/ui/passwords/passwords_model_delegate_mock.h +++ b/chrome/browser/ui/passwords/passwords_model_delegate_mock.h
@@ -29,7 +29,7 @@ password_manager::InteractionsStats*()); MOCK_METHOD0(OnBubbleShown, void()); MOCK_METHOD0(OnBubbleHidden, void()); - MOCK_METHOD0(OnNoInteractionOnUpdate, void()); + MOCK_METHOD0(OnNoInteraction, void()); MOCK_METHOD0(OnNopeUpdateClicked, void()); MOCK_METHOD0(NeverSavePassword, void()); MOCK_METHOD0(SavePassword, void());
diff --git a/chrome/browser/ui/views/ime_driver/ime_driver_mus.cc b/chrome/browser/ui/views/ime_driver/ime_driver_mus.cc index 763cbd90..f091506 100644 --- a/chrome/browser/ui/views/ime_driver/ime_driver_mus.cc +++ b/chrome/browser/ui/views/ime_driver/ime_driver_mus.cc
@@ -29,7 +29,7 @@ DCHECK_CURRENTLY_ON(content::BrowserThread::UI); ui::mojom::IMEDriverPtr ime_driver_ptr; mojo::MakeStrongBinding(base::MakeUnique<IMEDriver>(), - GetProxy(&ime_driver_ptr)); + MakeRequest(&ime_driver_ptr)); ui::mojom::IMERegistrarPtr ime_registrar; content::ServiceManagerConnection::GetForProcess() ->GetConnector()
diff --git a/chrome/browser/ui/views/ime_driver/input_method_bridge_chromeos_unittest.cc b/chrome/browser/ui/views/ime_driver/input_method_bridge_chromeos_unittest.cc index 9d7cc668..79c4600 100644 --- a/chrome/browser/ui/views/ime_driver/input_method_bridge_chromeos_unittest.cc +++ b/chrome/browser/ui/views/ime_driver/input_method_bridge_chromeos_unittest.cc
@@ -104,7 +104,7 @@ ui::IMEBridge::Initialize(); ui::mojom::TextInputClientPtr client_ptr; - client_ = base::MakeUnique<TestTextInputClient>(GetProxy(&client_ptr)); + client_ = base::MakeUnique<TestTextInputClient>(MakeRequest(&client_ptr)); input_method_ = base::MakeUnique<InputMethodBridge>(std::move(client_ptr)); }
diff --git a/chrome/browser/webshare/share_service_impl_unittest.cc b/chrome/browser/webshare/share_service_impl_unittest.cc index fe0e1c7..ae8b258 100644 --- a/chrome/browser/webshare/share_service_impl_unittest.cc +++ b/chrome/browser/webshare/share_service_impl_unittest.cc
@@ -19,7 +19,7 @@ void SetUp() override { ChromeRenderViewHostTestHarness::SetUp(); - ShareServiceImpl::Create(mojo::GetProxy(&share_service_)); + ShareServiceImpl::Create(mojo::MakeRequest(&share_service_)); } void TearDown() override {
diff --git a/chrome/gpu/gpu_arc_video_service.cc b/chrome/gpu/gpu_arc_video_service.cc index 14c3775f..822566f 100644 --- a/chrome/gpu/gpu_arc_video_service.cc +++ b/chrome/gpu/gpu_arc_video_service.cc
@@ -137,11 +137,11 @@ ::arc::mojom::VideoAcceleratorServicePtr service_proxy; ::arc::mojom::VideoAcceleratorServiceRequest request = - mojo::GetProxy(&service_proxy); + mojo::MakeRequest(&service_proxy); service->client_->DeprecatedInit(std::move(service_proxy)); auto binding = mojo::MakeStrongBinding(std::move(service), - mojo::GetProxy(&service_proxy)); + mojo::MakeRequest(&service_proxy)); binding->set_connection_error_handler(base::Bind(&OnConnectionError)); }
diff --git a/chrome/test/base/mojo_test_connector.cc b/chrome/test/base/mojo_test_connector.cc index a4010815..ef0effc 100644 --- a/chrome/test/base/mojo_test_connector.cc +++ b/chrome/test/base/mojo_test_connector.cc
@@ -81,7 +81,7 @@ client_process_connection->service = service.PassInterface().PassHandle(); client_process_connection->pid_receiver_request = - mojo::GetProxy(&pid_receiver_).PassMessagePipe(); + mojo::MakeRequest(&pid_receiver_).PassMessagePipe(); params->set_client_process_connection(std::move(client_process_connection)); service_manager->Connect(std::move(params)); }
diff --git a/components/arc/crash_collector/arc_crash_collector_bridge.cc b/components/arc/crash_collector/arc_crash_collector_bridge.cc index 34e8175..9780b559 100644 --- a/components/arc/crash_collector/arc_crash_collector_bridge.cc +++ b/components/arc/crash_collector/arc_crash_collector_bridge.cc
@@ -63,7 +63,7 @@ void ArcCrashCollectorBridge::OnInstanceReady() { mojom::CrashCollectorHostPtr host_ptr; - binding_.Bind(mojo::GetProxy(&host_ptr)); + binding_.Bind(mojo::MakeRequest(&host_ptr)); auto* instance = arc_bridge_service()->crash_collector()->GetInstanceForMethod("Init"); DCHECK(instance);
diff --git a/components/arc/kiosk/arc_kiosk_bridge.cc b/components/arc/kiosk/arc_kiosk_bridge.cc index bb915bb9..1a263724 100644 --- a/components/arc/kiosk/arc_kiosk_bridge.cc +++ b/components/arc/kiosk/arc_kiosk_bridge.cc
@@ -5,12 +5,13 @@ #include "components/arc/kiosk/arc_kiosk_bridge.h" #include "components/arc/arc_bridge_service.h" -#include "components/arc/arc_service_manager.h" namespace arc { -ArcKioskBridge::ArcKioskBridge(ArcBridgeService* bridge_service) - : ArcService(bridge_service), binding_(this) { +ArcKioskBridge::ArcKioskBridge(ArcBridgeService* bridge_service, + Delegate* delegate) + : ArcService(bridge_service), binding_(this), delegate_(delegate) { + DCHECK(delegate_); arc_bridge_service()->kiosk()->AddObserver(this); } @@ -26,12 +27,13 @@ } void ArcKioskBridge::OnMaintenanceSessionCreated(int32_t session_id) { + delegate_->OnMaintenanceSessionCreated(); // TODO(poromov@) Show appropriate splash screen. } void ArcKioskBridge::OnMaintenanceSessionFinished(int32_t session_id, bool success) { - // TODO(poromov@) Start kiosk app. + delegate_->OnMaintenanceSessionFinished(); } } // namespace arc
diff --git a/components/arc/kiosk/arc_kiosk_bridge.h b/components/arc/kiosk/arc_kiosk_bridge.h index ab0323f..fa04fe9b 100644 --- a/components/arc/kiosk/arc_kiosk_bridge.h +++ b/components/arc/kiosk/arc_kiosk_bridge.h
@@ -21,7 +21,16 @@ public InstanceHolder<mojom::KioskInstance>::Observer, public mojom::KioskHost { public: - explicit ArcKioskBridge(ArcBridgeService* bridge_service); + // Received IPCs are passed to this delegate. + class Delegate { + public: + virtual ~Delegate() = default; + virtual void OnMaintenanceSessionCreated() = 0; + virtual void OnMaintenanceSessionFinished() = 0; + }; + + // |delegate| should be alive while the ArcKioskBridge instance is alive. + ArcKioskBridge(ArcBridgeService* bridge_service, Delegate* delegate); ~ArcKioskBridge() override; // InstanceHolder<mojom::KioskInstance>::Observer overrides. @@ -33,6 +42,7 @@ private: mojo::Binding<mojom::KioskHost> binding_; + Delegate* const delegate_; DISALLOW_COPY_AND_ASSIGN(ArcKioskBridge); };
diff --git a/components/arc/metrics/arc_metrics_service.cc b/components/arc/metrics/arc_metrics_service.cc index a7f663a..b82d65c 100644 --- a/components/arc/metrics/arc_metrics_service.cc +++ b/components/arc/metrics/arc_metrics_service.cc
@@ -129,7 +129,7 @@ // time availability in ReportBootProgress(). if (!binding_.is_bound()) { mojom::MetricsHostPtr host_ptr; - binding_.Bind(mojo::GetProxy(&host_ptr)); + binding_.Bind(mojo::MakeRequest(&host_ptr)); instance->Init(std::move(host_ptr)); } arc_start_time_ = arc_start_time;
diff --git a/components/arc/net/arc_net_host_impl.cc b/components/arc/net/arc_net_host_impl.cc index d2612dac..fa1f199 100644 --- a/components/arc/net/arc_net_host_impl.cc +++ b/components/arc/net/arc_net_host_impl.cc
@@ -306,7 +306,7 @@ DCHECK(thread_checker_.CalledOnValidThread()); mojom::NetHostPtr host; - binding_.Bind(GetProxy(&host)); + binding_.Bind(MakeRequest(&host)); auto* instance = arc_bridge_service()->net()->GetInstanceForMethod("Init"); DCHECK(instance); instance->Init(std::move(host));
diff --git a/components/autofill/content/browser/content_autofill_driver.cc b/components/autofill/content/browser/content_autofill_driver.cc index 41e3397..2449d6c 100644 --- a/components/autofill/content/browser/content_autofill_driver.cc +++ b/components/autofill/content/browser/content_autofill_driver.cc
@@ -260,7 +260,7 @@ // Here is a lazy binding, and will not reconnect after connection error. if (!autofill_agent_) { render_frame_host_->GetRemoteInterfaces()->GetInterface( - mojo::GetProxy(&autofill_agent_)); + mojo::MakeRequest(&autofill_agent_)); } return autofill_agent_;
diff --git a/components/autofill/content/renderer/autofill_agent.cc b/components/autofill/content/renderer/autofill_agent.cc index a0100b35..65e411aa 100644 --- a/components/autofill/content/renderer/autofill_agent.cc +++ b/components/autofill/content/renderer/autofill_agent.cc
@@ -779,7 +779,7 @@ const mojom::AutofillDriverPtr& AutofillAgent::GetAutofillDriver() { if (!autofill_driver_) { render_frame()->GetRemoteInterfaces()->GetInterface( - mojo::GetProxy(&autofill_driver_)); + mojo::MakeRequest(&autofill_driver_)); } return autofill_driver_;
diff --git a/components/autofill/content/renderer/password_autofill_agent.cc b/components/autofill/content/renderer/password_autofill_agent.cc index 5163c56..4f81a538 100644 --- a/components/autofill/content/renderer/password_autofill_agent.cc +++ b/components/autofill/content/renderer/password_autofill_agent.cc
@@ -1501,7 +1501,7 @@ PasswordAutofillAgent::GetPasswordManagerDriver() { if (!password_manager_driver_) { render_frame()->GetRemoteInterfaces()->GetInterface( - mojo::GetProxy(&password_manager_driver_)); + mojo::MakeRequest(&password_manager_driver_)); } return password_manager_driver_;
diff --git a/components/exo/surface.cc b/components/exo/surface.cc index 6c519c8..0f32435 100644 --- a/components/exo/surface.cc +++ b/components/exo/surface.cc
@@ -180,7 +180,7 @@ ->AllocateFrameSinkId()) { cc::mojom::MojoCompositorFrameSinkClientPtr frame_sink_holder_ptr; cc::mojom::MojoCompositorFrameSinkClientRequest frame_sink_client_request = - mojo::GetProxy(&frame_sink_holder_ptr); + mojo::MakeRequest(&frame_sink_holder_ptr); std::unique_ptr<CompositorFrameSink> frame_sink(new CompositorFrameSink( frame_sink_id_, aura::Env::GetInstance()->context_factory_private()->GetSurfaceManager(),
diff --git a/components/filesystem/directory_impl_unittest.cc b/components/filesystem/directory_impl_unittest.cc index 836d21a..250c6de2 100644 --- a/components/filesystem/directory_impl_unittest.cc +++ b/components/filesystem/directory_impl_unittest.cc
@@ -135,7 +135,7 @@ mojom::DirectoryPtr my_file_directory; error = mojom::FileError::FAILED; bool handled = directory->OpenDirectory( - "my_file", GetProxy(&my_file_directory), + "my_file", MakeRequest(&my_file_directory), mojom::kFlagRead | mojom::kFlagWrite | mojom::kFlagCreate, &error); ASSERT_TRUE(handled); EXPECT_EQ(mojom::FileError::OK, error); @@ -146,7 +146,7 @@ mojom::FilePtr file; error = mojom::FileError::FAILED; bool handled = - directory->OpenFile("my_file", GetProxy(&file), + directory->OpenFile("my_file", MakeRequest(&file), mojom::kFlagRead | mojom::kFlagOpen, &error); ASSERT_TRUE(handled); EXPECT_EQ(mojom::FileError::NOT_A_FILE, error); @@ -162,8 +162,8 @@ mojom::DirectoryPtr directory; GetTemporaryRoot(&directory); - directory->Clone(GetProxy(&clone_one)); - directory->Clone(GetProxy(&clone_two)); + directory->Clone(MakeRequest(&clone_one)); + directory->Clone(MakeRequest(&clone_two)); // Original temporary directory goes out of scope here; shouldn't be // deleted since it has clones. @@ -236,7 +236,7 @@ mojom::DirectoryPtr my_file_directory; error = mojom::FileError::FAILED; bool handled = directory->OpenDirectory( - "my_dir", GetProxy(&my_file_directory), + "my_dir", MakeRequest(&my_file_directory), mojom::kFlagRead | mojom::kFlagWrite | mojom::kFlagCreate, &error); ASSERT_TRUE(handled); EXPECT_EQ(mojom::FileError::OK, error); @@ -261,7 +261,7 @@ mojom::DirectoryPtr my_file_directory; error = mojom::FileError::FAILED; bool handled = directory->OpenDirectory( - "my_dir", GetProxy(&my_file_directory), + "my_dir", MakeRequest(&my_file_directory), mojom::kFlagRead | mojom::kFlagWrite | mojom::kFlagCreate, &error); ASSERT_TRUE(handled); EXPECT_EQ(mojom::FileError::OK, error);
diff --git a/components/filesystem/file_impl_unittest.cc b/components/filesystem/file_impl_unittest.cc index be20bfb..492c243 100644 --- a/components/filesystem/file_impl_unittest.cc +++ b/components/filesystem/file_impl_unittest.cc
@@ -28,7 +28,7 @@ mojom::FilePtr file; error = mojom::FileError::FAILED; handled = - directory->OpenFile("my_file", GetProxy(&file), + directory->OpenFile("my_file", MakeRequest(&file), mojom::kFlagWrite | mojom::kFlagCreate, &error); ASSERT_TRUE(handled); EXPECT_EQ(mojom::FileError::OK, error); @@ -66,7 +66,7 @@ mojom::FilePtr file; error = mojom::FileError::FAILED; bool handled = - directory->OpenFile("your_file", GetProxy(&file), + directory->OpenFile("your_file", MakeRequest(&file), mojom::kFlagRead | mojom::kFlagOpen, &error); ASSERT_TRUE(handled); EXPECT_EQ(mojom::FileError::OK, error); @@ -104,7 +104,7 @@ mojom::FilePtr file; error = mojom::FileError::FAILED; bool handled = - directory->OpenFile("my_file", GetProxy(&file), + directory->OpenFile("my_file", MakeRequest(&file), mojom::kFlagWrite | mojom::kFlagCreate, &error); ASSERT_TRUE(handled); EXPECT_EQ(mojom::FileError::OK, error); @@ -130,7 +130,7 @@ mojom::FilePtr file; error = mojom::FileError::FAILED; bool handled = - directory->OpenFile("my_file", GetProxy(&file), + directory->OpenFile("my_file", MakeRequest(&file), mojom::kFlagRead | mojom::kFlagOpen, &error); ASSERT_TRUE(handled); EXPECT_EQ(mojom::FileError::OK, error); @@ -163,7 +163,7 @@ mojom::FilePtr file; error = mojom::FileError::FAILED; bool handled = - directory->OpenFile("my_file", GetProxy(&file), + directory->OpenFile("my_file", MakeRequest(&file), mojom::kFlagWrite | mojom::kFlagCreate, &error); ASSERT_TRUE(handled); EXPECT_EQ(mojom::FileError::OK, error); @@ -195,7 +195,7 @@ mojom::FilePtr file; error = mojom::FileError::FAILED; bool handled = - directory->OpenFile("my_file", GetProxy(&file), + directory->OpenFile("my_file", MakeRequest(&file), mojom::kFlagAppend | mojom::kFlagOpen, &error); ASSERT_TRUE(handled); EXPECT_EQ(mojom::FileError::OK, error); @@ -229,7 +229,7 @@ mojom::FilePtr file; error = mojom::FileError::FAILED; bool handled = - directory->OpenFile("my_file", GetProxy(&file), + directory->OpenFile("my_file", MakeRequest(&file), mojom::kFlagRead | mojom::kFlagOpen, &error); ASSERT_TRUE(handled); EXPECT_EQ(mojom::FileError::OK, error); @@ -259,7 +259,7 @@ mojom::FilePtr file; error = mojom::FileError::FAILED; bool handled = - directory->OpenFile("my_file", GetProxy(&file), + directory->OpenFile("my_file", MakeRequest(&file), mojom::kFlagWrite | mojom::kFlagCreate, &error); ASSERT_TRUE(handled); EXPECT_EQ(mojom::FileError::OK, error); @@ -291,7 +291,7 @@ mojom::FilePtr file; error = mojom::FileError::FAILED; bool handled = directory->OpenFile( - "my_file", GetProxy(&file), + "my_file", MakeRequest(&file), mojom::kFlagWrite | mojom::kFlagOpenTruncated, &error); ASSERT_TRUE(handled); EXPECT_EQ(mojom::FileError::OK, error); @@ -325,7 +325,7 @@ mojom::FilePtr file; error = mojom::FileError::FAILED; bool handled = - directory->OpenFile("my_file", GetProxy(&file), + directory->OpenFile("my_file", MakeRequest(&file), mojom::kFlagRead | mojom::kFlagOpen, &error); ASSERT_TRUE(handled); EXPECT_EQ(mojom::FileError::OK, error); @@ -356,7 +356,7 @@ mojom::FilePtr file; error = mojom::FileError::FAILED; bool handled = - directory->OpenFile("my_file", GetProxy(&file), + directory->OpenFile("my_file", MakeRequest(&file), mojom::kFlagWrite | mojom::kFlagCreate, &error); ASSERT_TRUE(handled); EXPECT_EQ(mojom::FileError::OK, error); @@ -427,7 +427,7 @@ mojom::FilePtr file; error = mojom::FileError::FAILED; bool handled = - directory->OpenFile("my_file", GetProxy(&file), + directory->OpenFile("my_file", MakeRequest(&file), mojom::kFlagWrite | mojom::kFlagCreate, &error); ASSERT_TRUE(handled); EXPECT_EQ(mojom::FileError::OK, error); @@ -513,7 +513,7 @@ mojom::FilePtr file1; error = mojom::FileError::FAILED; bool handled = directory->OpenFile( - "my_file", GetProxy(&file1), + "my_file", MakeRequest(&file1), mojom::kFlagRead | mojom::kFlagWrite | mojom::kFlagCreate, &error); ASSERT_TRUE(handled); EXPECT_EQ(mojom::FileError::OK, error); @@ -537,7 +537,7 @@ // Dup it. mojom::FilePtr file2; error = mojom::FileError::FAILED; - handled = file1->Dup(GetProxy(&file2), &error); + handled = file1->Dup(MakeRequest(&file2), &error); ASSERT_TRUE(handled); EXPECT_EQ(mojom::FileError::OK, error); @@ -607,7 +607,7 @@ mojom::FilePtr file; error = mojom::FileError::FAILED; bool handled = - directory->OpenFile("my_file", GetProxy(&file), + directory->OpenFile("my_file", MakeRequest(&file), mojom::kFlagWrite | mojom::kFlagCreate, &error); ASSERT_TRUE(handled); EXPECT_EQ(mojom::FileError::OK, error); @@ -657,7 +657,7 @@ mojom::FilePtr file1; error = mojom::FileError::FAILED; bool handled = directory->OpenFile( - "my_file", GetProxy(&file1), + "my_file", MakeRequest(&file1), mojom::kFlagRead | mojom::kFlagWrite | mojom::kFlagCreate, &error); ASSERT_TRUE(handled); EXPECT_EQ(mojom::FileError::OK, error); @@ -678,7 +678,7 @@ mojom::FilePtr file2; error = mojom::FileError::FAILED; bool handled = - directory->OpenFile("my_file", GetProxy(&file2), + directory->OpenFile("my_file", MakeRequest(&file2), mojom::kFlagRead | mojom::kFlagOpen, &error); ASSERT_TRUE(handled); EXPECT_EQ(mojom::FileError::OK, error); @@ -708,7 +708,7 @@ mojom::FilePtr file; error = mojom::FileError::FAILED; bool handled = directory->OpenFile( - "my_file", GetProxy(&file), + "my_file", MakeRequest(&file), mojom::kFlagRead | mojom::kFlagWrite | mojom::kFlagCreate, &error); ASSERT_TRUE(handled); EXPECT_EQ(mojom::FileError::OK, error); @@ -735,7 +735,7 @@ mojom::FilePtr file; error = mojom::FileError::FAILED; bool handled = directory->OpenFile( - "my_file", GetProxy(&file), + "my_file", MakeRequest(&file), mojom::kFlagRead | mojom::kFlagWrite | mojom::kFlagCreate, &error); ASSERT_TRUE(handled); EXPECT_EQ(mojom::FileError::OK, error); @@ -763,7 +763,7 @@ mojom::FilePtr file; error = mojom::FileError::FAILED; bool handled = directory->OpenFile( - "my_file", GetProxy(&file), + "my_file", MakeRequest(&file), mojom::kFlagRead | mojom::kFlagWrite | mojom::kFlagOpenAlways, &error); ASSERT_TRUE(handled); EXPECT_EQ(mojom::FileError::OK, error); @@ -780,7 +780,7 @@ mojom::FilePtr file; error = mojom::FileError::FAILED; bool handled = directory->OpenFile( - "my_file", GetProxy(&file), + "my_file", MakeRequest(&file), mojom::kFlagRead | mojom::kFlagWrite | mojom::kFlagOpenAlways, &error); ASSERT_TRUE(handled); EXPECT_EQ(mojom::FileError::OK, error);
diff --git a/components/filesystem/files_test_base.cc b/components/filesystem/files_test_base.cc index 7be764b..c738890 100644 --- a/components/filesystem/files_test_base.cc +++ b/components/filesystem/files_test_base.cc
@@ -26,7 +26,7 @@ void FilesTestBase::GetTemporaryRoot(mojom::DirectoryPtr* directory) { mojom::FileError error = mojom::FileError::FAILED; - bool handled = files()->OpenTempDirectory(GetProxy(directory), &error); + bool handled = files()->OpenTempDirectory(MakeRequest(directory), &error); ASSERT_TRUE(handled); ASSERT_EQ(mojom::FileError::OK, error); }
diff --git a/components/filesystem/public/cpp/prefs/filesystem_json_pref_store.cc b/components/filesystem/public/cpp/prefs/filesystem_json_pref_store.cc index 7f6a85192..279be382 100644 --- a/components/filesystem/public/cpp/prefs/filesystem_json_pref_store.cc +++ b/components/filesystem/public/cpp/prefs/filesystem_json_pref_store.cc
@@ -334,10 +334,10 @@ void FilesystemJsonPrefStore::OpenFilesystem(base::Closure callback) { filesystem::mojom::FileSystemClientPtr client; - binding_.Bind(GetProxy(&client)); + binding_.Bind(MakeRequest(&client)); filesystem_->OpenFileSystem( - "origin", GetProxy(&directory_), std::move(client), + "origin", MakeRequest(&directory_), std::move(client), base::Bind(&FilesystemJsonPrefStore::OnOpenFilesystem, AsWeakPtr(), callback)); }
diff --git a/components/leveldb/leveldb_mojo_proxy.cc b/components/leveldb/leveldb_mojo_proxy.cc index 2a609b0..1e51f106 100644 --- a/components/leveldb/leveldb_mojo_proxy.cc +++ b/components/leveldb/leveldb_mojo_proxy.cc
@@ -201,7 +201,7 @@ filesystem::mojom::FileError* out_error) { filesystem::mojom::DirectoryPtr target; bool completed = dir->directory->OpenDirectory( - name, GetProxy(&target), + name, MakeRequest(&target), filesystem::mojom::kFlagRead | filesystem::mojom::kFlagWrite, out_error); DCHECK(completed); @@ -226,7 +226,7 @@ std::vector<std::string>* out_contents, filesystem::mojom::FileError* out_error) { filesystem::mojom::DirectoryPtr target; - filesystem::mojom::DirectoryRequest proxy = GetProxy(&target); + filesystem::mojom::DirectoryRequest proxy = MakeRequest(&target); bool completed = dir->directory->OpenDirectory( name, std::move(proxy), filesystem::mojom::kFlagRead | filesystem::mojom::kFlagWrite, out_error); @@ -292,7 +292,7 @@ // Since a lock is associated with a file descriptor, we need to open and // have a persistent file on the other side of the connection. filesystem::mojom::FilePtr target; - filesystem::mojom::FileRequest proxy = GetProxy(&target); + filesystem::mojom::FileRequest proxy = MakeRequest(&target); bool completed = dir->directory->OpenFile(path, std::move(proxy), filesystem::mojom::kFlagOpenAlways | filesystem::mojom::kFlagRead |
diff --git a/components/leveldb/leveldb_service_unittest.cc b/components/leveldb/leveldb_service_unittest.cc index 05e38d92..0e52786 100644 --- a/components/leveldb/leveldb_service_unittest.cc +++ b/components/leveldb/leveldb_service_unittest.cc
@@ -126,7 +126,7 @@ // since |ASSERT_...()| doesn't work with return values. void GetTempDirectory(filesystem::mojom::DirectoryPtr* directory) { FileError error = FileError::FAILED; - bool handled = files()->OpenTempDirectory(GetProxy(directory), &error); + bool handled = files()->OpenTempDirectory(MakeRequest(directory), &error); ASSERT_TRUE(handled); ASSERT_EQ(FileError::OK, error); } @@ -144,7 +144,7 @@ TEST_F(LevelDBServiceTest, Basic) { mojom::DatabaseError error; mojom::LevelDBDatabasePtr database; - LevelDBSyncOpenInMemory(leveldb().get(), GetProxy(&database), &error); + LevelDBSyncOpenInMemory(leveldb().get(), MakeRequest(&database), &error); EXPECT_EQ(mojom::DatabaseError::OK, error); // Write a key to the database. @@ -178,7 +178,7 @@ TEST_F(LevelDBServiceTest, WriteBatch) { mojom::DatabaseError error; mojom::LevelDBDatabasePtr database; - LevelDBSyncOpenInMemory(leveldb().get(), GetProxy(&database), &error); + LevelDBSyncOpenInMemory(leveldb().get(), MakeRequest(&database), &error); EXPECT_EQ(mojom::DatabaseError::OK, error); // Write a key to the database. @@ -257,7 +257,7 @@ { filesystem::mojom::DirectoryPtr directory; - temp_directory->Clone(GetProxy(&directory)); + temp_directory->Clone(MakeRequest(&directory)); mojom::LevelDBDatabasePtr database; leveldb::mojom::OpenOptionsPtr options = leveldb::mojom::OpenOptions::New(); @@ -265,7 +265,7 @@ options->create_if_missing = true; base::RunLoop run_loop; leveldb()->OpenWithOptions(std::move(options), std::move(directory), "test", - GetProxy(&database), + MakeRequest(&database), Capture(&error, run_loop.QuitClosure())); run_loop.Run(); EXPECT_EQ(mojom::DatabaseError::OK, error); @@ -280,12 +280,12 @@ { filesystem::mojom::DirectoryPtr directory; - temp_directory->Clone(GetProxy(&directory)); + temp_directory->Clone(MakeRequest(&directory)); // Reconnect to the database. mojom::LevelDBDatabasePtr database; base::RunLoop run_loop; - leveldb()->Open(std::move(directory), "test", GetProxy(&database), + leveldb()->Open(std::move(directory), "test", MakeRequest(&database), Capture(&error, run_loop.QuitClosure())); run_loop.Run(); EXPECT_EQ(mojom::DatabaseError::OK, error); @@ -302,7 +302,7 @@ TEST_F(LevelDBServiceTest, GetSnapshotSimple) { mojom::DatabaseError error; mojom::LevelDBDatabasePtr database; - LevelDBSyncOpenInMemory(leveldb().get(), GetProxy(&database), &error); + LevelDBSyncOpenInMemory(leveldb().get(), MakeRequest(&database), &error); EXPECT_EQ(mojom::DatabaseError::OK, error); base::UnguessableToken snapshot; @@ -315,7 +315,7 @@ TEST_F(LevelDBServiceTest, GetFromSnapshots) { mojom::DatabaseError error; mojom::LevelDBDatabasePtr database; - LevelDBSyncOpenInMemory(leveldb().get(), GetProxy(&database), &error); + LevelDBSyncOpenInMemory(leveldb().get(), MakeRequest(&database), &error); EXPECT_EQ(mojom::DatabaseError::OK, error); // Write a key to the database. @@ -357,7 +357,7 @@ TEST_F(LevelDBServiceTest, InvalidArgumentOnInvalidSnapshot) { mojom::LevelDBDatabasePtr database; mojom::DatabaseError error = mojom::DatabaseError::INVALID_ARGUMENT; - LevelDBSyncOpenInMemory(leveldb().get(), GetProxy(&database), &error); + LevelDBSyncOpenInMemory(leveldb().get(), MakeRequest(&database), &error); EXPECT_EQ(mojom::DatabaseError::OK, error); base::UnguessableToken invalid_snapshot = base::UnguessableToken::Create(); @@ -375,7 +375,7 @@ TEST_F(LevelDBServiceTest, MemoryDBReadWrite) { mojom::LevelDBDatabasePtr database; mojom::DatabaseError error = mojom::DatabaseError::INVALID_ARGUMENT; - LevelDBSyncOpenInMemory(leveldb().get(), GetProxy(&database), &error); + LevelDBSyncOpenInMemory(leveldb().get(), MakeRequest(&database), &error); EXPECT_EQ(mojom::DatabaseError::OK, error); // Write a key to the database. @@ -410,7 +410,7 @@ // Open an in memory database for speed. mojom::DatabaseError error = mojom::DatabaseError::INVALID_ARGUMENT; mojom::LevelDBDatabasePtr database; - LevelDBSyncOpenInMemory(leveldb().get(), GetProxy(&database), &error); + LevelDBSyncOpenInMemory(leveldb().get(), MakeRequest(&database), &error); EXPECT_EQ(mojom::DatabaseError::OK, error); const std::string prefix("prefix");
diff --git a/components/leveldb/remote_iterator_unittest.cc b/components/leveldb/remote_iterator_unittest.cc index ff57341..1807bf6 100644 --- a/components/leveldb/remote_iterator_unittest.cc +++ b/components/leveldb/remote_iterator_unittest.cc
@@ -52,7 +52,7 @@ mojom::DatabaseError error; base::RunLoop run_loop; - leveldb()->OpenInMemory(GetProxy(&database_), + leveldb()->OpenInMemory(MakeRequest(&database_), Capture(&error, run_loop.QuitClosure())); run_loop.Run(); EXPECT_EQ(mojom::DatabaseError::OK, error);
diff --git a/components/metrics/child_call_stack_profile_collector_unittest.cc b/components/metrics/child_call_stack_profile_collector_unittest.cc index af48975..9a3a67a 100644 --- a/components/metrics/child_call_stack_profile_collector_unittest.cc +++ b/components/metrics/child_call_stack_profile_collector_unittest.cc
@@ -52,7 +52,7 @@ }; ChildCallStackProfileCollectorTest() - : receiver_impl_(new Receiver(GetProxy(&receiver_))) {} + : receiver_impl_(new Receiver(MakeRequest(&receiver_))) {} void CollectEmptyProfiles( const CallStackProfileParams& params,
diff --git a/components/metrics/public/cpp/call_stack_profile_struct_traits_unittest.cc b/components/metrics/public/cpp/call_stack_profile_struct_traits_unittest.cc index 69db852..c7c99c9 100644 --- a/components/metrics/public/cpp/call_stack_profile_struct_traits_unittest.cc +++ b/components/metrics/public/cpp/call_stack_profile_struct_traits_unittest.cc
@@ -89,7 +89,7 @@ class CallStackProfileStructTraitsTest : public testing::Test { public: - CallStackProfileStructTraitsTest() : impl_(GetProxy(&proxy_)) {} + CallStackProfileStructTraitsTest() : impl_(MakeRequest(&proxy_)) {} protected: base::MessageLoop message_loop_;
diff --git a/components/ntp_snippets/BUILD.gn b/components/ntp_snippets/BUILD.gn index b37377d..3742fbe 100644 --- a/components/ntp_snippets/BUILD.gn +++ b/components/ntp_snippets/BUILD.gn
@@ -165,6 +165,8 @@ source_set("test_support") { testonly = true sources = [ + "category_rankers/fake_category_ranker.cc", + "category_rankers/fake_category_ranker.h", "category_rankers/mock_category_ranker.cc", "category_rankers/mock_category_ranker.h", "mock_content_suggestions_provider_observer.cc",
diff --git a/components/ntp_snippets/category_rankers/constant_category_ranker.cc b/components/ntp_snippets/category_rankers/constant_category_ranker.cc index c008b79..9fb648a7 100644 --- a/components/ntp_snippets/category_rankers/constant_category_ranker.cc +++ b/components/ntp_snippets/category_rankers/constant_category_ranker.cc
@@ -10,11 +10,11 @@ ConstantCategoryRanker::ConstantCategoryRanker() { // Add all local categories in a fixed order. + AppendKnownCategory(KnownCategories::PHYSICAL_WEB_PAGES); AppendKnownCategory(KnownCategories::DOWNLOADS); AppendKnownCategory(KnownCategories::RECENT_TABS); AppendKnownCategory(KnownCategories::FOREIGN_TABS); AppendKnownCategory(KnownCategories::BOOKMARKS); - AppendKnownCategory(KnownCategories::PHYSICAL_WEB_PAGES); DCHECK_EQ(static_cast<size_t>(KnownCategories::LOCAL_CATEGORIES_COUNT), ordered_categories_.size());
diff --git a/components/ntp_snippets/category_rankers/fake_category_ranker.cc b/components/ntp_snippets/category_rankers/fake_category_ranker.cc new file mode 100644 index 0000000..c436109 --- /dev/null +++ b/components/ntp_snippets/category_rankers/fake_category_ranker.cc
@@ -0,0 +1,37 @@ +// Copyright 2016 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "components/ntp_snippets/category_rankers/fake_category_ranker.h" + +#include <algorithm> + +#include "base/stl_util.h" + +namespace ntp_snippets { + +FakeCategoryRanker::FakeCategoryRanker() = default; + +FakeCategoryRanker::~FakeCategoryRanker() = default; + +bool FakeCategoryRanker::Compare(Category left, Category right) const { + DCHECK(base::ContainsValue(categories_, left)); + DCHECK(base::ContainsValue(categories_, right)); + + return std::find(categories_.begin(), categories_.end(), left) < + std::find(categories_.begin(), categories_.end(), right); +} + +void FakeCategoryRanker::ClearHistory(base::Time begin, base::Time end) { + // Ignored. +} + +void FakeCategoryRanker::AppendCategoryIfNecessary(Category category) { + // Ignored. +} + +void FakeCategoryRanker::OnSuggestionOpened(Category category) { + // Ignored. +} + +} // namespace ntp_snippets
diff --git a/components/ntp_snippets/category_rankers/fake_category_ranker.h b/components/ntp_snippets/category_rankers/fake_category_ranker.h new file mode 100644 index 0000000..9093f07b --- /dev/null +++ b/components/ntp_snippets/category_rankers/fake_category_ranker.h
@@ -0,0 +1,38 @@ +// Copyright 2016 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef COMPONENTS_NTP_SNIPPETS_CATEGORY_RANKERS_FAKE_CATEGORY_RANKER_H_ +#define COMPONENTS_NTP_SNIPPETS_CATEGORY_RANKERS_FAKE_CATEGORY_RANKER_H_ + +#include <vector> + +#include "base/time/time.h" +#include "components/ntp_snippets/category.h" +#include "components/ntp_snippets/category_rankers/category_ranker.h" +#include "testing/gmock/include/gmock/gmock.h" + +namespace ntp_snippets { + +class FakeCategoryRanker : public CategoryRanker { + public: + FakeCategoryRanker(); + ~FakeCategoryRanker() override; + + void SetOrder(const std::vector<Category>& new_order) { + categories_ = new_order; + } + + // CategoryRanker implementation. + bool Compare(Category left, Category right) const override; + void ClearHistory(base::Time begin, base::Time end) override; + void AppendCategoryIfNecessary(Category category) override; + void OnSuggestionOpened(Category category) override; + + private: + std::vector<Category> categories_; +}; + +} // namespace ntp_snippets + +#endif // COMPONENTS_NTP_SNIPPETS_CATEGORY_RANKERS_FAKE_CATEGORY_RANKER_H_
diff --git a/components/ntp_snippets/content_suggestions_service.cc b/components/ntp_snippets/content_suggestions_service.cc index 62bb459d..fbfa2671 100644 --- a/components/ntp_snippets/content_suggestions_service.cc +++ b/components/ntp_snippets/content_suggestions_service.cc
@@ -66,6 +66,15 @@ registry->RegisterListPref(prefs::kDismissedCategories); } +std::vector<Category> ContentSuggestionsService::GetCategories() const { + std::vector<Category> sorted_categories = categories_; + std::sort(sorted_categories.begin(), sorted_categories.end(), + [this](const Category& left, const Category& right) { + return category_ranker_->Compare(left, right); + }); + return sorted_categories; +} + CategoryStatus ContentSuggestionsService::GetCategoryStatus( Category category) const { if (state_ == State::DISABLED) { @@ -389,7 +398,6 @@ providers_by_category_[category] = provider; categories_.push_back(category); - SortCategories(); if (IsCategoryStatusAvailable(provider->GetCategoryStatus(category))) { suggestions_by_category_.insert( std::make_pair(category, std::vector<ContentSuggestion>())); @@ -448,13 +456,6 @@ } } -void ContentSuggestionsService::SortCategories() { - std::sort(categories_.begin(), categories_.end(), - [this](const Category& left, const Category& right) { - return category_ranker_->Compare(left, right); - }); -} - bool ContentSuggestionsService::IsCategoryDismissed(Category category) const { return base::ContainsKey(dismissed_providers_by_category_, category); }
diff --git a/components/ntp_snippets/content_suggestions_service.h b/components/ntp_snippets/content_suggestions_service.h index 8ad6b60..cccb791 100644 --- a/components/ntp_snippets/content_suggestions_service.h +++ b/components/ntp_snippets/content_suggestions_service.h
@@ -100,9 +100,10 @@ State state() { return state_; } - // Gets all categories for which a provider is registered. The categories - // may or may not be available, see |GetCategoryStatus()|. - const std::vector<Category>& GetCategories() const { return categories_; } + // Gets all categories for which a provider is registered. The categories may + // or may not be available, see |GetCategoryStatus()|. The order in which the + // categories are returned is the order in which they should be displayed. + std::vector<Category> GetCategories() const; // Gets the status of a category. CategoryStatus GetCategoryStatus(Category category) const; @@ -256,8 +257,6 @@ void OnSignInStateChanged(); - void SortCategories(); - // Re-enables a dismissed category, making querying its provider possible. void RestoreDismissedCategory(Category category); @@ -284,9 +283,8 @@ std::map<Category, ContentSuggestionsProvider*, Category::CompareByID> dismissed_providers_by_category_; - // All current suggestion categories, in an order determined by the - // |category_factory_|. This vector contains exactly the same categories as - // |providers_by_category_|. + // All current suggestion categories in arbitrary order. This vector contains + // exactly the same categories as |providers_by_category_|. std::vector<Category> categories_; // All current suggestions grouped by category. This contains an entry for
diff --git a/components/ntp_snippets/content_suggestions_service_unittest.cc b/components/ntp_snippets/content_suggestions_service_unittest.cc index 95678e1..2b0ea890 100644 --- a/components/ntp_snippets/content_suggestions_service_unittest.cc +++ b/components/ntp_snippets/content_suggestions_service_unittest.cc
@@ -17,6 +17,7 @@ #include "base/strings/utf_string_conversions.h" #include "components/ntp_snippets/category_info.h" #include "components/ntp_snippets/category_rankers/constant_category_ranker.h" +#include "components/ntp_snippets/category_rankers/fake_category_ranker.h" #include "components/ntp_snippets/category_status.h" #include "components/ntp_snippets/content_suggestion.h" #include "components/ntp_snippets/content_suggestions_provider.h" @@ -26,18 +27,21 @@ #include "testing/gtest/include/gtest/gtest.h" #include "ui/gfx/image/image.h" +using testing::_; using testing::ElementsAre; using testing::Eq; using testing::InvokeWithoutArgs; using testing::IsEmpty; using testing::Mock; using testing::Property; -using testing::_; +using testing::Return; +using testing::UnorderedElementsAre; namespace ntp_snippets { namespace { +// TODO(treib): This is a weird combination of a mock and a fake. Fix this. class MockProvider : public ContentSuggestionsProvider { public: MockProvider(Observer* observer, @@ -131,7 +135,8 @@ class ContentSuggestionsServiceTest : public testing::Test { public: ContentSuggestionsServiceTest() - : pref_service_(new TestingPrefServiceSimple()) {} + : pref_service_(base::MakeUnique<TestingPrefServiceSimple>()), + category_ranker_(base::MakeUnique<ConstantCategoryRanker>()) {} void SetUp() override { RegisterPrefs(); @@ -193,6 +198,10 @@ return result; } + void SetCategoryRanker(std::unique_ptr<CategoryRanker> category_ranker) { + category_ranker_ = std::move(category_ranker); + } + MOCK_METHOD1(OnImageFetched, void(const gfx::Image&)); protected: @@ -204,10 +213,9 @@ void CreateContentSuggestionsService( ContentSuggestionsService::State enabled) { ASSERT_FALSE(service_); - service_.reset(new ContentSuggestionsService( + service_ = base::MakeUnique<ContentSuggestionsService>( enabled, /*signin_manager=*/nullptr, /*history_service=*/nullptr, - pref_service_.get(), - base::MakeUnique<ntp_snippets::ConstantCategoryRanker>())); + pref_service_.get(), std::move(category_ranker_)); } void ResetService() { @@ -238,6 +246,7 @@ private: std::unique_ptr<ContentSuggestionsService> service_; std::unique_ptr<TestingPrefServiceSimple> pref_service_; + std::unique_ptr<CategoryRanker> category_ranker_; DISALLOW_COPY_AND_ASSIGN(ContentSuggestionsServiceTest); }; @@ -271,7 +280,8 @@ ASSERT_THAT(providers().count(articles_category), Eq(1ul)); EXPECT_THAT(providers().at(articles_category), Eq(provider1)); EXPECT_THAT(providers().size(), Eq(1ul)); - EXPECT_THAT(service()->GetCategories(), ElementsAre(articles_category)); + EXPECT_THAT(service()->GetCategories(), + UnorderedElementsAre(articles_category)); EXPECT_THAT(service()->GetCategoryStatus(articles_category), Eq(CategoryStatus::AVAILABLE)); EXPECT_THAT(service()->GetCategoryStatus(offline_pages_category), @@ -285,7 +295,7 @@ EXPECT_THAT(providers().at(offline_pages_category), Eq(provider2)); EXPECT_THAT(providers().size(), Eq(2ul)); EXPECT_THAT(service()->GetCategories(), - ElementsAre(offline_pages_category, articles_category)); + UnorderedElementsAre(offline_pages_category, articles_category)); EXPECT_THAT(service()->GetCategoryStatus(articles_category), Eq(CategoryStatus::AVAILABLE)); EXPECT_THAT(service()->GetCategoryStatus(offline_pages_category), @@ -545,7 +555,7 @@ EXPECT_THAT(service()->GetCategoryStatus(new_category), Eq(CategoryStatus::INITIALIZING)); EXPECT_THAT(service()->GetCategories(), - Eq(std::vector<Category>({category, new_category}))); + UnorderedElementsAre(category, new_category)); service()->RemoveObserver(&observer); } @@ -598,7 +608,7 @@ provider->FireCategoryStatusChangedWithCurrentStatus(category); provider->FireSuggestionsChanged(category, CreateSuggestions(category, {42})); - EXPECT_THAT(service()->GetCategories(), ElementsAre(category)); + EXPECT_THAT(service()->GetCategories(), UnorderedElementsAre(category)); EXPECT_THAT(service()->GetCategoryStatus(category), Eq(CategoryStatus::AVAILABLE)); ExpectThatSuggestionsAre(category, {42}); @@ -619,7 +629,7 @@ // empty. service()->RestoreDismissedCategories(); - EXPECT_THAT(service()->GetCategories(), ElementsAre(category)); + EXPECT_THAT(service()->GetCategories(), UnorderedElementsAre(category)); EXPECT_THAT(service()->GetCategoryStatus(category), Eq(CategoryStatus::AVAILABLE)); EXPECT_THAT(service()->GetSuggestionsForCategory(category), IsEmpty()); @@ -705,4 +715,32 @@ EXPECT_THAT(providers().find(category)->second, Eq(provider)); } +TEST_F(ContentSuggestionsServiceTest, ShouldReturnCategoriesInOrderToDisplay) { + const Category first_category = Category::FromRemoteCategory(1); + const Category second_category = Category::FromRemoteCategory(2); + + auto fake_ranker = base::MakeUnique<FakeCategoryRanker>(); + FakeCategoryRanker* raw_fake_ranker = fake_ranker.get(); + SetCategoryRanker(std::move(fake_ranker)); + + raw_fake_ranker->SetOrder({first_category, second_category}); + + // The service is recreated to pick up the new ranker. + ResetService(); + + MockProvider* provider = RegisterProvider({first_category, second_category}); + provider->FireCategoryStatusChangedWithCurrentStatus(first_category); + provider->FireCategoryStatusChangedWithCurrentStatus(second_category); + + EXPECT_THAT(service()->GetCategories(), + ElementsAre(first_category, second_category)); + + // The order to display (in the ranker) changes. + raw_fake_ranker->SetOrder({second_category, first_category}); + + // Categories order should reflect the new order. + EXPECT_THAT(service()->GetCategories(), + ElementsAre(second_category, first_category)); +} + } // namespace ntp_snippets
diff --git a/components/ntp_snippets/physical_web_pages/physical_web_page_suggestions_provider.cc b/components/ntp_snippets/physical_web_pages/physical_web_page_suggestions_provider.cc index b7eae7f..15f1d02 100644 --- a/components/ntp_snippets/physical_web_pages/physical_web_page_suggestions_provider.cc +++ b/components/ntp_snippets/physical_web_pages/physical_web_page_suggestions_provider.cc
@@ -77,7 +77,7 @@ return CategoryInfo( base::ASCIIToUTF16("Physical web pages"), ContentSuggestionsCardLayout::FULL_CARD, - /*has_more_action=*/true, + /*has_more_action=*/false, /*has_reload_action=*/false, /*has_view_all_action=*/false, /*show_if_empty=*/false,
diff --git a/components/password_manager/content/browser/content_password_manager_driver.cc b/components/password_manager/content/browser/content_password_manager_driver.cc index 03c34251..61e35ebf 100644 --- a/components/password_manager/content/browser/content_password_manager_driver.cc +++ b/components/password_manager/content/browser/content_password_manager_driver.cc
@@ -309,7 +309,7 @@ ContentPasswordManagerDriver::GetPasswordAutofillAgent() { if (!password_autofill_agent_) { autofill::mojom::PasswordAutofillAgentRequest request = - mojo::GetProxy(&password_autofill_agent_); + mojo::MakeRequest(&password_autofill_agent_); // Some test codes may have no initialized remote interfaces. if (render_frame_host_->GetRemoteInterfaces()) { render_frame_host_->GetRemoteInterfaces()->GetInterface( @@ -324,7 +324,7 @@ ContentPasswordManagerDriver::GetPasswordGenerationAgent() { if (!password_gen_agent_) { render_frame_host_->GetRemoteInterfaces()->GetInterface( - mojo::GetProxy(&password_gen_agent_)); + mojo::MakeRequest(&password_gen_agent_)); } return password_gen_agent_;
diff --git a/components/password_manager/core/browser/password_form_manager.cc b/components/password_manager/core/browser/password_form_manager.cc index e916b8c..4c82699a 100644 --- a/components/password_manager/core/browser/password_form_manager.cc +++ b/components/password_manager/core/browser/password_form_manager.cc
@@ -354,8 +354,8 @@ const autofill::PasswordForm& credentials_to_update) { if (observed_form_.IsPossibleChangePasswordForm()) { FormStructure form_structure(credentials_to_update.form_data); - UploadChangePasswordForm(autofill::NEW_PASSWORD, - form_structure.FormSignatureAsStr()); + UploadPasswordVote(base::string16(), autofill::NEW_PASSWORD, + form_structure.FormSignatureAsStr()); } base::string16 password_to_save = pending_credentials_.password_value; bool skip_zero_click = pending_credentials_.skip_zero_click; @@ -607,17 +607,17 @@ void PasswordFormManager::SendAutofillVotes(const PasswordForm& observed, PasswordForm* pending) { + // Ignore |pending_structure| if its FormData has no fields. This is to + // weed out those credentials that were saved before FormData was added + // to PasswordForm. Even without this check, these FormStructure's won't + // be uploaded, but it makes it hard to see if we are encountering + // unexpected errors. if (pending->form_data.fields.empty()) return; FormStructure pending_structure(pending->form_data); FormStructure observed_structure(observed.form_data); - // Ignore |pending_structure| if its FormData has no fields. This is to - // weed out those credentials that were saved before FormData was added - // to PasswordForm. Even without this check, these FormStructure's won't - // be uploaded, but it makes it hard to see if we are encountering - // unexpected errors. if (pending_structure.FormSignatureAsStr() != observed_structure.FormSignatureAsStr()) { // Only upload if this is the first time the password has been used. @@ -627,7 +627,7 @@ // in cases where we currently save the wrong username isn't great. // TODO(gcasto): Determine if generation should be offered in this case. if (pending->times_used == 1 && selected_username_.empty()) { - if (UploadPasswordForm(pending->form_data, pending->username_element, + if (UploadPasswordVote(pending->username_element, autofill::ACCOUNT_CREATION_PASSWORD, observed_structure.FormSignatureAsStr())) { pending->generation_upload_status = @@ -639,63 +639,62 @@ // A signal was sent that this was an account creation form, but the // credential is now being used on the same form again. This cancels out // the previous vote. - if (UploadPasswordForm(pending->form_data, base::string16(), + if (UploadPasswordVote(base::string16(), autofill::NOT_ACCOUNT_CREATION_PASSWORD, std::string())) { pending->generation_upload_status = autofill::PasswordForm::NEGATIVE_SIGNAL_SENT; } + } else if (generation_popup_was_shown_) { + // Even if there is no autofill vote to be sent, send the vote about the + // usage of the generation popup. + UploadPasswordVote(base::string16(), autofill::UNKNOWN_TYPE, std::string()); } } -bool PasswordFormManager::UploadPasswordForm( - const autofill::FormData& form_data, +bool PasswordFormManager::UploadPasswordVote( const base::string16& username_field, const autofill::ServerFieldType& password_type, const std::string& login_form_signature) { - DCHECK(password_type == autofill::PASSWORD || - password_type == autofill::PROBABLY_ACCOUNT_CREATION_PASSWORD || - password_type == autofill::ACCOUNT_CREATION_PASSWORD || - password_type == autofill::NOT_ACCOUNT_CREATION_PASSWORD); + // Check if there is any vote to be sent. + bool has_autofill_vote = password_type != autofill::UNKNOWN_TYPE; + bool has_password_generation_vote = generation_popup_was_shown_; + if (!has_autofill_vote && !has_password_generation_vote) + return false; + autofill::AutofillManager* autofill_manager = client_->GetAutofillManagerForMainFrame(); if (!autofill_manager || !autofill_manager->download_manager()) return false; - FormStructure form_structure(form_data); + bool is_update = password_type == autofill::NEW_PASSWORD || + password_type == autofill::PROBABLY_NEW_PASSWORD || + password_type == autofill::NOT_NEW_PASSWORD; + // If this is an update, a vote about the observed form is sent. If the user + // re-uses credentials, a vote about the saved form is sent. If the user saves + // credentials, the observed and pending forms are the same. + FormStructure form_structure(is_update ? observed_form_.form_data + : pending_credentials_.form_data); if (!autofill_manager->ShouldUploadForm(form_structure) || !form_structure.ShouldBeCrowdsourced()) { UMA_HISTOGRAM_BOOLEAN("PasswordGeneration.UploadStarted", false); return false; } - // Find the first password field to label. If the provided username field name - // is not empty, then also find the first field with that name to label. - // We don't try to label anything else. - bool found_password_field = false; - bool should_find_username_field = !username_field.empty(); - for (size_t i = 0; i < form_structure.field_count(); ++i) { - autofill::AutofillField* field = form_structure.field(i); - - autofill::ServerFieldType type = autofill::UNKNOWN_TYPE; - if (!found_password_field && field->form_control_type == "password") { - type = password_type; - found_password_field = true; - } else if (should_find_username_field && field->name == username_field) { - type = autofill::USERNAME; - should_find_username_field = false; - } - - autofill::ServerFieldTypeSet types; - types.insert(type); - field->set_possible_types(types); - } - DCHECK(found_password_field); - DCHECK(!should_find_username_field); - autofill::ServerFieldTypeSet available_field_types; - available_field_types.insert(password_type); - available_field_types.insert(autofill::USERNAME); + if (has_autofill_vote) { + if (is_update) { + if (!provisionally_saved_form_ || + provisionally_saved_form_->new_password_element.empty()) + return false; + SetAutofillTypesOnUpdate(password_type, &form_structure, + &available_field_types); + + } else { + SetAutofillTypesOnSave(username_field, password_type, &form_structure, + &available_field_types); + } + } if (generation_popup_was_shown_) AddGeneratedVote(&form_structure); @@ -719,32 +718,28 @@ return success; } -bool PasswordFormManager::UploadChangePasswordForm( - const autofill::ServerFieldType& password_type, - const std::string& login_form_signature) { +void PasswordFormManager::SetAutofillTypesOnUpdate( + const autofill::ServerFieldType password_type, + FormStructure* form_structure, + autofill::ServerFieldTypeSet* available_field_types) { DCHECK(password_type == autofill::NEW_PASSWORD || password_type == autofill::PROBABLY_NEW_PASSWORD || - password_type == autofill::NOT_NEW_PASSWORD); - if (!provisionally_saved_form_ || - provisionally_saved_form_->new_password_element.empty()) { - // |new_password_element| is empty for non change password forms, for - // example when the password was overriden. - return false; - } - autofill::AutofillManager* autofill_manager = - client_->GetAutofillManagerForMainFrame(); - if (!autofill_manager || !autofill_manager->download_manager()) - return false; + password_type == autofill::NOT_NEW_PASSWORD) + << password_type; + DCHECK(!provisionally_saved_form_->new_password_element.empty()); // Create a map from field names to field types. std::map<base::string16, autofill::ServerFieldType> field_types; - if (!pending_credentials_.username_element.empty()) + if (!provisionally_saved_form_->username_element.empty()) { field_types[provisionally_saved_form_->username_element] = autofill::USERNAME; - if (!pending_credentials_.password_element.empty()) + } + if (!provisionally_saved_form_->password_element.empty()) { field_types[provisionally_saved_form_->password_element] = autofill::PASSWORD; + } field_types[provisionally_saved_form_->new_password_element] = password_type; + // Find all password fields after |new_password_element| and set their type to // |password_type|. They are considered to be confirmation fields. const autofill::FormData& form_data = observed_form_.form_data; @@ -763,45 +758,58 @@ } DCHECK(is_new_password_field_found); - // Create FormStructure with field type information for uploading a vote. - FormStructure form_structure(form_data); - if (!autofill_manager->ShouldUploadForm(form_structure) || - !form_structure.ShouldBeCrowdsourced()) - return false; - - autofill::ServerFieldTypeSet available_field_types; - for (size_t i = 0; i < form_structure.field_count(); ++i) { - autofill::AutofillField* field = form_structure.field(i); + for (size_t i = 0; i < form_structure->field_count(); ++i) { + autofill::AutofillField* field = form_structure->field(i); autofill::ServerFieldType type = autofill::UNKNOWN_TYPE; auto iter = field_types.find(field->name); if (iter != field_types.end()) { type = iter->second; - available_field_types.insert(type); + available_field_types->insert(type); } autofill::ServerFieldTypeSet types; types.insert(type); field->set_possible_types(types); } +} - if (generation_popup_was_shown_) - AddGeneratedVote(&form_structure); - if (form_classifier_outcome_ != kNoOutcome) - AddFormClassifierVote(&form_structure); +void PasswordFormManager::SetAutofillTypesOnSave( + const base::string16& username_field, + const autofill::ServerFieldType password_type, + FormStructure* form_structure, + autofill::ServerFieldTypeSet* available_field_types) { + DCHECK(password_type == autofill::PASSWORD || + password_type == autofill::PROBABLY_ACCOUNT_CREATION_PASSWORD || + password_type == autofill::ACCOUNT_CREATION_PASSWORD || + password_type == autofill::NOT_ACCOUNT_CREATION_PASSWORD) + << password_type; - // Force uploading as these events are relatively rare and we want to make - // sure to receive them. It also makes testing easier if these requests - // always pass. - form_structure.set_upload_required(UPLOAD_REQUIRED); + // Find the first password field to label. If the provided username field + // name is not empty, then also find the first field with that name to label. + // We don't try to label anything else. + bool found_password_field = false; + bool should_find_username_field = !username_field.empty(); + for (size_t i = 0; i < form_structure->field_count(); ++i) { + autofill::AutofillField* field = form_structure->field(i); - if (password_manager_util::IsLoggingActive(client_)) { - BrowserSavePasswordProgressLogger logger(client_->GetLogManager()); - logger.LogFormStructure(Logger::STRING_FORM_VOTES, form_structure); + autofill::ServerFieldType type = autofill::UNKNOWN_TYPE; + if (!found_password_field && field->form_control_type == "password") { + type = password_type; + found_password_field = true; + } else if (should_find_username_field && field->name == username_field) { + type = autofill::USERNAME; + should_find_username_field = false; + } + + autofill::ServerFieldTypeSet types; + types.insert(type); + field->set_possible_types(types); } + DCHECK(found_password_field); + DCHECK(!should_find_username_field); - return autofill_manager->download_manager()->StartUploadRequest( - form_structure, false /* was_autofilled */, available_field_types, - login_form_signature, true /* observed_submission */); + available_field_types->insert(password_type); + available_field_types->insert(autofill::USERNAME); } void PasswordFormManager::AddGeneratedVote( @@ -1174,11 +1182,24 @@ } void PasswordFormManager::OnNopeUpdateClicked() { - UploadChangePasswordForm(autofill::NOT_NEW_PASSWORD, std::string()); + UploadPasswordVote(base::string16(), autofill::NOT_NEW_PASSWORD, + std::string()); } -void PasswordFormManager::OnNoInteractionOnUpdate() { - UploadChangePasswordForm(autofill::PROBABLY_NEW_PASSWORD, std::string()); +void PasswordFormManager::OnNeverClicked() { + UploadPasswordVote(pending_credentials_.username_element, + autofill::UNKNOWN_TYPE, std::string()); + PermanentlyBlacklist(); +} + +void PasswordFormManager::OnNoInteraction(bool is_update) { + if (is_update) + UploadPasswordVote(base::string16(), autofill::PROBABLY_NEW_PASSWORD, + std::string()); + else { + UploadPasswordVote(pending_credentials_.username_element, + autofill::UNKNOWN_TYPE, std::string()); + } } void PasswordFormManager::LogSubmitPassed() { @@ -1224,25 +1245,23 @@ } void PasswordFormManager::SendVotesOnSave() { + if (observed_form_.IsPossibleChangePasswordFormWithoutUsername()) + return; + // Upload credentials the first time they are saved. This data is used // by password generation to help determine account creation sites. // Credentials that have been previously used (e.g., PSL matches) are checked // to see if they are valid account creation forms. if (pending_credentials_.times_used == 0) { - if (!observed_form_.IsPossibleChangePasswordFormWithoutUsername()) { base::string16 username_field; autofill::ServerFieldType password_type = autofill::PASSWORD; if (does_look_like_signup_form_) { username_field = pending_credentials_.username_element; password_type = autofill::PROBABLY_ACCOUNT_CREATION_PASSWORD; } - UploadPasswordForm(pending_credentials_.form_data, username_field, - password_type, std::string()); - } - } else { - if (!observed_form_.IsPossibleChangePasswordFormWithoutUsername()) - SendAutofillVotes(observed_form_, &pending_credentials_); - } + UploadPasswordVote(username_field, password_type, std::string()); + } else + SendAutofillVotes(observed_form_, &pending_credentials_); } void PasswordFormManager::SetUserAction(UserAction user_action) {
diff --git a/components/password_manager/core/browser/password_form_manager.h b/components/password_manager/core/browser/password_form_manager.h index 153f7918..b300233 100644 --- a/components/password_manager/core/browser/password_form_manager.h +++ b/components/password_manager/core/browser/password_form_manager.h
@@ -25,6 +25,8 @@ #include "components/password_manager/core/browser/password_manager_driver.h" #include "components/password_manager/core/browser/password_store.h" +using autofill::FormStructure; + namespace password_manager { class FormSaver; @@ -215,8 +217,12 @@ // Called when the user chose not to update password. void OnNopeUpdateClicked(); - // Called when the user didn't interact with Update UI. - void OnNoInteractionOnUpdate(); + // Called when the user clicked "Never" button in the "save password" prompt. + void OnNeverClicked(); + + // Called when the user didn't interact with UI. |is_update| is true iff + // it was the update UI. + void OnNoInteraction(bool is_update); // Saves the outcome of HTML parsing based form classifier to upload proto. void SaveGenerationFieldDetectedByClassifier( @@ -356,36 +362,12 @@ // UMA. int GetActionsTaken() const; - // Try to label password fields and upload |form_data|. This differs from - // AutofillManager::OnFormSubmitted() in a few ways. - // - This function will only label the first <input type="password"> field - // as |password_type|. Other fields will stay unlabeled, as they - // should have been labeled during the upload for OnFormSubmitted(). - // - If the |username_field| attribute is nonempty, we will additionally - // label the field with that name as the username field. - // - This function does not assume that |form| is being uploaded during - // the same browsing session as it was originally submitted (as we may - // not have the necessary information to classify the form at that time) - // so it bypasses the cache and doesn't log the same quality UMA metrics. - // |login_form_signature| may be empty. It is non-empty when the user fills - // and submits a login form using a generated password. In this case, - // |login_form_signature| should be set to the submitted form's signature. - // Note that in this case, |form.FormSignature()| gives the signature for the - // registration form on which the password was generated, rather than the - // submitted form's signature. - bool UploadPasswordForm(const autofill::FormData& form_data, - const base::string16& username_field, + // Tries to set all votes (e.g. autofill field types, generation vote) to + // a |FormStructure| and upload it to the server. Returns true on success. + bool UploadPasswordVote(const base::string16& username_field, const autofill::ServerFieldType& password_type, const std::string& login_form_signature); - // Try to label username, password and new password fields of |observed_form_| - // which is considered to be change password forms. Returns true on success. - // |password_type| should be equal to NEW_PASSWORD, PROBABLY_NEW_PASSWORD or - // NOT_NEW_PASSWORD. These values correspond to cases when the user conrirmed - // password update, did nothing or declined to update password respectively. - bool UploadChangePasswordForm(const autofill::ServerFieldType& password_type, - const std::string& login_form_signature); - // Adds a vote on password generation usage to |form_structure|. void AddGeneratedVote(autofill::FormStructure* form_structure); @@ -435,6 +417,26 @@ base::Optional<autofill::PasswordForm> UpdatePendingAndGetOldKey( std::vector<autofill::PasswordForm>* credentials_to_update); + // Sets autofill types of username, password and new password fields in + // |form_structure|. |password_type| (the autofill type of new password field) + // should be equal to NEW_PASSWORD, PROBABLY_NEW_PASSWORD or NOT_NEW_PASSWORD. + // These values correspond to cases when the user confirmed password update, + // did nothing or declined to update password respectively. The function also + // add the types to |available_field_types|. + void SetAutofillTypesOnUpdate( + const autofill::ServerFieldType password_type, + FormStructure* form_structure, + autofill::ServerFieldTypeSet* available_field_types); + + // Sets autofill types of username and password fields in |form_structure|. + // |username_field| determines the name of the username field. The function + // also add the types to |available_field_types|. + void SetAutofillTypesOnSave( + const base::string16& username_field, + const autofill::ServerFieldType password_type, + FormStructure* form_structure, + autofill::ServerFieldTypeSet* available_field_types); + // Set of nonblacklisted PasswordForms from the DB that best match the form // being managed by |this|, indexed by username. They are owned by // |form_fetcher_|.
diff --git a/components/password_manager/core/browser/password_form_manager_unittest.cc b/components/password_manager/core/browser/password_form_manager_unittest.cc index 0957eab..b86d9f0 100644 --- a/components/password_manager/core/browser/password_form_manager_unittest.cc +++ b/components/password_manager/core/browser/password_form_manager_unittest.cc
@@ -62,6 +62,9 @@ namespace { +// Enum that describes what button the user pressed on the save prompt. +enum SavePromptInteraction { SAVE, NEVER, NO_INTERACTION }; + class MockFormSaver : public StubFormSaver { public: MockFormSaver() = default; @@ -514,7 +517,7 @@ form_manager.Update(*saved_match()); break; case autofill::PROBABLY_NEW_PASSWORD: - form_manager.OnNoInteractionOnUpdate(); + form_manager.OnNoInteraction(true /* it is an update */); break; case autofill::NOT_NEW_PASSWORD: form_manager.OnNopeUpdateClicked(); @@ -552,13 +555,17 @@ // The user types username and generates password on SignUp or change password // form. The password generation might be triggered automatically or manually. - // This function checks that correct vote is uploaded on server. + // This function checks that correct vote is uploaded on server. The vote must + // be uploaded regardless of the user's interaction with the prompt. void GeneratedVoteUploadTest(bool is_manual_generation, bool is_change_password_form, - bool has_generated_password) { + bool has_generated_password, + SavePromptInteraction interaction) { SCOPED_TRACE(testing::Message() << "is_manual_generation=" << is_manual_generation - << " is_change_password_form=" << is_change_password_form); + << " is_change_password_form=" << is_change_password_form + << " has_generated_password=" << has_generated_password + << " interaction=" << interaction); PasswordForm form(*observed_form()); form.form_data = saved_match()->form_data; @@ -593,8 +600,11 @@ fetcher.SetNonFederated(std::vector<const PasswordForm*>(), 0u); autofill::ServerFieldTypeSet expected_available_field_types; - expected_available_field_types.insert(autofill::USERNAME); - expected_available_field_types.insert(autofill::PASSWORD); + // Don't send autofill votes if the user didn't press "Save" button. + if (interaction == SAVE) { + expected_available_field_types.insert(autofill::USERNAME); + expected_available_field_types.insert(autofill::PASSWORD); + } form_manager.set_is_manual_generation(is_manual_generation); base::string16 generation_element = is_change_password_form @@ -625,7 +635,17 @@ form_manager.ProvisionallySave( submitted_form, PasswordFormManager::IGNORE_OTHER_POSSIBLE_USERNAMES); - form_manager.Save(); + switch (interaction) { + case SAVE: + form_manager.Save(); + break; + case NEVER: + form_manager.OnNeverClicked(); + break; + case NO_INTERACTION: + form_manager.OnNoInteraction(false /* not an update prompt*/); + break; + } } PasswordForm* observed_form() { return &observed_form_; } @@ -2546,17 +2566,21 @@ form_manager.Update(*saved_match()); } +// Checks uploading a vote about the usage of the password generation popup. TEST_F(PasswordFormManagerTest, GeneratedVoteUpload) { - // Automatic generation, sign-up form. - GeneratedVoteUploadTest(false, false, true); - // Automatic generation, change password form. - GeneratedVoteUploadTest(false, true, true); - // Manual generation, sign-up form. - GeneratedVoteUploadTest(true, false, true); - // Manual generation, change password form. - GeneratedVoteUploadTest(true, true, true); - // Generation popup was shown, but the user entered its own password. - GeneratedVoteUploadTest(true, true, false); + bool kFalseTrue[] = {false, true}; + SavePromptInteraction kSavePromptInterations[] = {SAVE, NEVER, + NO_INTERACTION}; + for (bool is_manual_generation : kFalseTrue) { + for (bool is_change_password_form : kFalseTrue) { + for (bool has_generated_password : kFalseTrue) { + for (SavePromptInteraction interaction : kSavePromptInterations) { + GeneratedVoteUploadTest(is_manual_generation, is_change_password_form, + has_generated_password, interaction); + } + } + } + } } TEST_F(PasswordFormManagerTest, FormClassifierVoteUpload) {
diff --git a/components/test_runner/app_banner_service.cc b/components/test_runner/app_banner_service.cc index 37ce9d1..66844378 100644 --- a/components/test_runner/app_banner_service.cc +++ b/components/test_runner/app_banner_service.cc
@@ -28,9 +28,9 @@ return; controller_->BannerPromptRequest( - binding_.CreateInterfacePtrAndBind(), mojo::GetProxy(&event_), platforms, - base::Bind(&AppBannerService::OnBannerPromptReply, base::Unretained(this), - callback)); + binding_.CreateInterfacePtrAndBind(), mojo::MakeRequest(&event_), + platforms, base::Bind(&AppBannerService::OnBannerPromptReply, + base::Unretained(this), callback)); } void AppBannerService::DisplayAppBanner() { /* do nothing */ }
diff --git a/components/translate/content/renderer/translate_helper.cc b/components/translate/content/renderer/translate_helper.cc index 23c25194..51d5cac 100644 --- a/components/translate/content/renderer/translate_helper.cc +++ b/components/translate/content/renderer/translate_helper.cc
@@ -464,7 +464,7 @@ const mojom::ContentTranslateDriverPtr& TranslateHelper::GetTranslateDriver() { if (!translate_driver_) { render_frame()->GetRemoteInterfaces()->GetInterface( - mojo::GetProxy(&translate_driver_)); + mojo::MakeRequest(&translate_driver_)); } return translate_driver_;
diff --git a/content/browser/android/java_interfaces_impl.cc b/content/browser/android/java_interfaces_impl.cc index 2cc2b5701..4169654 100644 --- a/content/browser/android/java_interfaces_impl.cc +++ b/content/browser/android/java_interfaces_impl.cc
@@ -27,7 +27,7 @@ service_manager::mojom::InterfaceProviderPtr provider; JNIEnv* env = base::android::AttachCurrentThread(); Java_InterfaceRegistrarImpl_createInterfaceRegistryForContext( - env, mojo::GetProxy(&provider).PassMessagePipe().release().value(), + env, mojo::MakeRequest(&provider).PassMessagePipe().release().value(), base::android::GetApplicationContext()); interface_provider_.Bind(std::move(provider)); }
diff --git a/content/browser/background_sync/background_sync_service_impl_unittest.cc b/content/browser/background_sync/background_sync_service_impl_unittest.cc index 158c518..197cf17 100644 --- a/content/browser/background_sync/background_sync_service_impl_unittest.cc +++ b/content/browser/background_sync/background_sync_service_impl_unittest.cc
@@ -179,7 +179,7 @@ // Create a dummy mojo channel so that the BackgroundSyncServiceImpl can be // instantiated. mojo::InterfaceRequest<blink::mojom::BackgroundSyncService> - service_request = mojo::GetProxy(&service_ptr_); + service_request = mojo::MakeRequest(&service_ptr_); // Create a new BackgroundSyncServiceImpl bound to the dummy channel. background_sync_context_->CreateService(std::move(service_request)); base::RunLoop().RunUntilIdle();
diff --git a/content/browser/browser_context.cc b/content/browser/browser_context.cc index 063b0ef..540fbc99 100644 --- a/content/browser/browser_context.cc +++ b/content/browser/browser_context.cc
@@ -439,13 +439,13 @@ service_manager::mojom::ServicePtr service; service_manager::mojom::ServiceRequest service_request = - mojo::GetProxy(&service); + mojo::MakeRequest(&service); service_manager::mojom::PIDReceiverPtr pid_receiver; service_manager::Connector::ConnectParams params( service_manager::Identity(mojom::kBrowserServiceName, new_id)); params.set_client_process_connection(std::move(service), - mojo::GetProxy(&pid_receiver)); + mojo::MakeRequest(&pid_receiver)); pid_receiver->SetPID(base::GetCurrentProcId()); BrowserContextServiceManagerConnectionHolder* connection_holder =
diff --git a/content/browser/dom_storage/dom_storage_context_wrapper.cc b/content/browser/dom_storage/dom_storage_context_wrapper.cc index b8578f7..723a108 100644 --- a/content/browser/dom_storage/dom_storage_context_wrapper.cc +++ b/content/browser/dom_storage/dom_storage_context_wrapper.cc
@@ -171,16 +171,15 @@ // database. file_service_connection_->GetInterface(&file_system_); file_system_->GetSubDirectory(subdirectory_.AsUTF8Unsafe(), - GetProxy(&directory_), + MakeRequest(&directory_), base::Bind(&MojoState::OnDirectoryOpened, weak_ptr_factory_.GetWeakPtr())); } else { // We were not given a subdirectory. Use a memory backed database. file_service_connection_->GetInterface(&leveldb_service_); leveldb_service_->OpenInMemory( - GetProxy(&database_), - base::Bind(&MojoState::OnDatabaseOpened, - weak_ptr_factory_.GetWeakPtr())); + MakeRequest(&database_), base::Bind(&MojoState::OnDatabaseOpened, + weak_ptr_factory_.GetWeakPtr())); } } @@ -209,7 +208,7 @@ file_service_connection_->GetInterface(&leveldb_service_); leveldb_service_->Open( - std::move(directory_), "leveldb", GetProxy(&database_), + std::move(directory_), "leveldb", MakeRequest(&database_), base::Bind(&MojoState::OnDatabaseOpened, weak_ptr_factory_.GetWeakPtr())); }
diff --git a/content/browser/frame_host/render_frame_host_impl.cc b/content/browser/frame_host/render_frame_host_impl.cc index 0386b71d..daff90df 100644 --- a/content/browser/frame_host/render_frame_host_impl.cc +++ b/content/browser/frame_host/render_frame_host_impl.cc
@@ -591,7 +591,7 @@ static_cast<RenderProcessHostImpl*>(GetProcess()); process->GetRemoteRouteProvider()->GetRoute( GetRoutingID(), - mojo::GetProxy(&remote_interfaces, channel->GetAssociatedGroup())); + mojo::MakeRequest(&remote_interfaces, channel->GetAssociatedGroup())); } else { // The channel may not be initialized in some tests environments. In this // case we set up a dummy interface provider. @@ -2641,12 +2641,12 @@ RegisterMojoInterfaces(); mojom::FrameFactoryPtr frame_factory; GetProcess()->GetRemoteInterfaces()->GetInterface(&frame_factory); - frame_factory->CreateFrame(routing_id_, GetProxy(&frame_), + frame_factory->CreateFrame(routing_id_, MakeRequest(&frame_), frame_host_binding_.CreateInterfacePtrAndBind()); service_manager::mojom::InterfaceProviderPtr remote_interfaces; service_manager::mojom::InterfaceProviderRequest remote_interfaces_request = - GetProxy(&remote_interfaces); + MakeRequest(&remote_interfaces); remote_interfaces_.reset(new service_manager::InterfaceProvider); remote_interfaces_->Bind(std::move(remote_interfaces)); frame_->GetInterfaceProvider(std::move(remote_interfaces_request));
diff --git a/content/browser/loader/downloaded_temp_file_impl.cc b/content/browser/loader/downloaded_temp_file_impl.cc index 3109f90..31fc125 100644 --- a/content/browser/loader/downloaded_temp_file_impl.cc +++ b/content/browser/loader/downloaded_temp_file_impl.cc
@@ -16,7 +16,7 @@ mojo::InterfacePtr<mojom::DownloadedTempFile> ptr; auto binding = mojo::MakeStrongBinding( base::MakeUnique<DownloadedTempFileImpl>(child_id, request_id), - mojo::GetProxy(&ptr)); + mojo::MakeRequest(&ptr)); return ptr; }
diff --git a/content/browser/loader/mojo_async_resource_handler_unittest.cc b/content/browser/loader/mojo_async_resource_handler_unittest.cc index e67713a..c869a60 100644 --- a/content/browser/loader/mojo_async_resource_handler_unittest.cc +++ b/content/browser/loader/mojo_async_resource_handler_unittest.cc
@@ -341,11 +341,11 @@ ResourceRequest request; base::WeakPtr<mojo::StrongBinding<mojom::URLLoaderFactory>> weak_binding = mojo::MakeStrongBinding(base::MakeUnique<TestURLLoaderFactory>(), - mojo::GetProxy(&url_loader_factory_)); + mojo::MakeRequest(&url_loader_factory_)); url_loader_factory_->CreateLoaderAndStart( - mojo::GetProxy(&url_loader_proxy_, - url_loader_factory_.associated_group()), + mojo::MakeRequest(&url_loader_proxy_, + url_loader_factory_.associated_group()), 0, 0, request, url_loader_client_.CreateRemoteAssociatedPtrInfo( url_loader_factory_.associated_group()));
diff --git a/content/browser/loader/url_loader_factory_impl_unittest.cc b/content/browser/loader/url_loader_factory_impl_unittest.cc index 104e39c..1e448f7d 100644 --- a/content/browser/loader/url_loader_factory_impl_unittest.cc +++ b/content/browser/loader/url_loader_factory_impl_unittest.cc
@@ -102,7 +102,7 @@ URLLoaderFactoryImpl::Create( resource_message_filter_->requester_info_for_test(), - mojo::GetProxy(&factory_)); + mojo::MakeRequest(&factory_)); // Calling this function creates a request context. browser_context_->GetResourceContext()->GetRequestContext(); @@ -160,7 +160,7 @@ // Need to set |request_initiator| for non main frame type request. request.request_initiator = url::Origin(); factory_->CreateLoaderAndStart( - mojo::GetProxy(&loader, factory_.associated_group()), kRoutingId, + mojo::MakeRequest(&loader, factory_.associated_group()), kRoutingId, kRequestId, request, client.CreateRemoteAssociatedPtrInfo(factory_.associated_group())); @@ -239,7 +239,7 @@ // Need to set |request_initiator| for non main frame type request. request.request_initiator = url::Origin(); factory_->CreateLoaderAndStart( - mojo::GetProxy(&loader, factory_.associated_group()), 2, 1, request, + mojo::MakeRequest(&loader, factory_.associated_group()), 2, 1, request, client.CreateRemoteAssociatedPtrInfo(factory_.associated_group())); client.RunUntilComplete(); @@ -268,7 +268,7 @@ // Need to set |request_initiator| for non main frame type request. request.request_initiator = url::Origin(); factory_->CreateLoaderAndStart( - mojo::GetProxy(&loader, factory_.associated_group()), 2, 1, request, + mojo::MakeRequest(&loader, factory_.associated_group()), 2, 1, request, client.CreateRemoteAssociatedPtrInfo(factory_.associated_group())); client.RunUntilComplete(); @@ -295,7 +295,7 @@ request.request_initiator = url::Origin(); ASSERT_FALSE(request.url.is_valid()); factory_->CreateLoaderAndStart( - mojo::GetProxy(&loader, factory_.associated_group()), 2, 1, request, + mojo::MakeRequest(&loader, factory_.associated_group()), 2, 1, request, client.CreateRemoteAssociatedPtrInfo(factory_.associated_group())); client.RunUntilComplete(); @@ -321,7 +321,7 @@ // Need to set |request_initiator| for non main frame type request. request.request_initiator = url::Origin(); factory_->CreateLoaderAndStart( - mojo::GetProxy(&loader, factory_.associated_group()), 2, 1, request, + mojo::MakeRequest(&loader, factory_.associated_group()), 2, 1, request, client.CreateRemoteAssociatedPtrInfo(factory_.associated_group())); client.RunUntilComplete(); @@ -351,7 +351,7 @@ request.download_to_file = true; request.request_initiator = url::Origin(); factory_->CreateLoaderAndStart( - mojo::GetProxy(&loader, factory_.associated_group()), kRoutingId, + mojo::MakeRequest(&loader, factory_.associated_group()), kRoutingId, kRequestId, request, client.CreateRemoteAssociatedPtrInfo(factory_.associated_group())); ASSERT_FALSE(client.has_received_response()); @@ -419,7 +419,7 @@ request.download_to_file = true; request.request_initiator = url::Origin(); factory_->CreateLoaderAndStart( - mojo::GetProxy(&loader, factory_.associated_group()), kRoutingId, + mojo::MakeRequest(&loader, factory_.associated_group()), kRoutingId, kRequestId, request, client.CreateRemoteAssociatedPtrInfo(factory_.associated_group())); ASSERT_FALSE(client.has_received_response()); @@ -483,7 +483,7 @@ request.request_initiator = url::Origin(); request.report_raw_headers = true; factory_->CreateLoaderAndStart( - mojo::GetProxy(&loader, factory_.associated_group()), kRoutingId, + mojo::MakeRequest(&loader, factory_.associated_group()), kRoutingId, kRequestId, request, client.CreateRemoteAssociatedPtrInfo(factory_.associated_group())); @@ -544,7 +544,7 @@ // Need to set |request_initiator| for non main frame type request. request.request_initiator = url::Origin(); factory_->CreateLoaderAndStart( - mojo::GetProxy(&loader, factory_.associated_group()), kRoutingId, + mojo::MakeRequest(&loader, factory_.associated_group()), kRoutingId, kRequestId, request, client.CreateRemoteAssociatedPtrInfo(factory_.associated_group()));
diff --git a/content/browser/media/media_interface_proxy.cc b/content/browser/media/media_interface_proxy.cc index 79f99dcb..80e27b1 100644 --- a/content/browser/media/media_interface_proxy.cc +++ b/content/browser/media/media_interface_proxy.cc
@@ -115,7 +115,7 @@ // TODO(xhwang): Replace this InterfaceProvider with a dedicated media host // interface. See http://crbug.com/660573 service_manager::mojom::InterfaceProviderPtr interfaces; - registry->Bind(GetProxy(&interfaces), service_manager::Identity(), + registry->Bind(MakeRequest(&interfaces), service_manager::Identity(), service_manager::InterfaceProviderSpec(), service_manager::Identity(), service_manager::InterfaceProviderSpec()); @@ -126,7 +126,7 @@ service_manager::Connector* connector = ServiceManagerConnection::GetForProcess()->GetConnector(); connector->ConnectToInterface("media", &media_service); - media_service->CreateInterfaceFactory(GetProxy(&interface_factory_ptr_), + media_service->CreateInterfaceFactory(MakeRequest(&interface_factory_ptr_), std::move(interfaces)); interface_factory_ptr_.set_connection_error_handler(base::Bind( &MediaInterfaceProxy::OnConnectionError, base::Unretained(this)));
diff --git a/content/browser/memory/memory_coordinator_impl.cc b/content/browser/memory/memory_coordinator_impl.cc index 22e1390..b531649 100644 --- a/content/browser/memory/memory_coordinator_impl.cc +++ b/content/browser/memory/memory_coordinator_impl.cc
@@ -316,10 +316,21 @@ return true; } +RenderProcessHost* MemoryCoordinatorImpl::GetRenderProcessHost( + int render_process_id) { + return RenderProcessHost::FromID(render_process_id); +} + +void MemoryCoordinatorImpl::SetDelegateForTesting( + std::unique_ptr<MemoryCoordinatorDelegate> delegate) { + CHECK(!delegate_); + delegate_ = std::move(delegate); +} + void MemoryCoordinatorImpl::AddChildForTesting( int dummy_render_process_id, mojom::ChildMemoryCoordinatorPtr child) { mojom::MemoryCoordinatorHandlePtr mch; - auto request = mojo::GetProxy(&mch); + auto request = mojo::MakeRequest(&mch); std::unique_ptr<MemoryCoordinatorHandleImpl> handle( new MemoryCoordinatorHandleImpl(std::move(request), this, dummy_render_process_id)); @@ -332,14 +343,14 @@ } bool MemoryCoordinatorImpl::CanSuspendRenderer(int render_process_id) { - // If there is no delegate (i.e. unittests), renderers are always suspendable. - if (!delegate_) - return true; - auto* render_process_host = RenderProcessHost::FromID(render_process_id); + auto* render_process_host = GetRenderProcessHost(render_process_id); if (!render_process_host || !render_process_host->IsProcessBackgrounded()) return false; if (render_process_host->GetWorkerRefCount() > 0) return false; + // Assumes that we can't suspend renderers if there is no delegate. + if (!delegate_) + return false; return delegate_->CanSuspendBackgroundedRenderer(render_process_id); } @@ -366,12 +377,6 @@ return memory_state; } -void MemoryCoordinatorImpl::SetDelegateForTesting( - std::unique_ptr<MemoryCoordinatorDelegate> delegate) { - CHECK(!delegate_); - delegate_ = std::move(delegate); -} - void MemoryCoordinatorImpl::CreateChildInfoMapEntry( int render_process_id, std::unique_ptr<MemoryCoordinatorHandleImpl> handle) { @@ -411,7 +416,7 @@ total_private_kb += working_set.priv; for (auto& iter : children()) { - auto* render_process_host = RenderProcessHost::FromID(iter.first); + auto* render_process_host = GetRenderProcessHost(iter.first); if (!render_process_host || render_process_host->GetHandle() == base::kNullProcessHandle) continue;
diff --git a/content/browser/memory/memory_coordinator_impl.h b/content/browser/memory/memory_coordinator_impl.h index b63bc4fa..34cf572 100644 --- a/content/browser/memory/memory_coordinator_impl.h +++ b/content/browser/memory/memory_coordinator_impl.h
@@ -28,6 +28,7 @@ class MemoryCoordinatorImplTest; class MemoryMonitor; class MemoryStateUpdater; +class RenderProcessHost; struct MemoryCoordinatorSingletonTraits; // MemoryCoordinatorImpl is an implementation of MemoryCoordinator. @@ -96,6 +97,16 @@ bool ChangeStateIfNeeded(MemoryState prev_state, MemoryState next_state); protected: + // Returns the RenderProcessHost which is correspond to the given id. + // Returns nullptr if there is no corresponding RenderProcessHost. + // This is a virtual method so that we can write tests without having + // actual RenderProcessHost. + virtual RenderProcessHost* GetRenderProcessHost(int render_process_id); + + // Sets a delegate for testing. + void SetDelegateForTesting( + std::unique_ptr<MemoryCoordinatorDelegate> delegate); + // Adds the given ChildMemoryCoordinator as a child of this coordinator. void AddChildForTesting(int dummy_render_process_id, mojom::ChildMemoryCoordinatorPtr child); @@ -148,9 +159,6 @@ MemoryState OverrideGlobalState(MemoryState memroy_state, const ChildInfo& child); - void SetDelegateForTesting( - std::unique_ptr<MemoryCoordinatorDelegate> delegate); - // Helper function of CreateHandle and AddChildForTesting. void CreateChildInfoMapEntry( int render_process_id,
diff --git a/content/browser/memory/memory_coordinator_impl_unittest.cc b/content/browser/memory/memory_coordinator_impl_unittest.cc index e52b303..648cc69 100644 --- a/content/browser/memory/memory_coordinator_impl_unittest.cc +++ b/content/browser/memory/memory_coordinator_impl_unittest.cc
@@ -14,6 +14,8 @@ #include "content/browser/memory/memory_monitor.h" #include "content/browser/memory/memory_state_updater.h" #include "content/public/common/content_features.h" +#include "content/public/test/mock_render_process_host.h" +#include "content/public/test/test_browser_context.h" #include "mojo/public/cpp/bindings/binding.h" #include "testing/gtest/include/gtest/gtest.h" @@ -83,13 +85,26 @@ DISALLOW_COPY_AND_ASSIGN(MockMemoryMonitor); }; +class TestMemoryCoordinatorDelegate : public MemoryCoordinatorDelegate { + public: + TestMemoryCoordinatorDelegate() {} + ~TestMemoryCoordinatorDelegate() override {} + + bool CanSuspendBackgroundedRenderer(int render_process_id) override { + return true; + } + + private: + DISALLOW_COPY_AND_ASSIGN(TestMemoryCoordinatorDelegate); +}; + // A MemoryCoordinatorImpl that can be directly constructed. class TestMemoryCoordinatorImpl : public MemoryCoordinatorImpl { public: // Mojo machinery for wrapping a mock ChildMemoryCoordinator. struct Child { Child(mojom::ChildMemoryCoordinatorPtr* cmc_ptr) : cmc_binding(&cmc) { - cmc_binding.Bind(mojo::GetProxy(cmc_ptr)); + cmc_binding.Bind(mojo::MakeRequest(cmc_ptr)); RunUntilIdle(); } @@ -100,7 +115,10 @@ TestMemoryCoordinatorImpl( scoped_refptr<base::TestMockTimeTaskRunner> task_runner) : MemoryCoordinatorImpl(task_runner, - base::MakeUnique<MockMemoryMonitor>()) {} + base::MakeUnique<MockMemoryMonitor>()) { + SetDelegateForTesting(base::MakeUnique<TestMemoryCoordinatorDelegate>()); + } + ~TestMemoryCoordinatorImpl() override {} using MemoryCoordinatorImpl::OnConnectionError; @@ -111,9 +129,22 @@ mojom::ChildMemoryCoordinatorPtr cmc_ptr; children_.push_back(std::unique_ptr<Child>(new Child(&cmc_ptr))); AddChildForTesting(process_id, std::move(cmc_ptr)); + render_process_hosts_[process_id] = + base::MakeUnique<MockRenderProcessHost>(&browser_context_); return &children_.back()->cmc; } + RenderProcessHost* GetRenderProcessHost(int render_process_id) override { + return GetMockRenderProcessHost(render_process_id); + } + + MockRenderProcessHost* GetMockRenderProcessHost(int render_process_id) { + auto iter = render_process_hosts_.find(render_process_id); + if (iter == render_process_hosts_.end()) + return nullptr; + return iter->second.get(); + } + // Wrapper of MemoryCoordinator::SetMemoryState that also calls RunUntilIdle. bool SetChildMemoryState( int render_process_id, MemoryState memory_state) { @@ -123,7 +154,9 @@ return result; } + TestBrowserContext browser_context_; std::vector<std::unique_ptr<Child>> children_; + std::map<int, std::unique_ptr<MockRenderProcessHost>> render_process_hosts_; }; } // namespace @@ -210,10 +243,13 @@ TEST_F(MemoryCoordinatorImplTest, SetChildMemoryState) { auto cmc = coordinator_->CreateChildMemoryCoordinator(1); auto iter = coordinator_->children().find(1); + auto* render_process_host = coordinator_->GetMockRenderProcessHost(1); ASSERT_TRUE(iter != coordinator_->children().end()); + ASSERT_TRUE(render_process_host); // Foreground iter->second.is_visible = true; + render_process_host->set_is_process_backgrounded(false); EXPECT_TRUE(coordinator_->SetChildMemoryState(1, MemoryState::NORMAL)); EXPECT_EQ(mojom::MemoryState::NORMAL, cmc->state()); EXPECT_TRUE( @@ -225,6 +261,7 @@ // Background iter->second.is_visible = false; + render_process_host->set_is_process_backgrounded(true); EXPECT_TRUE(coordinator_->SetChildMemoryState(1, MemoryState::NORMAL)); #if defined(OS_ANDROID) EXPECT_EQ(mojom::MemoryState::THROTTLED, cmc->state()); @@ -237,6 +274,16 @@ EXPECT_TRUE( coordinator_->SetChildMemoryState(1, MemoryState::SUSPENDED)); EXPECT_EQ(mojom::MemoryState::SUSPENDED, cmc->state()); + + // Background but there are workers + render_process_host->IncrementServiceWorkerRefCount(); + EXPECT_TRUE( + coordinator_->SetChildMemoryState(1, MemoryState::THROTTLED)); + EXPECT_EQ(mojom::MemoryState::THROTTLED, cmc->state()); + EXPECT_FALSE( + coordinator_->SetChildMemoryState(1, MemoryState::SUSPENDED)); + EXPECT_EQ(mojom::MemoryState::THROTTLED, cmc->state()); + render_process_host->DecrementSharedWorkerRefCount(); } TEST_F(MemoryCoordinatorImplTest, CalculateNextState) {
diff --git a/content/browser/payments/payment_app_content_unittest_base.cc b/content/browser/payments/payment_app_content_unittest_base.cc index c0c581b2a..d04b90c4 100644 --- a/content/browser/payments/payment_app_content_unittest_base.cc +++ b/content/browser/payments/payment_app_content_unittest_base.cc
@@ -80,7 +80,7 @@ // Create a new payment app manager. payments::mojom::PaymentAppManagerPtr manager; mojo::InterfaceRequest<payments::mojom::PaymentAppManager> request = - mojo::GetProxy(&manager); + mojo::MakeRequest(&manager); payment_app_managers_.push_back(std::move(manager)); payment_app_context_->CreatePaymentAppManager(std::move(request)); base::RunLoop().RunUntilIdle();
diff --git a/content/browser/presentation/presentation_service_impl_unittest.cc b/content/browser/presentation/presentation_service_impl_unittest.cc index 62973068..c387fece 100644 --- a/content/browser/presentation/presentation_service_impl_unittest.cc +++ b/content/browser/presentation/presentation_service_impl_unittest.cc
@@ -210,7 +210,7 @@ void SetUp() override { RenderViewHostImplTestHarness::SetUp(); - auto request = mojo::GetProxy(&service_ptr_); + auto request = mojo::MakeRequest(&service_ptr_); EXPECT_CALL(mock_delegate_, AddObserver(_, _, _)).Times(1); TestRenderFrameHost* render_frame_host = contents()->GetMainFrame(); render_frame_host->InitializeRenderFrameIfNeeded(); @@ -221,7 +221,7 @@ blink::mojom::PresentationServiceClientPtr client_ptr; client_binding_.reset( new mojo::Binding<blink::mojom::PresentationServiceClient>( - &mock_client_, mojo::GetProxy(&client_ptr))); + &mock_client_, mojo::MakeRequest(&client_ptr))); service_impl_->SetClient(std::move(client_ptr)); presentation_urls_.push_back(presentation_url1_);
diff --git a/content/browser/renderer_host/media/media_devices_dispatcher_host.cc b/content/browser/renderer_host/media/media_devices_dispatcher_host.cc index 5cbc36f..d50e28a 100644 --- a/content/browser/renderer_host/media/media_devices_dispatcher_host.cc +++ b/content/browser/renderer_host/media/media_devices_dispatcher_host.cc
@@ -229,7 +229,7 @@ return; render_frame_host->GetRemoteInterfaces()->GetInterface( - mojo::GetProxy(&media_devices_listener)); + mojo::MakeRequest(&media_devices_listener)); if (!media_devices_listener) return; }
diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc index 6b7b72e..4a248aac 100644 --- a/content/browser/renderer_host/render_process_host_impl.cc +++ b/content/browser/renderer_host/render_process_host_impl.cc
@@ -935,7 +935,7 @@ // doesn't care about render processes, so we can initialize a dummy // connection. service_manager::mojom::ServiceRequest request = - mojo::GetProxy(&test_service_); + mojo::MakeRequest(&test_service_); ServiceManagerConnection::SetForProcess(ServiceManagerConnection::Create( std::move(request), io_task_runner)); }
diff --git a/content/browser/renderer_host/render_widget_host_view_aura.cc b/content/browser/renderer_host/render_widget_host_view_aura.cc index e60508a..e09bf33 100644 --- a/content/browser/renderer_host/render_widget_host_view_aura.cc +++ b/content/browser/renderer_host/render_widget_host_view_aura.cc
@@ -1897,7 +1897,7 @@ ui::mojom::WindowTreeClientPtr window_tree_client; factory->CreateWindowTreeClientForRenderWidget( - host_->GetRoutingID(), mojo::GetProxy(&window_tree_client)); + host_->GetRoutingID(), mojo::MakeRequest(&window_tree_client)); aura::WindowPortMus::Get(window_)->Embed( std::move(window_tree_client), ui::mojom::kEmbedFlagEmbedderInterceptsEvents,
diff --git a/content/browser/service_manager/service_manager_context.cc b/content/browser/service_manager/service_manager_context.cc index ae9969b..b0f2dea7 100644 --- a/content/browser/service_manager/service_manager_context.cc +++ b/content/browser/service_manager/service_manager_context.cc
@@ -66,10 +66,11 @@ bool use_sandbox, service_manager::mojom::ServiceRequest request) { service_manager::mojom::ServiceFactoryPtr service_factory; - BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, - base::Bind(&StartUtilityProcessOnIOThread, - base::Passed(GetProxy(&service_factory)), - process_name, use_sandbox)); + BrowserThread::PostTask( + BrowserThread::IO, FROM_HERE, + base::Bind(&StartUtilityProcessOnIOThread, + base::Passed(MakeRequest(&service_factory)), process_name, + use_sandbox)); service_factory->CreateService(std::move(request), service_name); } @@ -100,7 +101,7 @@ BrowserThread::PostTask( BrowserThread::IO, FROM_HERE, base::Bind(&RequestGpuServiceFactory, - base::Passed(GetProxy(&service_factory)))); + base::Passed(MakeRequest(&service_factory)))); service_factory->CreateService(std::move(request), service_name); } @@ -161,7 +162,7 @@ std::unique_ptr<BuiltinManifestProvider> manifest_provider) { service_manager::mojom::ServicePtr embedder_service_proxy; service_manager::mojom::ServiceRequest embedder_service_request = - mojo::GetProxy(&embedder_service_proxy); + mojo::MakeRequest(&embedder_service_proxy); service_manager::mojom::ServicePtrInfo embedder_service_proxy_info = embedder_service_proxy.PassInterface(); BrowserThread::GetTaskRunnerForThread(BrowserThread::IO)->PostTask(
diff --git a/content/browser/service_worker/embedded_worker_instance.cc b/content/browser/service_worker/embedded_worker_instance.cc index 17246a1f..3fcf141 100644 --- a/content/browser/service_worker/embedded_worker_instance.cc +++ b/content/browser/service_worker/embedded_worker_instance.cc
@@ -480,7 +480,7 @@ mojom::EmbeddedWorkerInstanceClientRequest request; if (ServiceWorkerUtils::IsMojoForServiceWorkerEnabled()) { - request = mojo::GetProxy(&client_); + request = mojo::MakeRequest(&client_); client_.set_connection_error_handler( base::Bind(&CallDetach, base::Unretained(this))); }
diff --git a/content/browser/service_worker/embedded_worker_instance_unittest.cc b/content/browser/service_worker/embedded_worker_instance_unittest.cc index c2b19c72c..3496f18 100644 --- a/content/browser/service_worker/embedded_worker_instance_unittest.cc +++ b/content/browser/service_worker/embedded_worker_instance_unittest.cc
@@ -117,7 +117,7 @@ mojom::ServiceWorkerEventDispatcherRequest CreateEventDispatcher() { dispatchers_.emplace_back(); - return mojo::GetProxy(&dispatchers_.back()); + return mojo::MakeRequest(&dispatchers_.back()); } ServiceWorkerContextCore* context() { return helper_->context(); }
diff --git a/content/browser/service_worker/embedded_worker_test_helper.cc b/content/browser/service_worker/embedded_worker_test_helper.cc index 5c62c8d7..004f9e4 100644 --- a/content/browser/service_worker/embedded_worker_test_helper.cc +++ b/content/browser/service_worker/embedded_worker_test_helper.cc
@@ -579,7 +579,7 @@ base::Bind(&MockEmbeddedWorkerInstanceClient::Bind, AsWeakPtr())); service_manager::mojom::InterfaceProviderPtr interfaces; - registry->Bind(mojo::GetProxy(&interfaces), service_manager::Identity(), + registry->Bind(mojo::MakeRequest(&interfaces), service_manager::Identity(), service_manager::InterfaceProviderSpec(), service_manager::Identity(), service_manager::InterfaceProviderSpec());
diff --git a/content/browser/service_worker/service_worker_fetch_dispatcher.cc b/content/browser/service_worker/service_worker_fetch_dispatcher.cc index d8d1ad6d..1dd7ca6 100644 --- a/content/browser/service_worker/service_worker_fetch_dispatcher.cc +++ b/content/browser/service_worker/service_worker_fetch_dispatcher.cc
@@ -421,7 +421,7 @@ mojom::URLLoaderFactoryPtr factory; URLLoaderFactoryImpl::Create( ResourceRequesterInfo::CreateForNavigationPreload(requester_info), - mojo::GetProxy(&url_loader_factory_)); + mojo::MakeRequest(&url_loader_factory_)); preload_handle_ = mojom::FetchEventPreloadHandle::New(); @@ -454,7 +454,7 @@ preload_handle_ = mojom::FetchEventPreloadHandle::New(); mojom::URLLoaderClientPtr url_loader_client_ptr; preload_handle_->url_loader_client_request = - mojo::GetProxy(&url_loader_client_ptr); + mojo::MakeRequest(&url_loader_client_ptr); auto url_loader_client = base::MakeUnique<DelegatingURLLoaderClient>( std::move(url_loader_client_ptr)); mojom::URLLoaderClientAssociatedPtrInfo url_loader_client_associated_ptr_info; @@ -463,8 +463,8 @@ mojom::URLLoaderAssociatedPtr url_loader_associated_ptr; url_loader_factory_->CreateLoaderAndStart( - mojo::GetProxy(&url_loader_associated_ptr, - url_loader_factory_.associated_group()), + mojo::MakeRequest(&url_loader_associated_ptr, + url_loader_factory_.associated_group()), original_info->GetRouteID(), request_id, request, std::move(url_loader_client_associated_ptr_info));
diff --git a/content/browser/service_worker/service_worker_version.cc b/content/browser/service_worker/service_worker_version.cc index ca00360..54d9189 100644 --- a/content/browser/service_worker/service_worker_version.cc +++ b/content/browser/service_worker/service_worker_version.cc
@@ -1506,7 +1506,7 @@ params->pause_after_download = pause_after_download_; embedded_worker_->Start( - std::move(params), mojo::GetProxy(&event_dispatcher_), + std::move(params), mojo::MakeRequest(&event_dispatcher_), base::Bind(&ServiceWorkerVersion::OnStartSentAndScriptEvaluated, weak_factory_.GetWeakPtr())); }
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc index c8b38722..1bf187d 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc
@@ -5018,7 +5018,7 @@ service_manager::InterfaceProvider* WebContentsImpl::GetJavaInterfaces() { if (!java_interfaces_) { service_manager::mojom::InterfaceProviderPtr provider; - BindInterfaceRegistryForWebContents(mojo::GetProxy(&provider), this); + BindInterfaceRegistryForWebContents(mojo::MakeRequest(&provider), this); java_interfaces_.reset(new service_manager::InterfaceProvider); java_interfaces_->Bind(std::move(provider)); }
diff --git a/content/browser/websockets/websocket_manager_unittest.cc b/content/browser/websockets/websocket_manager_unittest.cc index 22cb7c4d..2c9b3752 100644 --- a/content/browser/websockets/websocket_manager_unittest.cc +++ b/content/browser/websockets/websocket_manager_unittest.cc
@@ -98,14 +98,14 @@ void AddMultipleChannels(int number_of_channels) { for (int i = 0; i < number_of_channels; ++i) { blink::mojom::WebSocketPtr websocket; - websocket_manager_->DoCreateWebSocket(mojo::GetProxy(&websocket)); + websocket_manager_->DoCreateWebSocket(mojo::MakeRequest(&websocket)); } } void AddAndCancelMultipleChannels(int number_of_channels) { for (int i = 0; i < number_of_channels; ++i) { blink::mojom::WebSocketPtr websocket; - websocket_manager_->DoCreateWebSocket(mojo::GetProxy(&websocket)); + websocket_manager_->DoCreateWebSocket(mojo::MakeRequest(&websocket)); websocket_manager_->sockets().back()->SimulateConnectionError(); } } @@ -124,7 +124,7 @@ TEST_F(WebSocketManagerTest, CreateWebSocket) { blink::mojom::WebSocketPtr websocket; - websocket_manager()->DoCreateWebSocket(mojo::GetProxy(&websocket)); + websocket_manager()->DoCreateWebSocket(mojo::MakeRequest(&websocket)); EXPECT_EQ(1U, websocket_manager()->sockets().size()); } @@ -132,7 +132,7 @@ TEST_F(WebSocketManagerTest, SendFrameButNotConnectedYet) { blink::mojom::WebSocketPtr websocket; - websocket_manager()->DoCreateWebSocket(mojo::GetProxy(&websocket)); + websocket_manager()->DoCreateWebSocket(mojo::MakeRequest(&websocket)); // This should not crash. mojo::Array<uint8_t> data;
diff --git a/content/child/child_thread_impl.cc b/content/child/child_thread_impl.cc index 8151a2e..3fb399ac 100644 --- a/content/child/child_thread_impl.cc +++ b/content/child/child_thread_impl.cc
@@ -398,7 +398,7 @@ } else { DCHECK(service_manager_connection_); IPC::mojom::ChannelBootstrapPtr bootstrap; - handle = mojo::GetProxy(&bootstrap).PassMessagePipe(); + handle = mojo::MakeRequest(&bootstrap).PassMessagePipe(); service_manager_connection_->AddConnectionFilter( base::MakeUnique<ChannelBootstrapFilter>(bootstrap.PassInterface())); }
diff --git a/content/child/indexed_db/webidbcursor_impl_unittest.cc b/content/child/indexed_db/webidbcursor_impl_unittest.cc index 55dfe57..2d32e9e 100644 --- a/content/child/indexed_db/webidbcursor_impl_unittest.cc +++ b/content/child/indexed_db/webidbcursor_impl_unittest.cc
@@ -122,7 +122,7 @@ null_key_.assignNull(); indexed_db::mojom::CursorAssociatedPtr ptr; mock_cursor_ = - base::MakeUnique<MockCursorImpl>(mojo::GetProxyForTesting(&ptr)); + base::MakeUnique<MockCursorImpl>(mojo::MakeRequestForTesting(&ptr)); cursor_ = base::MakeUnique<WebIDBCursorImpl>( ptr.PassInterface(), 1, base::ThreadTaskRunnerHandle::Get()); }
diff --git a/content/child/resource_dispatcher.cc b/content/child/resource_dispatcher.cc index fcd3270..4cfd5f4 100644 --- a/content/child/resource_dispatcher.cc +++ b/content/child/resource_dispatcher.cc
@@ -731,7 +731,7 @@ mojom::URLLoaderClientAssociatedPtrInfo client_ptr_info; client->Bind(&client_ptr_info, associated_group); url_loader_factory->CreateLoaderAndStart( - GetProxy(&url_loader, associated_group), routing_id, request_id, + MakeRequest(&url_loader, associated_group), routing_id, request_id, *request, std::move(client_ptr_info)); pending_requests_[request_id]->url_loader = std::move(url_loader); pending_requests_[request_id]->url_loader_client = std::move(client);
diff --git a/content/common/associated_interface_provider_impl.cc b/content/common/associated_interface_provider_impl.cc index 3154596f..454250d 100644 --- a/content/common/associated_interface_provider_impl.cc +++ b/content/common/associated_interface_provider_impl.cc
@@ -15,9 +15,9 @@ explicit LocalProvider(mojom::AssociatedInterfaceProviderAssociatedPtr* proxy) : route_provider_binding_(this), associated_interface_provider_binding_(this) { - route_provider_binding_.Bind(mojo::GetProxy(&route_provider_ptr_)); + route_provider_binding_.Bind(mojo::MakeRequest(&route_provider_ptr_)); route_provider_ptr_->GetRoute( - 0, mojo::GetProxy(proxy, route_provider_ptr_.associated_group())); + 0, mojo::MakeRequest(proxy, route_provider_ptr_.associated_group())); } ~LocalProvider() override {}
diff --git a/content/common/service_manager/child_connection.cc b/content/common/service_manager/child_connection.cc index 2f73ff0..45bbdaa 100644 --- a/content/common/service_manager/child_connection.cc +++ b/content/common/service_manager/child_connection.cc
@@ -92,7 +92,7 @@ service.Bind(mojo::InterfacePtrInfo<service_manager::mojom::Service>( std::move(service_pipe), 0u)); service_manager::mojom::PIDReceiverRequest pid_receiver_request = - mojo::GetProxy(&pid_receiver_); + mojo::MakeRequest(&pid_receiver_); service_manager::Connector::ConnectParams params(child_identity); params.set_client_process_connection(std::move(service),
diff --git a/content/ppapi_plugin/ppapi_thread.cc b/content/ppapi_plugin/ppapi_thread.cc index 41815e275..3274c56c 100644 --- a/content/ppapi_plugin/ppapi_thread.cc +++ b/content/ppapi_plugin/ppapi_thread.cc
@@ -150,7 +150,7 @@ #endif } else { ChildThread::Get()->GetRemoteInterfaces()->GetInterface( - mojo::GetProxy(&manager_ptr)); + mojo::MakeRequest(&manager_ptr)); } discardable_shared_memory_manager_ = base::MakeUnique< discardable_memory::ClientDiscardableSharedMemoryManager>(
diff --git a/content/public/browser/utility_process_mojo_client.h b/content/public/browser/utility_process_mojo_client.h index e81667b..b8e7388 100644 --- a/content/public/browser/utility_process_mojo_client.h +++ b/content/public/browser/utility_process_mojo_client.h
@@ -56,7 +56,7 @@ start_called_ = true; - mojo::InterfaceRequest<MojoInterface> req = mojo::GetProxy(&service_); + mojo::InterfaceRequest<MojoInterface> req = mojo::MakeRequest(&service_); service_.set_connection_error_handler(on_error_callback_); helper_->Start(MojoInterface::Name_, req.PassMessagePipe()); }
diff --git a/content/public/common/associated_interface_provider.h b/content/public/common/associated_interface_provider.h index 156f64a..c9e738438 100644 --- a/content/public/common/associated_interface_provider.h +++ b/content/public/common/associated_interface_provider.h
@@ -47,7 +47,7 @@ template <typename Interface> void GetInterface(mojo::AssociatedInterfacePtr<Interface>* proxy) { mojo::AssociatedInterfaceRequest<Interface> request = - mojo::GetProxy(proxy, GetAssociatedGroup()); + mojo::MakeRequest(proxy, GetAssociatedGroup()); GetInterface(Interface::Name_, request.PassHandle()); }
diff --git a/content/public/test/mock_render_thread.cc b/content/public/test/mock_render_thread.cc index 1003a2b..a87ce236 100644 --- a/content/public/test/mock_render_thread.cc +++ b/content/public/test/mock_render_thread.cc
@@ -273,7 +273,7 @@ if (!remote_interfaces_) { service_manager::mojom::InterfaceProviderPtr remote_interface_provider; pending_remote_interface_provider_request_ = - GetProxy(&remote_interface_provider); + MakeRequest(&remote_interface_provider); remote_interfaces_.reset(new service_manager::InterfaceProvider); remote_interfaces_->Bind(std::move(remote_interface_provider)); }
diff --git a/content/renderer/bluetooth/web_bluetooth_impl.cc b/content/renderer/bluetooth/web_bluetooth_impl.cc index ec557d6..c518ef6 100644 --- a/content/renderer/bluetooth/web_bluetooth_impl.cc +++ b/content/renderer/bluetooth/web_bluetooth_impl.cc
@@ -316,7 +316,8 @@ blink::mojom::WebBluetoothService& WebBluetoothImpl::GetWebBluetoothService() { if (!web_bluetooth_service_) { - remote_interfaces_->GetInterface(mojo::GetProxy(&web_bluetooth_service_)); + remote_interfaces_->GetInterface( + mojo::MakeRequest(&web_bluetooth_service_)); // Create an associated interface ptr and pass it to the WebBluetoothService // so that it can send us events without us prompting. blink::mojom::WebBluetoothServiceClientAssociatedPtrInfo ptr_info;
diff --git a/content/renderer/device_sensors/device_sensor_event_pump.h b/content/renderer/device_sensors/device_sensor_event_pump.h index 9a6e1e6..35a5e45a 100644 --- a/content/renderer/device_sensors/device_sensor_event_pump.h +++ b/content/renderer/device_sensors/device_sensor_event_pump.h
@@ -25,7 +25,7 @@ explicit DeviceSensorMojoClientMixin(Args&&... args) : Base(std::forward<Args>(args)...) { mojo::InterfaceRequest<MojoInterface> request = - mojo::GetProxy(&mojo_interface_); + mojo::MakeRequest(&mojo_interface_); // When running layout tests, those observers should not listen to the // actual hardware changes. In order to make that happen, don't connect
diff --git a/content/renderer/dom_storage/local_storage_cached_area.cc b/content/renderer/dom_storage/local_storage_cached_area.cc index 7eb9efbd..57f37ea8 100644 --- a/content/renderer/dom_storage/local_storage_cached_area.cc +++ b/content/renderer/dom_storage/local_storage_cached_area.cc
@@ -58,7 +58,8 @@ : origin_(origin), binding_(this), cached_areas_(cached_areas), weak_factory_(this) { storage_partition_service->OpenLocalStorage( - origin_, binding_.CreateInterfacePtrAndBind(), mojo::GetProxy(&leveldb_)); + origin_, binding_.CreateInterfacePtrAndBind(), + mojo::MakeRequest(&leveldb_)); } LocalStorageCachedArea::~LocalStorageCachedArea() {
diff --git a/content/renderer/gamepad_shared_memory_reader.cc b/content/renderer/gamepad_shared_memory_reader.cc index 62dd301c..24733e7 100644 --- a/content/renderer/gamepad_shared_memory_reader.cc +++ b/content/renderer/gamepad_shared_memory_reader.cc
@@ -22,7 +22,7 @@ binding_(this) { if (thread) { thread->GetRemoteInterfaces()->GetInterface( - mojo::GetProxy(&gamepad_monitor_)); + mojo::MakeRequest(&gamepad_monitor_)); gamepad_monitor_->SetObserver(binding_.CreateInterfacePtrAndBind()); } }
diff --git a/content/renderer/media/media_devices_event_dispatcher.cc b/content/renderer/media/media_devices_event_dispatcher.cc index e0bce9af..6c4e0f1 100644 --- a/content/renderer/media/media_devices_event_dispatcher.cc +++ b/content/renderer/media/media_devices_event_dispatcher.cc
@@ -121,7 +121,7 @@ MediaDevicesEventDispatcher::GetMediaDevicesDispatcher() { if (!media_devices_dispatcher_) { render_frame()->GetRemoteInterfaces()->GetInterface( - mojo::GetProxy(&media_devices_dispatcher_)); + mojo::MakeRequest(&media_devices_dispatcher_)); } return media_devices_dispatcher_;
diff --git a/content/renderer/media/media_permission_dispatcher.cc b/content/renderer/media/media_permission_dispatcher.cc index ccd7591f..9e7a42c 100644 --- a/content/renderer/media/media_permission_dispatcher.cc +++ b/content/renderer/media/media_permission_dispatcher.cc
@@ -75,7 +75,7 @@ DCHECK(task_runner_->RunsTasksOnCurrentThread()); if (!permission_service_) - connect_to_service_cb_.Run(mojo::GetProxy(&permission_service_)); + connect_to_service_cb_.Run(mojo::MakeRequest(&permission_service_)); int request_id = RegisterCallback(permission_status_cb); DVLOG(2) << __func__ << ": request ID " << request_id; @@ -102,7 +102,7 @@ DCHECK(task_runner_->RunsTasksOnCurrentThread()); if (!permission_service_) - connect_to_service_cb_.Run(mojo::GetProxy(&permission_service_)); + connect_to_service_cb_.Run(mojo::MakeRequest(&permission_service_)); int request_id = RegisterCallback(permission_status_cb); DVLOG(2) << __func__ << ": request ID " << request_id;
diff --git a/content/renderer/media/user_media_client_impl.cc b/content/renderer/media/user_media_client_impl.cc index dfe6f24..d22826f 100644 --- a/content/renderer/media/user_media_client_impl.cc +++ b/content/renderer/media/user_media_client_impl.cc
@@ -951,7 +951,7 @@ UserMediaClientImpl::GetMediaDevicesDispatcher() { if (!media_devices_dispatcher_) { render_frame()->GetRemoteInterfaces()->GetInterface( - mojo::GetProxy(&media_devices_dispatcher_)); + mojo::MakeRequest(&media_devices_dispatcher_)); } return media_devices_dispatcher_;
diff --git a/content/renderer/media/video_capture_impl.cc b/content/renderer/media/video_capture_impl.cc index aaacbf0..db341d3 100644 --- a/content/renderer/media/video_capture_impl.cc +++ b/content/renderer/media/video_capture_impl.cc
@@ -76,7 +76,7 @@ if (ChildThread::Get()) { // This will be null in unit tests. mojom::VideoCaptureHostPtr temp_video_capture_host; ChildThread::Get()->GetRemoteInterfaces()->GetInterface( - mojo::GetProxy(&temp_video_capture_host)); + mojo::MakeRequest(&temp_video_capture_host)); video_capture_host_info_ = temp_video_capture_host.PassInterface(); } }
diff --git a/content/renderer/pepper/pepper_media_device_manager.cc b/content/renderer/pepper/pepper_media_device_manager.cc index 16e18988..8888bb7 100644 --- a/content/renderer/pepper/pepper_media_device_manager.cc +++ b/content/renderer/pepper/pepper_media_device_manager.cc
@@ -263,7 +263,7 @@ if (!media_devices_dispatcher_) { DCHECK(render_frame()); render_frame()->GetRemoteInterfaces()->GetInterface( - mojo::GetProxy(&media_devices_dispatcher_)); + mojo::MakeRequest(&media_devices_dispatcher_)); } return media_devices_dispatcher_;
diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc index 050b89e..7b6e75e 100644 --- a/content/renderer/render_frame_impl.cc +++ b/content/renderer/render_frame_impl.cc
@@ -1134,7 +1134,7 @@ interface_registry_ = base::MakeUnique<service_manager::InterfaceRegistry>( mojom::kNavigation_FrameSpec); service_manager::mojom::InterfaceProviderPtr remote_interfaces; - pending_remote_interface_provider_request_ = GetProxy(&remote_interfaces); + pending_remote_interface_provider_request_ = MakeRequest(&remote_interfaces); remote_interfaces_.reset(new service_manager::InterfaceProvider); remote_interfaces_->Bind(std::move(remote_interfaces)); blink_interface_provider_.reset(new BlinkInterfaceProviderImpl( @@ -1167,10 +1167,10 @@ // Create the RemotingSinkObserver to monitor the remoting sink availablity. media::mojom::RemotingSourcePtr remoting_source; media::mojom::RemotingSourceRequest remoting_source_request = - mojo::GetProxy(&remoting_source); + mojo::MakeRequest(&remoting_source); media::mojom::RemoterPtr remoter; GetRemoterFactory()->Create(std::move(remoting_source), - mojo::GetProxy(&remoter)); + mojo::MakeRequest(&remoter)); remoting_sink_observer_ = base::MakeUnique<media::RemotingSinkObserver>( std::move(remoting_source_request), std::move(remoter)); #endif // BUILDFLAG(ENABLE_MEDIA_REMOTING) @@ -2533,8 +2533,9 @@ if (thread) { mojom::AssociatedInterfaceProviderAssociatedPtr remote_interfaces; thread->GetRemoteRouteProvider()->GetRoute( - routing_id_, mojo::GetProxy(&remote_interfaces, - thread->channel()->GetAssociatedGroup())); + routing_id_, + mojo::MakeRequest(&remote_interfaces, + thread->channel()->GetAssociatedGroup())); remote_associated_interfaces_.reset( new AssociatedInterfaceProviderImpl(std::move(remote_interfaces))); } else { @@ -2751,10 +2752,10 @@ RenderFrameImpl::CreateRemotingRendererController() { media::mojom::RemotingSourcePtr remoting_source; media::mojom::RemotingSourceRequest remoting_source_request = - mojo::GetProxy(&remoting_source); + mojo::MakeRequest(&remoting_source); media::mojom::RemoterPtr remoter; GetRemoterFactory()->Create(std::move(remoting_source), - mojo::GetProxy(&remoter)); + mojo::MakeRequest(&remoter)); return base::MakeUnique<media::RemotingRendererController>( make_scoped_refptr(new media::RemotingSourceImpl( std::move(remoting_source_request), std::move(remoter))));
diff --git a/content/renderer/render_thread_impl.cc b/content/renderer/render_thread_impl.cc index 4157af71..2e4e4b99 100644 --- a/content/renderer/render_thread_impl.cc +++ b/content/renderer/render_thread_impl.cc
@@ -860,7 +860,7 @@ // ChildMemoryCoordinatorImpl. // https://codereview.chromium.org/2094583002/#msg52 mojom::MemoryCoordinatorHandlePtr parent_coordinator; - GetRemoteInterfaces()->GetInterface(mojo::GetProxy(&parent_coordinator)); + GetRemoteInterfaces()->GetInterface(mojo::MakeRequest(&parent_coordinator)); memory_coordinator_ = CreateChildMemoryCoordinator( std::move(parent_coordinator), this); } @@ -889,7 +889,7 @@ #endif } else { ChildThread::Get()->GetRemoteInterfaces()->GetInterface( - mojo::GetProxy(&manager_ptr)); + mojo::MakeRequest(&manager_ptr)); } discardable_shared_memory_manager_ = base::MakeUnique< @@ -912,7 +912,7 @@ base::Unretained(embedded_worker_dispatcher_.get()))); GetRemoteInterfaces()->GetInterface( - mojo::GetProxy(&storage_partition_service_)); + mojo::MakeRequest(&storage_partition_service_)); #if defined(OS_LINUX) ChildProcess::current()->SetIOThreadPriority(base::ThreadPriority::DISPLAY);
diff --git a/content/shell/renderer/layout_test/blink_test_runner.cc b/content/shell/renderer/layout_test/blink_test_runner.cc index feda167..155cff0 100644 --- a/content/shell/renderer/layout_test/blink_test_runner.cc +++ b/content/shell/renderer/layout_test/blink_test_runner.cc
@@ -713,7 +713,7 @@ service_manager::InterfaceRegistry::TestApi test_api( render_view()->GetMainRenderFrame()->GetInterfaceRegistry()); test_api.GetLocalInterface( - mojo::GetProxy(&app_banner_service_->controller())); + mojo::MakeRequest(&app_banner_service_->controller())); app_banner_service_->SendBannerPromptRequest(event_platforms, callback); } @@ -942,7 +942,7 @@ BlinkTestRunner::GetBluetoothFakeAdapterSetter() { if (!bluetooth_fake_adapter_setter_) { RenderThread::Get()->GetRemoteInterfaces()->GetInterface( - mojo::GetProxy(&bluetooth_fake_adapter_setter_)); + mojo::MakeRequest(&bluetooth_fake_adapter_setter_)); } return *bluetooth_fake_adapter_setter_; }
diff --git a/device/bluetooth/adapter.cc b/device/bluetooth/adapter.cc index 62eb9a5..8462fc8 100644 --- a/device/bluetooth/adapter.cc +++ b/device/bluetooth/adapter.cc
@@ -96,7 +96,8 @@ const ConnectToDeviceCallback& callback, std::unique_ptr<device::BluetoothGattConnection> connection) { mojom::DevicePtr device_ptr; - Device::Create(adapter_, std::move(connection), mojo::GetProxy(&device_ptr)); + Device::Create(adapter_, std::move(connection), + mojo::MakeRequest(&device_ptr)); callback.Run(mojom::ConnectResult::SUCCESS, std::move(device_ptr)); }
diff --git a/device/bluetooth/adapter_factory.cc b/device/bluetooth/adapter_factory.cc index 4ac2bd9..9eabd2d 100644 --- a/device/bluetooth/adapter_factory.cc +++ b/device/bluetooth/adapter_factory.cc
@@ -36,7 +36,7 @@ scoped_refptr<device::BluetoothAdapter> adapter) { mojom::AdapterPtr adapter_ptr; mojo::MakeStrongBinding(base::MakeUnique<Adapter>(adapter), - mojo::GetProxy(&adapter_ptr)); + mojo::MakeRequest(&adapter_ptr)); callback.Run(std::move(adapter_ptr)); }
diff --git a/device/bluetooth/device_unittest.cc b/device/bluetooth/device_unittest.cc index 140dbc2..b1e9ae1 100644 --- a/device/bluetooth/device_unittest.cc +++ b/device/bluetooth/device_unittest.cc
@@ -72,7 +72,7 @@ auto connection = base::MakeUnique<NiceMockBluetoothGattConnection>( adapter_, device_.GetAddress()); - Device::Create(adapter_, std::move(connection), mojo::GetProxy(&proxy_)); + Device::Create(adapter_, std::move(connection), mojo::MakeRequest(&proxy_)); proxy_.set_connection_error_handler( base::Bind(&BluetoothInterfaceDeviceTest::OnConnectionError,
diff --git a/device/generic_sensor/sensor_impl.cc b/device/generic_sensor/sensor_impl.cc index 4b79669..1cf9eb8 100644 --- a/device/generic_sensor/sensor_impl.cc +++ b/device/generic_sensor/sensor_impl.cc
@@ -20,7 +20,7 @@ } mojom::SensorClientRequest SensorImpl::GetClient() { - return mojo::GetProxy(&client_); + return mojo::MakeRequest(&client_); } void SensorImpl::AddConfiguration(
diff --git a/device/power_monitor/power_monitor_message_broadcaster_unittest.cc b/device/power_monitor/power_monitor_message_broadcaster_unittest.cc index fe19826..4356a0df 100644 --- a/device/power_monitor/power_monitor_message_broadcaster_unittest.cc +++ b/device/power_monitor/power_monitor_message_broadcaster_unittest.cc
@@ -62,7 +62,7 @@ TEST_F(PowerMonitorMessageBroadcasterTest, PowerMessageBroadcast) { device::mojom::PowerMonitorClientPtr proxy; - FakePowerMonitorClient client(mojo::GetProxy(&proxy)); + FakePowerMonitorClient client(mojo::MakeRequest(&proxy)); PowerMonitorMessageBroadcaster broadcaster; // Calling SetClient should invoke a power state change.
diff --git a/device/power_monitor/public/cpp/power_monitor_broadcast_source.cc b/device/power_monitor/public/cpp/power_monitor_broadcast_source.cc index 28f5bf4..100b89b2 100644 --- a/device/power_monitor/public/cpp/power_monitor_broadcast_source.cc +++ b/device/power_monitor/public/cpp/power_monitor_broadcast_source.cc
@@ -15,7 +15,7 @@ : last_reported_battery_power_state_(false), binding_(this) { if (interface_provider) { device::mojom::PowerMonitorPtr power_monitor; - interface_provider->GetInterface(mojo::GetProxy(&power_monitor)); + interface_provider->GetInterface(mojo::MakeRequest(&power_monitor)); power_monitor->SetClient(binding_.CreateInterfacePtrAndBind()); } }
diff --git a/device/serial/serial_service_unittest.cc b/device/serial/serial_service_unittest.cc index 7e4405a..8c72f6f 100644 --- a/device/serial/serial_service_unittest.cc +++ b/device/serial/serial_service_unittest.cc
@@ -86,15 +86,15 @@ base::Unretained(this)), base::ThreadTaskRunnerHandle::Get()), base::MakeUnique<FakeSerialDeviceEnumerator>()), - mojo::GetProxy(&service)); + mojo::MakeRequest(&service)); mojo::InterfacePtr<serial::Connection> connection; mojo::InterfacePtr<serial::DataSink> sink; mojo::InterfacePtr<serial::DataSource> source; mojo::InterfacePtr<serial::DataSourceClient> source_client; - mojo::GetProxy(&source_client); + mojo::MakeRequest(&source_client); service->Connect(path, serial::ConnectionOptions::New(), - mojo::GetProxy(&connection), mojo::GetProxy(&sink), - mojo::GetProxy(&source), std::move(source_client)); + mojo::MakeRequest(&connection), mojo::MakeRequest(&sink), + mojo::MakeRequest(&source), std::move(source_client)); connection.set_connection_error_handler(base::Bind( &SerialServiceTest::OnConnectionError, base::Unretained(this))); expecting_error_ = !expecting_success; @@ -120,7 +120,7 @@ TEST_F(SerialServiceTest, GetDevices) { mojo::InterfacePtr<serial::SerialService> service; - SerialServiceImpl::Create(NULL, NULL, mojo::GetProxy(&service)); + SerialServiceImpl::Create(NULL, NULL, mojo::MakeRequest(&service)); service.set_connection_error_handler(base::Bind( &SerialServiceTest::OnConnectionError, base::Unretained(this))); mojo::Array<serial::DeviceInfoPtr> result;
diff --git a/device/usb/mojo/device_impl_unittest.cc b/device/usb/mojo/device_impl_unittest.cc index 5bb40e6..f4d8b933 100644 --- a/device/usb/mojo/device_impl_unittest.cc +++ b/device/usb/mojo/device_impl_unittest.cc
@@ -181,7 +181,7 @@ new DeviceImpl( mock_device_, DeviceInfo::From(static_cast<const UsbDevice&>(*mock_device_)), - permission_provider_.GetWeakPtr(), mojo::GetProxy(&proxy)); + permission_provider_.GetWeakPtr(), mojo::MakeRequest(&proxy)); // Set up mock handle calls to respond based on mock device configs // established by the test.
diff --git a/device/usb/mojo/device_manager_impl_unittest.cc b/device/usb/mojo/device_manager_impl_unittest.cc index c0bd627e..13c7126 100644 --- a/device/usb/mojo/device_manager_impl_unittest.cc +++ b/device/usb/mojo/device_manager_impl_unittest.cc
@@ -50,7 +50,7 @@ DeviceManagerPtr ConnectToDeviceManager() { DeviceManagerPtr device_manager; DeviceManagerImpl::Create(permission_provider_.GetWeakPtr(), - mojo::GetProxy(&device_manager)); + mojo::MakeRequest(&device_manager)); return device_manager; } @@ -152,14 +152,14 @@ { base::RunLoop loop; DevicePtr device; - device_manager->GetDevice(mock_device->guid(), mojo::GetProxy(&device)); + device_manager->GetDevice(mock_device->guid(), mojo::MakeRequest(&device)); device->GetDeviceInfo(base::Bind(&ExpectDeviceInfoAndThen, mock_device->guid(), loop.QuitClosure())); loop.Run(); } DevicePtr bad_device; - device_manager->GetDevice("not a real guid", mojo::GetProxy(&bad_device)); + device_manager->GetDevice("not a real guid", mojo::MakeRequest(&bad_device)); { base::RunLoop loop;
diff --git a/device/vr/vr_device_manager_unittest.cc b/device/vr/vr_device_manager_unittest.cc index 29dfe593..4ca61ad 100644 --- a/device/vr/vr_device_manager_unittest.cc +++ b/device/vr/vr_device_manager_unittest.cc
@@ -59,7 +59,7 @@ std::unique_ptr<VRServiceImpl> VRDeviceManagerTest::BindService() { mojom::VRServiceClientPtr proxy; - FakeVRServiceClient client(mojo::GetProxy(&proxy)); + FakeVRServiceClient client(mojo::MakeRequest(&proxy)); auto service = base::WrapUnique(new VRServiceImpl()); service->SetClient(std::move(proxy), base::Bind(&VRDeviceManagerTest::onDisplaySynced,
diff --git a/device/vr/vr_display_impl.cc b/device/vr/vr_display_impl.cc index 7179c7d..b4025dd80 100644 --- a/device/vr/vr_display_impl.cc +++ b/device/vr/vr_display_impl.cc
@@ -18,7 +18,7 @@ mojom::VRDisplayInfoPtr display_info = device->GetVRDevice(); if (service->client()) { service->client()->OnDisplayConnected(binding_.CreateInterfacePtrAndBind(), - mojo::GetProxy(&client_), + mojo::MakeRequest(&client_), std::move(display_info)); } }
diff --git a/device/vr/vr_display_impl_unittest.cc b/device/vr/vr_display_impl_unittest.cc index 7230e50f..b2d2a36 100644 --- a/device/vr/vr_display_impl_unittest.cc +++ b/device/vr/vr_display_impl_unittest.cc
@@ -36,7 +36,7 @@ std::unique_ptr<VRServiceImpl> BindService() { mojom::VRServiceClientPtr proxy; - clients_.push_back(new FakeVRServiceClient(mojo::GetProxy(&proxy))); + clients_.push_back(new FakeVRServiceClient(mojo::MakeRequest(&proxy))); auto service = base::WrapUnique(new VRServiceImpl()); service->SetClient(std::move(proxy),
diff --git a/device/vr/vr_service_impl_unittest.cc b/device/vr/vr_service_impl_unittest.cc index 08ae927..6ad9062b 100644 --- a/device/vr/vr_service_impl_unittest.cc +++ b/device/vr/vr_service_impl_unittest.cc
@@ -30,7 +30,7 @@ std::unique_ptr<VRServiceImpl> BindService() { mojom::VRServiceClientPtr proxy; - FakeVRServiceClient client(mojo::GetProxy(&proxy)); + FakeVRServiceClient client(mojo::MakeRequest(&proxy)); auto service = base::WrapUnique(new VRServiceImpl()); service->SetClient(std::move(proxy), base::Bind(&VRServiceImplTest::onDisplaySynced,
diff --git a/extensions/browser/api/mime_handler_private/mime_handler_private_unittest.cc b/extensions/browser/api/mime_handler_private/mime_handler_private_unittest.cc index 47df5cb4..8058914 100644 --- a/extensions/browser/api/mime_handler_private/mime_handler_private_unittest.cc +++ b/extensions/browser/api/mime_handler_private/mime_handler_private_unittest.cc
@@ -51,7 +51,7 @@ service_binding_ = mojo::MakeStrongBinding(base::MakeUnique<MimeHandlerServiceImpl>( stream_container_->GetWeakPtr()), - mojo::GetProxy(&service_ptr_)); + mojo::MakeRequest(&service_ptr_)); } void TearDown() override { service_binding_->Close();
diff --git a/extensions/browser/mojo/keep_alive_impl_unittest.cc b/extensions/browser/mojo/keep_alive_impl_unittest.cc index cdd360cc..5373126f 100644 --- a/extensions/browser/mojo/keep_alive_impl_unittest.cc +++ b/extensions/browser/mojo/keep_alive_impl_unittest.cc
@@ -78,7 +78,7 @@ TEST_F(KeepAliveTest, Basic) { mojo::InterfacePtr<KeepAlive> keep_alive; - CreateKeepAlive(mojo::GetProxy(&keep_alive)); + CreateKeepAlive(mojo::MakeRequest(&keep_alive)); EXPECT_EQ(1, GetKeepAliveCount()); keep_alive.reset(); @@ -88,11 +88,11 @@ TEST_F(KeepAliveTest, TwoKeepAlives) { mojo::InterfacePtr<KeepAlive> keep_alive; - CreateKeepAlive(mojo::GetProxy(&keep_alive)); + CreateKeepAlive(mojo::MakeRequest(&keep_alive)); EXPECT_EQ(1, GetKeepAliveCount()); mojo::InterfacePtr<KeepAlive> other_keep_alive; - CreateKeepAlive(mojo::GetProxy(&other_keep_alive)); + CreateKeepAlive(mojo::MakeRequest(&other_keep_alive)); EXPECT_EQ(2, GetKeepAliveCount()); keep_alive.reset(); @@ -106,7 +106,7 @@ TEST_F(KeepAliveTest, UnloadExtension) { mojo::InterfacePtr<KeepAlive> keep_alive; - CreateKeepAlive(mojo::GetProxy(&keep_alive)); + CreateKeepAlive(mojo::MakeRequest(&keep_alive)); EXPECT_EQ(1, GetKeepAliveCount()); scoped_refptr<const Extension> other_extension = @@ -149,7 +149,7 @@ TEST_F(KeepAliveTest, Shutdown) { mojo::InterfacePtr<KeepAlive> keep_alive; - CreateKeepAlive(mojo::GetProxy(&keep_alive)); + CreateKeepAlive(mojo::MakeRequest(&keep_alive)); EXPECT_EQ(1, GetKeepAliveCount()); ExtensionRegistry::Get(browser_context())->Shutdown();
diff --git a/extensions/renderer/api/display_source/wifi_display/wifi_display_media_pipeline.cc b/extensions/renderer/api/display_source/wifi_display/wifi_display_media_pipeline.cc index a36855f..95038c8 100644 --- a/extensions/renderer/api/display_source/wifi_display/wifi_display_media_pipeline.cc +++ b/extensions/renderer/api/display_source/wifi_display/wifi_display_media_pipeline.cc
@@ -133,7 +133,7 @@ break; case InitializationStep::MEDIA_SERVICE: service_callback_.Run( - mojo::GetProxy(&media_service_), + mojo::MakeRequest(&media_service_), base::Bind(&WiFiDisplayMediaPipeline::OnMediaServiceRegistered, weak_factory_.GetWeakPtr(), callback)); break;
diff --git a/ios/BUILD.gn b/ios/BUILD.gn index feff75c..a3f2f48 100644 --- a/ios/BUILD.gn +++ b/ios/BUILD.gn
@@ -29,13 +29,14 @@ # List all the targets that need to be build on iOS by default. "//ios/chrome/app:chrome", "//ios/chrome/app:chrome_clean_skeleton", + "//ios/showcase", "//ios/web/shell:ios_web_shell", # List all the test targets that need to be build on iOS by default. "//ios/chrome/test:all_tests", "//ios/chrome/test/earl_grey:all_tests", "//ios/net:all_tests", - "//ios/showcase/test:all_tests", + "//ios/showcase:all_tests", "//ios/testing:all_tests", "//ios/web:all_tests", "//ios/web/shell/test:all_tests",
diff --git a/ios/chrome/browser/ui/settings/autofill_settings_egtest.mm b/ios/chrome/browser/ui/settings/autofill_settings_egtest.mm index 799c445..41f8d9e4 100644 --- a/ios/chrome/browser/ui/settings/autofill_settings_egtest.mm +++ b/ios/chrome/browser/ui/settings/autofill_settings_egtest.mm
@@ -145,7 +145,7 @@ // Close the settings. - (void)exitSettingsMenu { - NSString* backButtonA11yId = @"back_bar_button"; + NSString* backButtonA11yId = @"ic_arrow_back"; [[EarlGrey selectElementWithMatcher:grey_allOf( grey_accessibilityID(backButtonA11yId),
diff --git a/ios/chrome/browser/ui/settings/block_popups_egtest.mm b/ios/chrome/browser/ui/settings/block_popups_egtest.mm index c566ecc..4858d8f90 100644 --- a/ios/chrome/browser/ui/settings/block_popups_egtest.mm +++ b/ios/chrome/browser/ui/settings/block_popups_egtest.mm
@@ -81,13 +81,13 @@ void CloseSettings() { [[EarlGrey selectElementWithMatcher:grey_allOf( - grey_accessibilityID(@"back_bar_button"), + grey_accessibilityID(@"ic_arrow_back"), grey_accessibilityTrait( UIAccessibilityTraitButton), nil)] performAction:grey_tap()]; [[EarlGrey selectElementWithMatcher:grey_allOf( - grey_accessibilityID(@"back_bar_button"), + grey_accessibilityID(@"ic_arrow_back"), grey_accessibilityTrait( UIAccessibilityTraitButton), nil)] performAction:grey_tap()];
diff --git a/ios/chrome/browser/ui/settings/settings_egtest.mm b/ios/chrome/browser/ui/settings/settings_egtest.mm index 41b8fce..32eede47 100644 --- a/ios/chrome/browser/ui/settings/settings_egtest.mm +++ b/ios/chrome/browser/ui/settings/settings_egtest.mm
@@ -273,11 +273,11 @@ performAction:grey_tap()]; } -// Closes the a sub-settings menu, and then the general Settings menu. +// Closes a sub-settings menu, and then the general Settings menu. - (void)closeSubSettingsMenu { [[EarlGrey selectElementWithMatcher:grey_allOf( - grey_accessibilityID(@"back_bar_button"), + grey_accessibilityID(@"ic_arrow_back"), grey_accessibilityTrait( UIAccessibilityTraitButton), nil)] performAction:grey_tap()];
diff --git a/ios/chrome/browser/ui/settings/settings_navigation_controller.mm b/ios/chrome/browser/ui/settings/settings_navigation_controller.mm index 8c4e774e..7940e97 100644 --- a/ios/chrome/browser/ui/settings/settings_navigation_controller.mm +++ b/ios/chrome/browser/ui/settings/settings_navigation_controller.mm
@@ -78,6 +78,11 @@ // Closes the settings by calling |closeSettings| on |delegate|. - (void)closeSettings; +// Creates an autoreleased Back button for a UINavigationItem which will pop the +// top view controller when it is pressed. Should only be called by view +// controllers owned by SettingsNavigationController. +- (UIBarButtonItem*)backButton; + // Creates an autoreleased "X" button that closes the settings when tapped. - (UIBarButtonItem*)closeButton; @@ -319,6 +324,10 @@ [delegate_ closeSettings]; } +- (void)back { + [self popViewControllerAnimated:YES]; +} + - (void)popViewControllerOrCloseSettingsAnimated:(BOOL)animated { if (self.viewControllers.count > 1) { // Pop the top view controller to reveal the view controller underneath. @@ -351,6 +360,14 @@ [[rightButton title] compare:[doneButton title]] == NSOrderedSame; } +- (UIBarButtonItem*)backButton { + // Create a custom Back bar button item, as Material Navigation Bar deprecated + // the back arrow with a shaft. + return [ChromeIcon templateBarButtonItemWithImage:[ChromeIcon backIcon] + target:self + action:@selector(back)]; +} + - (UIBarButtonItem*)doneButton { // Create a custom Done bar button item, as Material Navigation Bar does not // handle a system UIBarButtonSystemItemDone item. @@ -408,6 +425,12 @@ - (void)pushViewController:(UIViewController*)viewController animated:(BOOL)animated { + // Add a back button if the view controller is not the root view controller + // and doesn’t already have a left bar button item. + if (self.viewControllers.count > 0 && + viewController.navigationItem.leftBarButtonItems.count == 0) { + viewController.navigationItem.leftBarButtonItem = [self backButton]; + } // Wrap the view controller in an MDCAppBarContainerViewController if needed. [super pushViewController:[self wrappedControllerIfNeeded:viewController] animated:animated];
diff --git a/ios/chrome/browser/ui/settings/translate_ui_egtest.mm b/ios/chrome/browser/ui/settings/translate_ui_egtest.mm index a321e3b0..f806a808 100644 --- a/ios/chrome/browser/ui/settings/translate_ui_egtest.mm +++ b/ios/chrome/browser/ui/settings/translate_ui_egtest.mm
@@ -58,13 +58,13 @@ // Close settings. [[EarlGrey selectElementWithMatcher:grey_allOf( - grey_accessibilityID(@"back_bar_button"), + grey_accessibilityID(@"ic_arrow_back"), grey_accessibilityTrait( UIAccessibilityTraitButton), nil)] performAction:grey_tap()]; [[EarlGrey selectElementWithMatcher:grey_allOf( - grey_accessibilityID(@"back_bar_button"), + grey_accessibilityID(@"ic_arrow_back"), grey_accessibilityTrait( UIAccessibilityTraitButton), nil)] performAction:grey_tap()];
diff --git a/ios/chrome/browser/ui/tab_switcher/tab_switcher_panel_overlay_view.mm b/ios/chrome/browser/ui/tab_switcher/tab_switcher_panel_overlay_view.mm index 57eed01..f92c4e0 100644 --- a/ios/chrome/browser/ui/tab_switcher/tab_switcher_panel_overlay_view.mm +++ b/ios/chrome/browser/ui/tab_switcher/tab_switcher_panel_overlay_view.mm
@@ -154,7 +154,7 @@ @"V:|-0-[title]-12-[subtitle]-48-[button]-0-|", @"V:[subtitle]-35-[floatingButton(==48)]-0-|", @"V:[subtitle]-24-[activityIndicator]", @"H:|-[title]-|", - @"H:|-[subtitle]-|", @"H:[button(==180)]", @"H:[floatingButton(==48)]" + @"H:|-[subtitle]-|", @"H:[button(>=180)]", @"H:[floatingButton(==48)]" ]; ApplyVisualConstraints(constraints, viewsDictionary, _container);
diff --git a/ios/showcase/BUILD.gn b/ios/showcase/BUILD.gn new file mode 100644 index 0000000..019fad1 --- /dev/null +++ b/ios/showcase/BUILD.gn
@@ -0,0 +1,63 @@ +# Copyright 2016 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import("//build/config/ios/rules.gni") +import("//ios/build/chrome_build.gni") +import("//ios/build/config.gni") +import("//ios/third_party/earl_grey/ios_eg_test.gni") + +ios_app_bundle("showcase") { + info_plist = "core/Info.plist" + extra_substitutions = [ "IOS_BUNDLE_ID_PREFIX=$ios_app_bundle_id_prefix" ] + output_name = "Showcase" + deps = [ + ":features", + "//ios/showcase/core:main", + + # All shared libraries must have the sanitizer deps to properly link in + # asan mode (this target will be empty in other cases). + "//build/config/sanitizers:deps", + ] + bundle_deps = [ ":launchscreen_storyboard" ] + assert_no_deps = ios_assert_no_deps +} + +group("features") { + deps = [ + "//ios/chrome/browser/ui/tools:tools_ui", + "//ios/showcase/settings", + "//ios/showcase/tab_grid", + "//ios/showcase/uikit_table_view_cell", + ] +} + +group("all_tests") { + testonly = true + deps = [ + ":ios_showcase_egtests", + ] +} + +ios_eg_test("ios_showcase_egtests") { + info_plist = "core/Info.plist" + extra_substitutions = [ "IOS_BUNDLE_ID_PREFIX=$ios_app_bundle_id_prefix" ] + deps = [ + ":features", + "//ios/showcase/core:main", + + # Add all eg_tests targets below. + "//ios/showcase/core:eg_tests", + "//ios/showcase/tab_grid:eg_tests", + + # All shared libraries must have the sanitizer deps to properly link in + # asan mode (this target will be empty in other cases). + "//build/config/sanitizers:deps", + ] + bundle_deps = [ ":launchscreen_storyboard" ] + assert_no_deps = ios_assert_no_deps +} + +bundle_data_ib_file("launchscreen_storyboard") { + source = "core/LaunchScreen.storyboard" +}
diff --git a/ios/showcase/DEPS b/ios/showcase/DEPS new file mode 100644 index 0000000..7c1c1afa --- /dev/null +++ b/ios/showcase/DEPS
@@ -0,0 +1,3 @@ +include_rules = [ + "+ios/chrome", +]
diff --git a/ios/showcase/OWNERS b/ios/showcase/OWNERS new file mode 100644 index 0000000..4bb62eb --- /dev/null +++ b/ios/showcase/OWNERS
@@ -0,0 +1 @@ +lpromero@chromium.org
diff --git a/ios/showcase/common/BUILD.gn b/ios/showcase/common/BUILD.gn new file mode 100644 index 0000000..3a469136 --- /dev/null +++ b/ios/showcase/common/BUILD.gn
@@ -0,0 +1,11 @@ +# Copyright 2016 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +source_set("common") { + sources = [ + "coordinator.h", + ] + libs = [ "Foundation.framework" ] + configs += [ "//build/config/compiler:enable_arc" ] +}
diff --git a/ios/showcase/common/coordinator.h b/ios/showcase/common/coordinator.h new file mode 100644 index 0000000..d044a03 --- /dev/null +++ b/ios/showcase/common/coordinator.h
@@ -0,0 +1,24 @@ +// Copyright 2016 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef IOS_SHOWCASE_COMMON_COORDINATOR_H_ +#define IOS_SHOWCASE_COMMON_COORDINATOR_H_ + +#import <Foundation/Foundation.h> + +// This protocol is the common interface to the simple non-production +// coordinators that will initialize, set up and present production view +// controllers, usually with completely mocked data. +@protocol Coordinator<NSObject> + +// The base view controller used to present the view controller that this +// coordinator drives. +@property(nonatomic, weak) UIViewController* baseViewController; + +// Typically, this initializes a view controller, sets it up and presents it. +- (void)start; + +@end + +#endif // IOS_SHOWCASE_COMMON_COORDINATOR_H_
diff --git a/ios/showcase/core/BUILD.gn b/ios/showcase/core/BUILD.gn new file mode 100644 index 0000000..91485ef --- /dev/null +++ b/ios/showcase/core/BUILD.gn
@@ -0,0 +1,43 @@ +# Copyright 2016 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +source_set("core") { + sources = [ + "app_delegate.h", + "app_delegate.mm", + "showcase_model.h", + "showcase_model.mm", + "showcase_view_controller.h", + "showcase_view_controller.mm", + ] + deps = [ + "//base", + "//ios/showcase/common", + ] + libs = [ "UIKit.framework" ] + configs += [ "//build/config/compiler:enable_arc" ] +} + +source_set("main") { + sources = [ + "main.mm", + ] + deps = [ + ":core", + ] + libs = [ "UIKit.framework" ] + configs += [ "//build/config/compiler:enable_arc" ] +} + +source_set("eg_tests") { + testonly = true + sources = [ + "showcase_egtest.mm", + ] + deps = [ + "//ios/showcase/test", + "//ios/third_party/earl_grey", + ] + configs += [ "//build/config/compiler:enable_arc" ] +}
diff --git a/ios/showcase/core/Info.plist b/ios/showcase/core/Info.plist new file mode 100644 index 0000000..6b028f7 --- /dev/null +++ b/ios/showcase/core/Info.plist
@@ -0,0 +1,41 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>CFBundleDevelopmentRegion</key> + <string>en</string> + <key>CFBundleExecutable</key> + <string>${EXECUTABLE_NAME}</string> + <key>CFBundleIdentifier</key> + <string>${IOS_BUNDLE_ID_PREFIX}.${PRODUCT_NAME:rfc1034identifier}</string> + <key>CFBundleInfoDictionaryVersion</key> + <string>6.0</string> + <key>CFBundleName</key> + <string>${PRODUCT_NAME}</string> + <key>CFBundlePackageType</key> + <string>APPL</string> + <key>CFBundleShortVersionString</key> + <string>1.0</string> + <key>CFBundleVersion</key> + <string>1</string> + <key>LSRequiresIPhoneOS</key> + <true/> + <key>UIFileSharingEnabled</key> + <true/> + <key>UILaunchStoryboardName</key> + <string>LaunchScreen</string> + <key>UISupportedInterfaceOrientations</key> + <array> + <string>UIInterfaceOrientationPortrait</string> + <string>UIInterfaceOrientationLandscapeLeft</string> + <string>UIInterfaceOrientationLandscapeRight</string> + </array> + <key>UISupportedInterfaceOrientations~ipad</key> + <array> + <string>UIInterfaceOrientationPortrait</string> + <string>UIInterfaceOrientationPortraitUpsideDown</string> + <string>UIInterfaceOrientationLandscapeLeft</string> + <string>UIInterfaceOrientationLandscapeRight</string> + </array> +</dict> +</plist>
diff --git a/ios/showcase/core/LaunchScreen.storyboard b/ios/showcase/core/LaunchScreen.storyboard new file mode 100644 index 0000000..11ca96a --- /dev/null +++ b/ios/showcase/core/LaunchScreen.storyboard
@@ -0,0 +1,47 @@ +<?xml version="1.0" encoding="UTF-8"?> +<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="11542" systemVersion="16B2657" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="QI3-dQ-1cO"> + <device id="retina5_5" orientation="portrait"> + <adaptation id="fullscreen"/> + </device> + <dependencies> + <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11524"/> + <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> + </dependencies> + <scenes> + <!--Navigation Controller--> + <scene sceneID="u0V-zC-FBB"> + <objects> + <navigationController id="QI3-dQ-1cO" sceneMemberID="viewController"> + <navigationBar key="navigationBar" contentMode="scaleToFill" id="ha0-fg-3GF"> + <rect key="frame" x="0.0" y="0.0" width="375" height="44"/> + <autoresizingMask key="autoresizingMask"/> + </navigationBar> + <connections> + <segue destination="54D-Ky-HgW" kind="relationship" relationship="rootViewController" id="sjH-IV-Bd0"/> + </connections> + </navigationController> + <placeholder placeholderIdentifier="IBFirstResponder" id="QaL-p0-lQo" userLabel="First Responder" sceneMemberID="firstResponder"/> + </objects> + <point key="canvasLocation" x="-513" y="-62"/> + </scene> + <!--Showcase--> + <scene sceneID="9lb-oL-wGX"> + <objects> + <viewController id="54D-Ky-HgW" sceneMemberID="viewController"> + <layoutGuides> + <viewControllerLayoutGuide type="top" id="trb-La-da6"/> + <viewControllerLayoutGuide type="bottom" id="MzX-hC-qOa"/> + </layoutGuides> + <view key="view" contentMode="scaleToFill" id="CAL-d9-rAz"> + <rect key="frame" x="0.0" y="0.0" width="414" height="736"/> + <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> + <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/> + </view> + <navigationItem key="navigationItem" title="Showcase" id="9hL-yr-6we"/> + </viewController> + <placeholder placeholderIdentifier="IBFirstResponder" id="o1d-CR-HVs" userLabel="First Responder" sceneMemberID="firstResponder"/> + </objects> + <point key="canvasLocation" x="386" y="-60"/> + </scene> + </scenes> +</document>
diff --git a/ios/showcase/core/app_delegate.h b/ios/showcase/core/app_delegate.h new file mode 100644 index 0000000..e8c3c34 --- /dev/null +++ b/ios/showcase/core/app_delegate.h
@@ -0,0 +1,16 @@ +// Copyright 2016 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef IOS_SHOWCASE_CORE_APP_DELEGATE_H_ +#define IOS_SHOWCASE_CORE_APP_DELEGATE_H_ + +#import <UIKit/UIKit.h> + +@interface AppDelegate : UIResponder<UIApplicationDelegate> + +@property(strong, nonatomic) UIWindow* window; + +@end + +#endif // IOS_SHOWCASE_CORE_APP_DELEGATE_H_
diff --git a/ios/showcase/core/app_delegate.mm b/ios/showcase/core/app_delegate.mm new file mode 100644 index 0000000..788d4a7 --- /dev/null +++ b/ios/showcase/core/app_delegate.mm
@@ -0,0 +1,41 @@ +// Copyright 2016 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#import "ios/showcase/core/app_delegate.h" + +#import "ios/showcase/core/showcase_model.h" +#import "ios/showcase/core/showcase_view_controller.h" + +#if !defined(__has_feature) || !__has_feature(objc_arc) +#error "This file requires ARC support." +#endif + +@implementation AppDelegate +@synthesize window = _window; + +- (BOOL)application:(UIApplication*)application + didFinishLaunchingWithOptions:(NSDictionary*)launchOptions { + // Override point for customization after application launch. + self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; + ShowcaseViewController* viewController = + [[ShowcaseViewController alloc] initWithRows:[self rowsToDisplay]]; + UINavigationController* navigationController = [[UINavigationController alloc] + initWithRootViewController:viewController]; + self.window.rootViewController = navigationController; + [self.window makeKeyAndVisible]; + return YES; +} + +#pragma mark - Private + +// Creates model data to display in the view controller. +- (NSArray<showcase::ModelRow*>*)rowsToDisplay { + NSArray<showcase::ModelRow*>* rows = [ShowcaseModel model]; + NSSortDescriptor* sortDescriptor = + [NSSortDescriptor sortDescriptorWithKey:showcase::kClassForDisplayKey + ascending:YES]; + return [rows sortedArrayUsingDescriptors:@[ sortDescriptor ]]; +} + +@end
diff --git a/ios/showcase/core/main.mm b/ios/showcase/core/main.mm new file mode 100644 index 0000000..ca3097d --- /dev/null +++ b/ios/showcase/core/main.mm
@@ -0,0 +1,17 @@ +// Copyright 2016 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#import <UIKit/UIKit.h> +#import "ios/showcase/core/app_delegate.h" + +#if !defined(__has_feature) || !__has_feature(objc_arc) +#error "This file requires ARC support." +#endif + +int main(int argc, char* argv[]) { + @autoreleasepool { + return UIApplicationMain(argc, argv, nil, + NSStringFromClass([AppDelegate class])); + } +}
diff --git a/ios/showcase/core/showcase_egtest.mm b/ios/showcase/core/showcase_egtest.mm new file mode 100644 index 0000000..f20dafcc --- /dev/null +++ b/ios/showcase/core/showcase_egtest.mm
@@ -0,0 +1,25 @@ +// Copyright 2016 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#import <EarlGrey/EarlGrey.h> + +#import "ios/showcase/test/showcase_test_case.h" + +#if !defined(__has_feature) || !__has_feature(objc_arc) +#error "This file requires ARC support." +#endif + +// Tests for the core of the Showcase app. +@interface ShowcaseCoreTestCase : ShowcaseTestCase +@end + +@implementation ShowcaseCoreTestCase + +// Tests that Showcase title appears after launch. +- (void)testLaunch { + [[EarlGrey selectElementWithMatcher:grey_text(@"Showcase")] + assertWithMatcher:grey_notNil()]; +} + +@end
diff --git a/ios/showcase/core/showcase_model.h b/ios/showcase/core/showcase_model.h new file mode 100644 index 0000000..3e1bed07 --- /dev/null +++ b/ios/showcase/core/showcase_model.h
@@ -0,0 +1,17 @@ +// Copyright 2016 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef IOS_SHOWCASE_CORE_SHOWCASE_MODEL_H_ +#define IOS_SHOWCASE_CORE_SHOWCASE_MODEL_H_ + +#import <Foundation/Foundation.h> + +#import "ios/showcase/core/showcase_view_controller.h" + +// Model object of rows to display in Showcase. +@interface ShowcaseModel : NSObject ++ (NSArray<showcase::ModelRow*>*)model; +@end + +#endif // IOS_SHOWCASE_CORE_SHOWCASE_MODEL_H_
diff --git a/ios/showcase/core/showcase_model.mm b/ios/showcase/core/showcase_model.mm new file mode 100644 index 0000000..158a897 --- /dev/null +++ b/ios/showcase/core/showcase_model.mm
@@ -0,0 +1,42 @@ +// Copyright 2016 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#import "ios/showcase/core/showcase_model.h" + +#if !defined(__has_feature) || !__has_feature(objc_arc) +#error "This file requires ARC support." +#endif + +@implementation ShowcaseModel + +// Insert additional rows in this array. All rows will be sorted upon +// import into Showcase. +// |kShowcaseClassForDisplayKey| and |kShowcaseClassForInstantiationKey| are +// required. |kShowcaseUseCaseKey| is optional. ++ (NSArray<showcase::ModelRow*>*)model { + return @[ + @{ + showcase::kClassForDisplayKey : @"SettingsViewController", + showcase::kClassForInstantiationKey : @"SettingsCoordinator", + showcase::kUseCaseKey : @"Main settings screen", + }, + @{ + showcase::kClassForDisplayKey : @"MenuViewController", + showcase::kClassForInstantiationKey : @"MenuViewController", + showcase::kUseCaseKey : @"Tools menu", + }, + @{ + showcase::kClassForDisplayKey : @"UITableViewCell", + showcase::kClassForInstantiationKey : @"UIKitTableViewCellViewController", + showcase::kUseCaseKey : @"UIKit Table Cells", + }, + @{ + showcase::kClassForDisplayKey : @"TabGridViewController", + showcase::kClassForInstantiationKey : @"SCTabGridCoordinator", + showcase::kUseCaseKey : @"Tab grid", + }, + ]; +} + +@end
diff --git a/ios/showcase/core/showcase_view_controller.h b/ios/showcase/core/showcase_view_controller.h new file mode 100644 index 0000000..b8b4f394 --- /dev/null +++ b/ios/showcase/core/showcase_view_controller.h
@@ -0,0 +1,39 @@ +// Copyright 2016 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef IOS_SHOWCASE_CORE_SHOWCASE_VIEW_CONTROLLER_H_ +#define IOS_SHOWCASE_CORE_SHOWCASE_VIEW_CONTROLLER_H_ + +#import <UIKit/UIKit.h> + +namespace showcase { + +// Required name for class that is intended to be tested. +extern NSString* const kClassForDisplayKey; + +// Required name for class that will be instantiated. +extern NSString* const kClassForInstantiationKey; + +// Optional description of the use case for the row. +extern NSString* const kUseCaseKey; + +// Type for one row of model. +typedef NSDictionary<NSString*, NSString*> ModelRow; + +} // namespace showcase + +// TableViewController that displays a searchable list of rows. +@interface ShowcaseViewController : UITableViewController +// Initializes the tableView with a list of rows. +- (instancetype)initWithRows:(NSArray<showcase::ModelRow*>*)rows + NS_DESIGNATED_INITIALIZER; + +- (instancetype)init NS_UNAVAILABLE; +- (instancetype)initWithCoder:(NSCoder*)aDecoder NS_UNAVAILABLE; +- (instancetype)initWithNibName:(NSString*)nibNameOrNil + bundle:(NSBundle*)nibBundleOrNil NS_UNAVAILABLE; +- (instancetype)initWithStyle:(UITableViewStyle)style NS_UNAVAILABLE; +@end + +#endif // IOS_SHOWCASE_CORE_SHOWCASE_VIEW_CONTROLLER_H_
diff --git a/ios/showcase/core/showcase_view_controller.mm b/ios/showcase/core/showcase_view_controller.mm new file mode 100644 index 0000000..6348724556 --- /dev/null +++ b/ios/showcase/core/showcase_view_controller.mm
@@ -0,0 +1,202 @@ +// Copyright 2016 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#import "ios/showcase/core/showcase_view_controller.h" + +#import "base/logging.h" +#import "ios/showcase/common/coordinator.h" + +#if !defined(__has_feature) || !__has_feature(objc_arc) +#error "This file requires ARC support." +#endif + +namespace showcase { + +NSString* const kClassForDisplayKey = @"classForDisplay"; +NSString* const kClassForInstantiationKey = @"classForInstantiation"; +NSString* const kUseCaseKey = @"useCase"; + +} // namespace showcase + +@interface ShowcaseViewController ()<UITableViewDataSource, + UITableViewDelegate, + UISearchResultsUpdating> + +// Search controller that contains search bar. +@property(nonatomic, strong) UISearchController* searchController; + +// Full data set displayed when tableView is not filtered. +@property(nonatomic, strong) NSArray<showcase::ModelRow*>* allRows; + +// Displayed rows in tableView. +@property(nonatomic, strong) NSArray<showcase::ModelRow*>* displayedRows; + +// Selected coordinator. +@property(nonatomic, strong) id<Coordinator> activeCoordinator; + +@end + +@implementation ShowcaseViewController +@synthesize searchController = _searchController; +@synthesize allRows = _allRows; +@synthesize displayedRows = _displayedRows; +@synthesize activeCoordinator = _activeCoordinator; + +- (instancetype)initWithRows:(NSArray<showcase::ModelRow*>*)rows { + self = [super initWithStyle:UITableViewStylePlain]; + if (self) { + self.allRows = [rows copy]; + // Default to displaying all rows. + self.displayedRows = self.allRows; + } + return self; +} + +#pragma mark - UIViewController + +- (void)viewDidLoad { + [super viewDidLoad]; + + self.title = @"Showcase"; + self.tableView.tableFooterView = [[UIView alloc] init]; + self.tableView.rowHeight = 70.0; + + self.searchController = + [[UISearchController alloc] initWithSearchResultsController:nil]; + self.searchController.searchResultsUpdater = self; + self.searchController.dimsBackgroundDuringPresentation = NO; + self.tableView.tableHeaderView = self.searchController.searchBar; + + // Presentation of searchController will walk up the view controller hierarchy + // until it finds the root view controller or one that defines a presentation + // context. Make this class the presentation context so that the search + // controller does not present on top of the navigation controller. + self.definesPresentationContext = YES; +} + +- (void)viewDidAppear:(BOOL)animated { + [super viewDidAppear:animated]; + // Resets the current coordinator whenever the navigation controller pops + // back to this view controller. + self.activeCoordinator = nil; +} + +#pragma mark - Table view data source + +- (NSInteger)tableView:(UITableView*)tableView + numberOfRowsInSection:(NSInteger)section { + return self.displayedRows.count; +} + +- (UITableViewCell*)tableView:(UITableView*)tableView + cellForRowAtIndexPath:(NSIndexPath*)indexPath { + UITableViewCell* cell = [tableView dequeueReusableCellWithIdentifier:@"cell"]; + if (!cell) { + cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle + reuseIdentifier:@"cell"]; + cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator; + } + showcase::ModelRow* row = self.displayedRows[indexPath.row]; + cell.textLabel.text = row[showcase::kClassForDisplayKey]; + cell.detailTextLabel.text = row[showcase::kUseCaseKey]; + return cell; +} + +#pragma mark - Table view delegate + +- (void)tableView:(UITableView*)tableView + didSelectRowAtIndexPath:(NSIndexPath*)indexPath { + showcase::ModelRow* row = self.displayedRows[indexPath.row]; + Class classForInstantiation = + NSClassFromString(row[showcase::kClassForInstantiationKey]); + if ([classForInstantiation isSubclassOfClass:[UIViewController class]]) { + UIViewController* viewController = [[classForInstantiation alloc] init]; + viewController.title = row[showcase::kUseCaseKey]; + [self.navigationController pushViewController:viewController animated:YES]; + } else if ([classForInstantiation + conformsToProtocol:@protocol(Coordinator)]) { + self.activeCoordinator = [[classForInstantiation alloc] init]; + self.activeCoordinator.baseViewController = self.navigationController; + [self.activeCoordinator start]; + } else { + NOTREACHED(); + } +} + +#pragma mark - UISearchResultsUpdating + +- (void)updateSearchResultsForSearchController: + (UISearchController*)searchController { + [self filterContentForSearchText:searchController.searchBar.text]; +} + +#pragma mark - Private + +// Filters |allRows| for |searchText| and reloads the tableView with +// animation. If |searchText| is empty, tableView will be loaded with |allRows|. +- (void)filterContentForSearchText:(NSString*)searchText { + NSArray<showcase::ModelRow*>* newFilteredRows = self.allRows; + + if (![self.searchController.searchBar.text isEqualToString:@""]) { + // The search is case-insensitive and searches both displayed texts. + NSIndexSet* matchingRows = + [self.allRows indexesOfObjectsPassingTest:^BOOL( + showcase::ModelRow* row, NSUInteger idx, BOOL* stop) { + return [row[showcase::kClassForDisplayKey] + localizedCaseInsensitiveContainsString:searchText] || + [row[showcase::kUseCaseKey] + localizedCaseInsensitiveContainsString:searchText]; + }]; + newFilteredRows = [self.allRows objectsAtIndexes:matchingRows]; + } + + NSArray<NSIndexPath*>* indexPathsToInsert = + [self indexPathsToInsertFromArray:self.displayedRows + toArray:newFilteredRows + indexPathSection:0]; + NSArray<NSIndexPath*>* indexPathsToDelete = + [self indexPathsToDeleteFromArray:self.displayedRows + toArray:newFilteredRows + indexPathSection:0]; + + [self.tableView beginUpdates]; + [self.tableView insertRowsAtIndexPaths:indexPathsToInsert + withRowAnimation:UITableViewRowAnimationFade]; + [self.tableView deleteRowsAtIndexPaths:indexPathsToDelete + withRowAnimation:UITableViewRowAnimationFade]; + self.displayedRows = newFilteredRows; + [self.tableView endUpdates]; +} + +// Returns indexPaths that need to be inserted into the tableView. +- (NSArray<NSIndexPath*>*)indexPathsToInsertFromArray:(NSArray*)fromArray + toArray:(NSArray*)toArray + indexPathSection:(NSUInteger)section { + NSMutableArray<NSIndexPath*>* indexPathsToInsert = + [[NSMutableArray alloc] init]; + for (NSUInteger row = 0; row < toArray.count; row++) { + if (![fromArray containsObject:toArray[row]]) { + [indexPathsToInsert + addObject:[NSIndexPath indexPathForRow:row inSection:section]]; + } + } + return indexPathsToInsert; +} + +// Returns indexPaths that need to be deleted from the tableView. +- (NSArray<NSIndexPath*>*)indexPathsToDeleteFromArray:(NSArray*)fromArray + toArray:(NSArray*)toArray + indexPathSection:(NSUInteger)section { + NSMutableArray<NSIndexPath*>* indexPathsToDelete = + [[NSMutableArray alloc] init]; + for (NSUInteger row = 0; row < fromArray.count; row++) { + if (![toArray containsObject:fromArray[row]]) { + [indexPathsToDelete + addObject:[NSIndexPath indexPathForRow:row inSection:section]]; + } + } + return indexPathsToDelete; +} + +@end
diff --git a/ios/showcase/settings/BUILD.gn b/ios/showcase/settings/BUILD.gn new file mode 100644 index 0000000..6810351 --- /dev/null +++ b/ios/showcase/settings/BUILD.gn
@@ -0,0 +1,16 @@ +# Copyright 2016 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +source_set("settings") { + sources = [ + "settings_coordinator.h", + "settings_coordinator.mm", + ] + deps = [ + "//base", + "//ios/showcase/common", + ] + libs = [ "UIKit.framework" ] + configs += [ "//build/config/compiler:enable_arc" ] +}
diff --git a/ios/showcase/settings/settings_coordinator.h b/ios/showcase/settings/settings_coordinator.h new file mode 100644 index 0000000..d1036b80 --- /dev/null +++ b/ios/showcase/settings/settings_coordinator.h
@@ -0,0 +1,19 @@ +// Copyright 2016 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef IOS_SHOWCASE_SETTINGS_SETTINGS_COORDINATOR_H_ +#define IOS_SHOWCASE_SETTINGS_SETTINGS_COORDINATOR_H_ + +#import <UIKit/UIKit.h> + +#import "ios/showcase/common/coordinator.h" + +@interface SettingsCoordinator : NSObject<Coordinator> + +// Redefined to be a UINavigationController. +@property(nonatomic, weak) UINavigationController* baseViewController; + +@end + +#endif // IOS_SHOWCASE_SETTINGS_SETTINGS_COORDINATOR_H_
diff --git a/ios/showcase/settings/settings_coordinator.mm b/ios/showcase/settings/settings_coordinator.mm new file mode 100644 index 0000000..8e28d44 --- /dev/null +++ b/ios/showcase/settings/settings_coordinator.mm
@@ -0,0 +1,22 @@ +// Copyright 2016 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#import "ios/showcase/settings/settings_coordinator.h" + +#if !defined(__has_feature) || !__has_feature(objc_arc) +#error "This file requires ARC support." +#endif + +@implementation SettingsCoordinator + +@synthesize baseViewController; + +- (void)start { + UIViewController* settings = [[UIViewController alloc] init]; + settings.title = @"Settings"; + settings.view.backgroundColor = [UIColor grayColor]; + [self.baseViewController pushViewController:settings animated:YES]; +} + +@end
diff --git a/ios/showcase/tab_grid/BUILD.gn b/ios/showcase/tab_grid/BUILD.gn new file mode 100644 index 0000000..8f0eb14 --- /dev/null +++ b/ios/showcase/tab_grid/BUILD.gn
@@ -0,0 +1,29 @@ +# Copyright 2016 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +source_set("tab_grid") { + sources = [ + "sc_tab_grid_coordinator.h", + "sc_tab_grid_coordinator.mm", + ] + deps = [ + "//base", + "//ios/chrome/browser/ui/tab_grid:tab_grid_ui", + "//ios/showcase/common", + ] + libs = [ "UIKit.framework" ] + configs += [ "//build/config/compiler:enable_arc" ] +} + +source_set("eg_tests") { + testonly = true + sources = [ + "sc_tab_grid_egtest.mm", + ] + deps = [ + "//ios/showcase/test", + "//ios/third_party/earl_grey", + ] + configs += [ "//build/config/compiler:enable_arc" ] +}
diff --git a/ios/showcase/tab_grid/sc_tab_grid_coordinator.h b/ios/showcase/tab_grid/sc_tab_grid_coordinator.h new file mode 100644 index 0000000..0ae9780 --- /dev/null +++ b/ios/showcase/tab_grid/sc_tab_grid_coordinator.h
@@ -0,0 +1,17 @@ +// Copyright 2016 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef IOS_SHOWCASE_TAB_GRID_SC_TAB_GRID_COORDINATOR_H_ +#define IOS_SHOWCASE_TAB_GRID_SC_TAB_GRID_COORDINATOR_H_ + +#import <UIKit/UIKit.h> + +#import "ios/showcase/common/coordinator.h" + +@interface SCTabGridCoordinator : NSObject<Coordinator> +// Redefined to be a UINavigationController. +@property(nonatomic, weak) UINavigationController* baseViewController; +@end + +#endif // IOS_SHOWCASE_TAB_GRID_SC_TAB_GRID_COORDINATOR_H_
diff --git a/ios/showcase/tab_grid/sc_tab_grid_coordinator.mm b/ios/showcase/tab_grid/sc_tab_grid_coordinator.mm new file mode 100644 index 0000000..59cb68b --- /dev/null +++ b/ios/showcase/tab_grid/sc_tab_grid_coordinator.mm
@@ -0,0 +1,81 @@ +// Copyright 2016 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#import "ios/showcase/tab_grid/sc_tab_grid_coordinator.h" + +#import "base/format_macros.h" +#import "ios/chrome/browser/ui/tab_grid/tab_grid_view_controller.h" + +#if !defined(__has_feature) || !__has_feature(objc_arc) +#error "This file requires ARC support." +#endif + +@interface SCTabGridCoordinator ()<TabGridDataSource, TabGridActionDelegate> +@property(nonatomic, strong) TabGridViewController* viewController; +@end + +@implementation SCTabGridCoordinator +@synthesize baseViewController = _baseViewController; +@synthesize viewController = _viewController; + +- (void)start { + self.viewController = [[TabGridViewController alloc] init]; + self.viewController.title = @"Tab Grid"; + self.viewController.dataSource = self; + self.viewController.actionDelegate = self; + [self.baseViewController setHidesBarsOnSwipe:YES]; + [self.baseViewController pushViewController:self.viewController animated:YES]; +} + +#pragma mark - TabGridDataSource + +- (NSUInteger)numberOfTabsInTabGrid { + return 3; +} + +- (NSString*)titleAtIndex:(NSInteger)index { + return [NSString stringWithFormat:@"Tab %" PRIdNS, index]; +} + +#pragma mark - TabGridActionDelegate + +- (void)showTabAtIndexPath:(NSIndexPath*)indexPath { + [self + showAlertWithTitle:NSStringFromProtocol(@protocol(TabGridActionDelegate)) + message:[NSString + stringWithFormat:@"showTabAtIndexPath:%" PRIdNS, + indexPath.item]]; +} + +- (void)showTabGrid { + [self + showAlertWithTitle:NSStringFromProtocol(@protocol(TabGridActionDelegate)) + message:NSStringFromSelector(_cmd)]; +} + +- (void)showSettings { + [self + showAlertWithTitle:NSStringFromProtocol(@protocol(TabGridActionDelegate)) + message:NSStringFromSelector(_cmd)]; +} + +#pragma mark - Private + +// Helper to show simple alert. +- (void)showAlertWithTitle:(NSString*)title message:(NSString*)message { + UIAlertController* alertController = + [UIAlertController alertControllerWithTitle:title + message:message + preferredStyle:UIAlertControllerStyleAlert]; + UIAlertAction* action = + [UIAlertAction actionWithTitle:@"Done" + style:UIAlertActionStyleCancel + handler:nil]; + [alertController addAction:action]; + [self.baseViewController presentViewController:alertController + animated:YES + completion:nil]; +} + +@end
diff --git a/ios/showcase/tab_grid/sc_tab_grid_egtest.mm b/ios/showcase/tab_grid/sc_tab_grid_egtest.mm new file mode 100644 index 0000000..3521cbdb --- /dev/null +++ b/ios/showcase/tab_grid/sc_tab_grid_egtest.mm
@@ -0,0 +1,31 @@ +// Copyright 2016 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#import <EarlGrey/EarlGrey.h> + +#import "ios/showcase/test/showcase_test_case.h" + +#if !defined(__has_feature) || !__has_feature(objc_arc) +#error "This file requires ARC support." +#endif + +// Tests for the tab grid view controller. +@interface SCTabGridTestCase : ShowcaseTestCase +@end + +@implementation SCTabGridTestCase + +// Tests launching TabGridViewController and tapping a cell. +- (void)testLaunchAndTappingCell { + [[EarlGrey selectElementWithMatcher:grey_text(@"TabGridViewController")] + performAction:grey_tap()]; + [[EarlGrey selectElementWithMatcher:grey_text(@"Tab 0")] + performAction:grey_tap()]; + [[EarlGrey selectElementWithMatcher:grey_text(@"TabGridActionDelegate")] + assertWithMatcher:grey_notNil()]; + [[EarlGrey selectElementWithMatcher:grey_text(@"Done")] + performAction:grey_tap()]; +} + +@end
diff --git a/ios/showcase/test/BUILD.gn b/ios/showcase/test/BUILD.gn index f05c0ec..a38fe5f 100644 --- a/ios/showcase/test/BUILD.gn +++ b/ios/showcase/test/BUILD.gn
@@ -2,9 +2,18 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -# This empty target is there to help with upstreaming by removing a manual -# step from the process (updating the //ios:all target). It will be changed -# to a real target as part of upstreaming. -group("all_tests") { +source_set("test") { testonly = true + sources = [ + "showcase_test_case.h", + "showcase_test_case.mm", + ] + deps = [ + "//base", + "//ios/third_party/earl_grey", + ] + public_deps = [ + "//build/config/ios:xctest", + ] + configs += [ "//build/config/compiler:enable_arc" ] }
diff --git a/ios/showcase/test/showcase_test_case.h b/ios/showcase/test/showcase_test_case.h new file mode 100644 index 0000000..6fe97b8b --- /dev/null +++ b/ios/showcase/test/showcase_test_case.h
@@ -0,0 +1,14 @@ +// Copyright 2016 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef IOS_SHOWCASE_TEST_SHOWCASE_TEST_CASE_H_ +#define IOS_SHOWCASE_TEST_SHOWCASE_TEST_CASE_H_ + +#import <XCTest/XCTest.h> + +// Base class for all Showcase Earl Grey tests. +@interface ShowcaseTestCase : XCTestCase +@end + +#endif // IOS_SHOWCASE_TEST_SHOWCASE_TEST_CASE_H_
diff --git a/ios/showcase/test/showcase_test_case.mm b/ios/showcase/test/showcase_test_case.mm new file mode 100644 index 0000000..e4877f1 --- /dev/null +++ b/ios/showcase/test/showcase_test_case.mm
@@ -0,0 +1,31 @@ +// Copyright 2016 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#import "ios/showcase/test/showcase_test_case.h" + +#import <EarlGrey/EarlGrey.h> + +#import "base/logging.h" + +#if !defined(__has_feature) || !__has_feature(objc_arc) +#error "This file requires ARC support." +#endif + +@implementation ShowcaseTestCase + +// Overrides testInvocations so the set of tests run can be modified, as +// necessary. ++ (NSArray*)testInvocations { + NSError* error = nil; + [[EarlGrey selectElementWithMatcher:grey_systemAlertViewShown()] + assertWithMatcher:grey_nil() + error:&error]; + if (error != nil) { + LOG(ERROR) << "System alert view is present, so skipping all tests."; + return @[]; + } + return [super testInvocations]; +} + +@end
diff --git a/ios/showcase/uikit_table_view_cell/BUILD.gn b/ios/showcase/uikit_table_view_cell/BUILD.gn new file mode 100644 index 0000000..2db31ddb8 --- /dev/null +++ b/ios/showcase/uikit_table_view_cell/BUILD.gn
@@ -0,0 +1,12 @@ +# Copyright 2016 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +source_set("uikit_table_view_cell") { + sources = [ + "uikit_table_view_cell_view_controller.h", + "uikit_table_view_cell_view_controller.mm", + ] + libs = [ "UIKit.framework" ] + configs += [ "//build/config/compiler:enable_arc" ] +}
diff --git a/ios/showcase/uikit_table_view_cell/uikit_table_view_cell_view_controller.h b/ios/showcase/uikit_table_view_cell/uikit_table_view_cell_view_controller.h new file mode 100644 index 0000000..8d0c911 --- /dev/null +++ b/ios/showcase/uikit_table_view_cell/uikit_table_view_cell_view_controller.h
@@ -0,0 +1,13 @@ +// Copyright 2016 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef IOS_SHOWCASE_UIKIT_TABLE_VIEW_CELL_UIKIT_TABLE_VIEW_CELL_VIEW_CONTROLLER_H_ +#define IOS_SHOWCASE_UIKIT_TABLE_VIEW_CELL_UIKIT_TABLE_VIEW_CELL_VIEW_CONTROLLER_H_ + +#import <UIKit/UIKit.h> + +@interface UIKitTableViewCellViewController : UITableViewController +@end + +#endif // IOS_SHOWCASE_UIKIT_TABLE_VIEW_CELL_UIKIT_TABLE_VIEW_CELL_VIEW_CONTROLLER_H_
diff --git a/ios/showcase/uikit_table_view_cell/uikit_table_view_cell_view_controller.mm b/ios/showcase/uikit_table_view_cell/uikit_table_view_cell_view_controller.mm new file mode 100644 index 0000000..71a496b --- /dev/null +++ b/ios/showcase/uikit_table_view_cell/uikit_table_view_cell_view_controller.mm
@@ -0,0 +1,65 @@ +// Copyright 2016 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#import "ios/showcase/uikit_table_view_cell/uikit_table_view_cell_view_controller.h" + +#if !defined(__has_feature) || !__has_feature(objc_arc) +#error "This file requires ARC support." +#endif + +@implementation UIKitTableViewCellViewController + +- (void)viewDidLoad { + [super viewDidLoad]; + self.tableView.tableFooterView = [[UIView alloc] init]; + self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone; +} + +- (NSInteger)numberOfSectionsInTableView:(UITableView*)tableView { + return 4; +} + +- (NSInteger)tableView:(UITableView*)tableView + numberOfRowsInSection:(NSInteger)section { + return 1; +} + +- (NSString*)tableView:(UITableView*)tableView + titleForHeaderInSection:(NSInteger)section { + switch ([self styleForSection:section]) { + case UITableViewCellStyleDefault: + return @"Default Style"; + case UITableViewCellStyleValue1: + return @"Value 1 Style"; + case UITableViewCellStyleValue2: + return @"Value 2 Style"; + case UITableViewCellStyleSubtitle: + return @"Subtitle Style"; + } +} + +- (UITableViewCell*)tableView:(UITableView*)tableView + cellForRowAtIndexPath:(NSIndexPath*)indexPath { + UITableViewCellStyle style = [self styleForSection:indexPath.section]; + NSString* reuseIdentifier = @(style).stringValue; + UITableViewCell* cell = + [tableView dequeueReusableCellWithIdentifier:reuseIdentifier]; + if (!cell) { + cell = [[UITableViewCell alloc] initWithStyle:style + reuseIdentifier:reuseIdentifier]; + } + cell.textLabel.text = @"Text"; + cell.detailTextLabel.text = @"Detail Text"; + return cell; +} + +#pragma mark - Private + +- (UITableViewCellStyle)styleForSection:(NSInteger)section { + NSAssert(section >= 0, @""); + NSAssert(section < 4, @""); + return (UITableViewCellStyle)section; +} + +@end
diff --git a/ipc/ipc_channel.h b/ipc/ipc_channel.h index cb29d93d..1c0a89d 100644 --- a/ipc/ipc_channel.h +++ b/ipc/ipc_channel.h
@@ -122,7 +122,7 @@ void GetRemoteAssociatedInterface( mojo::AssociatedInterfacePtr<Interface>* proxy) { mojo::AssociatedInterfaceRequest<Interface> request = - mojo::GetProxy(proxy, GetAssociatedGroup()); + mojo::MakeRequest(proxy, GetAssociatedGroup()); GetGenericRemoteAssociatedInterface( Interface::Name_, request.PassHandle()); }
diff --git a/ipc/ipc_channel_mojo_unittest.cc b/ipc/ipc_channel_mojo_unittest.cc index 5c23ea3..9b28e39 100644 --- a/ipc/ipc_channel_mojo_unittest.cc +++ b/ipc/ipc_channel_mojo_unittest.cc
@@ -921,7 +921,7 @@ IPC::mojom::PingReceiverAssociatedPtr ping_receiver; proxy()->GetRemoteAssociatedInterface(&driver); driver->GetPingReceiver( - mojo::GetProxy(&ping_receiver, driver.associated_group())); + mojo::MakeRequest(&ping_receiver, driver.associated_group())); base::RunLoop loop; ping_receiver->Ping(loop.QuitClosure());
diff --git a/ipc/ipc_channel_proxy.h b/ipc/ipc_channel_proxy.h index 5c19476..970237f 100644 --- a/ipc/ipc_channel_proxy.h +++ b/ipc/ipc_channel_proxy.h
@@ -219,7 +219,7 @@ void GetRemoteAssociatedInterface( mojo::AssociatedInterfacePtr<Interface>* proxy) { mojo::AssociatedInterfaceRequest<Interface> request = - mojo::GetProxy(proxy, GetAssociatedGroup()); + mojo::MakeRequest(proxy, GetAssociatedGroup()); GetGenericRemoteAssociatedInterface(Interface::Name_, request.PassHandle()); }
diff --git a/ipc/ipc_sync_message_filter.h b/ipc/ipc_sync_message_filter.h index 4e3f9b8b..f38fd49 100644 --- a/ipc/ipc_sync_message_filter.h +++ b/ipc/ipc_sync_message_filter.h
@@ -56,7 +56,7 @@ void GetRemoteAssociatedInterface( mojo::AssociatedInterfacePtr<Interface>* proxy) { mojo::AssociatedInterfaceRequest<Interface> request = - mojo::GetProxy(proxy, &channel_associated_group_); + mojo::MakeRequest(proxy, &channel_associated_group_); GetGenericRemoteAssociatedInterface(Interface::Name_, request.PassHandle()); }
diff --git a/mash/task_viewer/task_viewer.cc b/mash/task_viewer/task_viewer.cc index ba22d0f2..3023a49 100644 --- a/mash/task_viewer/task_viewer.cc +++ b/mash/task_viewer/task_viewer.cc
@@ -319,7 +319,7 @@ service_manager::mojom::ServiceManagerListenerPtr listener; service_manager::mojom::ServiceManagerListenerRequest request = - GetProxy(&listener); + MakeRequest(&listener); service_manager->AddListener(std::move(listener)); catalog::mojom::CatalogPtr catalog;
diff --git a/mash/webtest/webtest.cc b/mash/webtest/webtest.cc index 338943ab..59273ab 100644 --- a/mash/webtest/webtest.cc +++ b/mash/webtest/webtest.cc
@@ -100,7 +100,7 @@ window->AddChild(content_area_); ui::mojom::WindowTreeClientPtr client; - view_->GetWindowTreeClient(GetProxy(&client)); + view_->GetWindowTreeClient(MakeRequest(&client)); const uint32_t embed_flags = 0; // Nothing special. aura::WindowPortMus::Get(content_area_) ->Embed(std::move(client), embed_flags, base::Bind(&EmbedCallback)); @@ -192,8 +192,8 @@ navigation::mojom::ViewPtr view; navigation::mojom::ViewClientPtr view_client; navigation::mojom::ViewClientRequest view_client_request = - GetProxy(&view_client); - view_factory->CreateView(std::move(view_client), GetProxy(&view)); + MakeRequest(&view_client); + view_factory->CreateView(std::move(view_client), MakeRequest(&view)); UI* ui = new UI(this, std::move(view), std::move(view_client_request)); views::Widget* window = views::Widget::CreateWindowWithContextAndBounds( ui, nullptr, gfx::Rect(50, 10, 600, 600));
diff --git a/media/mojo/clients/mojo_audio_decoder_unittest.cc b/media/mojo/clients/mojo_audio_decoder_unittest.cc index 0f9f022..7e8d8be1 100644 --- a/media/mojo/clients/mojo_audio_decoder_unittest.cc +++ b/media/mojo/clients/mojo_audio_decoder_unittest.cc
@@ -59,7 +59,7 @@ FROM_HERE, base::Bind(&MojoAudioDecoderTest::ConnectToService, base::Unretained(this), - base::Passed(mojo::GetProxy(&remote_audio_decoder)))); + base::Passed(mojo::MakeRequest(&remote_audio_decoder)))); mojo_audio_decoder_.reset(new MojoAudioDecoder( message_loop_.task_runner(), std::move(remote_audio_decoder))); }
diff --git a/media/mojo/clients/mojo_cdm_unittest.cc b/media/mojo/clients/mojo_cdm_unittest.cc index b5fc33f..2a8afa8 100644 --- a/media/mojo/clients/mojo_cdm_unittest.cc +++ b/media/mojo/clients/mojo_cdm_unittest.cc
@@ -58,7 +58,7 @@ void Initialize(const std::string& key_system, ExpectedResult expected_result) { mojom::ContentDecryptionModulePtr remote_cdm; - auto cdm_request = mojo::GetProxy(&remote_cdm); + auto cdm_request = mojo::MakeRequest(&remote_cdm); switch (expected_result) { case SUCCESS:
diff --git a/media/mojo/clients/mojo_renderer.cc b/media/mojo/clients/mojo_renderer.cc index 36f1125..119de624 100644 --- a/media/mojo/clients/mojo_renderer.cc +++ b/media/mojo/clients/mojo_renderer.cc
@@ -81,7 +81,7 @@ mojom::DemuxerStreamPtr audio_stream; if (audio) { audio_stream_.reset( - new MojoDemuxerStreamImpl(audio, GetProxy(&audio_stream))); + new MojoDemuxerStreamImpl(audio, MakeRequest(&audio_stream))); // Using base::Unretained(this) is safe because |this| owns // |audio_stream_|, and the error handler can't be invoked once // |audio_stream_| is destroyed. @@ -93,7 +93,7 @@ mojom::DemuxerStreamPtr video_stream; if (video) { video_stream_.reset( - new MojoDemuxerStreamImpl(video, GetProxy(&video_stream))); + new MojoDemuxerStreamImpl(video, MakeRequest(&video_stream))); // Using base::Unretained(this) is safe because |this| owns // |video_stream_|, and the error handler can't be invoked once // |video_stream_| is destroyed.
diff --git a/media/mojo/clients/mojo_renderer_unittest.cc b/media/mojo/clients/mojo_renderer_unittest.cc index 5dd2472..e710eb9 100644 --- a/media/mojo/clients/mojo_renderer_unittest.cc +++ b/media/mojo/clients/mojo_renderer_unittest.cc
@@ -66,7 +66,7 @@ mojo_cdm_service_context_.GetWeakPtr(), nullptr, nullptr, std::move(mock_renderer), MojoRendererService::InitiateSurfaceRequestCB(), - mojo::GetProxy(&remote_renderer)); + mojo::MakeRequest(&remote_renderer)); mojo_renderer_.reset( new MojoRenderer(message_loop_.task_runner(), @@ -174,7 +174,7 @@ mojo::MakeStrongBinding( base::MakeUnique<MojoCdmService>(mojo_cdm_service_context_.GetWeakPtr(), &cdm_factory_), - mojo::GetProxy(&remote_cdm_)); + mojo::MakeRequest(&remote_cdm_)); remote_cdm_->Initialize( kClearKeyKeySystem, "https://www.test.com", mojom::CdmConfig::From(CdmConfig()),
diff --git a/media/mojo/services/media_service_unittest.cc b/media/mojo/services/media_service_unittest.cc index c3156ad..8014454f 100644 --- a/media/mojo/services/media_service_unittest.cc +++ b/media/mojo/services/media_service_unittest.cc
@@ -83,13 +83,13 @@ auto registry = base::MakeUnique<service_manager::InterfaceRegistry>(std::string()); service_manager::mojom::InterfaceProviderPtr interfaces; - registry->Bind(GetProxy(&interfaces), service_manager::Identity(), + registry->Bind(MakeRequest(&interfaces), service_manager::Identity(), service_manager::InterfaceProviderSpec(), service_manager::Identity(), service_manager::InterfaceProviderSpec()); - media_service->CreateInterfaceFactory(mojo::GetProxy(&interface_factory_), - std::move(interfaces)); + media_service->CreateInterfaceFactory( + mojo::MakeRequest(&interface_factory_), std::move(interfaces)); run_loop_.reset(new base::RunLoop()); } @@ -106,7 +106,7 @@ void InitializeCdm(const std::string& key_system, bool expected_result, int cdm_id) { - interface_factory_->CreateCdm(mojo::GetProxy(&cdm_)); + interface_factory_->CreateCdm(mojo::MakeRequest(&cdm_)); EXPECT_CALL(*this, OnCdmInitializedInternal(expected_result, cdm_id)) .Times(Exactly(1)) @@ -122,13 +122,13 @@ void InitializeRenderer(const VideoDecoderConfig& video_config, bool expected_result) { interface_factory_->CreateRenderer(std::string(), - mojo::GetProxy(&renderer_)); + mojo::MakeRequest(&renderer_)); video_stream_.set_video_decoder_config(video_config); mojom::DemuxerStreamPtr video_stream_proxy; mojo_video_stream_.reset(new MojoDemuxerStreamImpl( - &video_stream_, GetProxy(&video_stream_proxy))); + &video_stream_, MakeRequest(&video_stream_proxy))); mojom::RendererClientAssociatedPtrInfo client_ptr_info; renderer_client_binding_.Bind(&client_ptr_info,
diff --git a/media/mojo/services/mojo_cdm_service.cc b/media/mojo/services/mojo_cdm_service.cc index 866a9e0..ab3ce9a 100644 --- a/media/mojo/services/mojo_cdm_service.cc +++ b/media/mojo/services/mojo_cdm_service.cc
@@ -205,7 +205,7 @@ // MojoDecryptorService takes a reference to the CDM, but it is still owned // by |this|. decryptor_.reset(new MojoDecryptorService( - cdm_, GetProxy(&decryptor_service), + cdm_, MakeRequest(&decryptor_service), base::Bind(&MojoCdmService::OnDecryptorConnectionError, weak_this_))); }
diff --git a/media/mojo/services/strong_binding_set_unittest.cc b/media/mojo/services/strong_binding_set_unittest.cc index eb0a6d9..fcdedc70 100644 --- a/media/mojo/services/strong_binding_set_unittest.cc +++ b/media/mojo/services/strong_binding_set_unittest.cc
@@ -47,12 +47,14 @@ protected: void AddBindings() { - binding_id_1_ = bindings_->AddBinding(base::MakeUnique<TestServiceImpl>(), - mojo::GetProxy(&test_service_ptr_1_)); + binding_id_1_ = + bindings_->AddBinding(base::MakeUnique<TestServiceImpl>(), + mojo::MakeRequest(&test_service_ptr_1_)); EXPECT_EQ(1, TestServiceImpl::instance_count); - binding_id_2_ = bindings_->AddBinding(base::MakeUnique<TestServiceImpl>(), - mojo::GetProxy(&test_service_ptr_2_)); + binding_id_2_ = + bindings_->AddBinding(base::MakeUnique<TestServiceImpl>(), + mojo::MakeRequest(&test_service_ptr_2_)); EXPECT_EQ(2, TestServiceImpl::instance_count); }
diff --git a/media/remoting/fake_remoting_controller.cc b/media/remoting/fake_remoting_controller.cc index 25f04540..aacd5ea 100644 --- a/media/remoting/fake_remoting_controller.cc +++ b/media/remoting/fake_remoting_controller.cc
@@ -178,11 +178,12 @@ bool start_will_fail) { mojom::RemotingSourcePtr remoting_source; mojom::RemotingSourceRequest remoting_source_request = - mojo::GetProxy(&remoting_source); + mojo::MakeRequest(&remoting_source); mojom::RemoterPtr remoter; std::unique_ptr<mojom::RemoterFactory> remoter_factory = base::MakeUnique<FakeRemoterFactory>(start_will_fail); - remoter_factory->Create(std::move(remoting_source), mojo::GetProxy(&remoter)); + remoter_factory->Create(std::move(remoting_source), + mojo::MakeRequest(&remoter)); return new RemotingSourceImpl(std::move(remoting_source_request), std::move(remoter)); }
diff --git a/media/remoting/remote_demuxer_stream_adapter_unittest.cc b/media/remoting/remote_demuxer_stream_adapter_unittest.cc index 70457ed..01f0c8cf 100644 --- a/media/remoting/remote_demuxer_stream_adapter_unittest.cc +++ b/media/remoting/remote_demuxer_stream_adapter_unittest.cc
@@ -94,7 +94,7 @@ mojo::CreateDataPipe(&data_pipe_options, &producer_end, &consumer_end)); data_stream_sender_.reset(new FakeRemotingDataStreamSender( - GetProxy(&stream_sender), std::move(consumer_end))); + MakeRequest(&stream_sender), std::move(consumer_end))); demuxer_stream_adapter_.reset(new MockRemoteDemuxerStreamAdapter( message_loop_.task_runner(), message_loop_.task_runner(), "test", demuxer_stream_.get(), stream_sender.PassInterface(),
diff --git a/media/remoting/remoting_cdm_factory.cc b/media/remoting/remoting_cdm_factory.cc index 83ecfff..e24b80a 100644 --- a/media/remoting/remoting_cdm_factory.cc +++ b/media/remoting/remoting_cdm_factory.cc
@@ -30,10 +30,10 @@ RemotingCdmFactory::CreateRemotingCdmController() { mojom::RemotingSourcePtr remoting_source; mojom::RemotingSourceRequest remoting_source_request = - mojo::GetProxy(&remoting_source); + mojo::MakeRequest(&remoting_source); mojom::RemoterPtr remoter; remoter_factory_->Create(std::move(remoting_source), - mojo::GetProxy(&remoter)); + mojo::MakeRequest(&remoter)); scoped_refptr<RemotingSourceImpl> remoting_source_impl = new RemotingSourceImpl(std::move(remoting_source_request), std::move(remoter));
diff --git a/media/remoting/remoting_source_impl.cc b/media/remoting/remoting_source_impl.cc index 9cd53e85..4f3bc35 100644 --- a/media/remoting/remoting_source_impl.cc +++ b/media/remoting/remoting_source_impl.cc
@@ -210,9 +210,9 @@ : mojo::ScopedDataPipeConsumerHandle(), video ? std::move(video_data_pipe->consumer_handle) : mojo::ScopedDataPipeConsumerHandle(), - audio ? mojo::GetProxy(&audio_stream_sender) + audio ? mojo::MakeRequest(&audio_stream_sender) : media::mojom::RemotingDataStreamSenderRequest(), - video ? mojo::GetProxy(&video_stream_sender) + video ? mojo::MakeRequest(&video_stream_sender) : media::mojom::RemotingDataStreamSenderRequest()); done_callback.Run(audio_stream_sender.PassInterface(), video_stream_sender.PassInterface(),
diff --git a/media/test/pipeline_integration_test.cc b/media/test/pipeline_integration_test.cc index cca20f6..57b6d96 100644 --- a/media/test/pipeline_integration_test.cc +++ b/media/test/pipeline_integration_test.cc
@@ -691,7 +691,7 @@ mojom::RendererPtr mojo_renderer; media_interface_factory_->CreateRenderer(std::string(), - mojo::GetProxy(&mojo_renderer)); + mojo::MakeRequest(&mojo_renderer)); return base::MakeUnique<MojoRenderer>(message_loop_.task_runner(), std::move(mojo_renderer));
diff --git a/mojo/common/common_custom_types_unittest.cc b/mojo/common/common_custom_types_unittest.cc index bf57d20..ecac166 100644 --- a/mojo/common/common_custom_types_unittest.cc +++ b/mojo/common/common_custom_types_unittest.cc
@@ -196,7 +196,7 @@ base::RunLoop run_loop; TestFilePathPtr ptr; - TestFilePathImpl impl(GetProxy(&ptr)); + TestFilePathImpl impl(MakeRequest(&ptr)); base::FilePath dir(FILE_PATH_LITERAL("hello")); base::FilePath file = dir.Append(FILE_PATH_LITERAL("world")); @@ -210,7 +210,7 @@ base::RunLoop run_loop; TestUnguessableTokenPtr ptr; - TestUnguessableTokenImpl impl(GetProxy(&ptr)); + TestUnguessableTokenImpl impl(MakeRequest(&ptr)); base::UnguessableToken token = base::UnguessableToken::Create(); @@ -223,7 +223,7 @@ base::RunLoop run_loop; TestTimePtr ptr; - TestTimeImpl impl(GetProxy(&ptr)); + TestTimeImpl impl(MakeRequest(&ptr)); base::Time t = base::Time::Now(); @@ -236,7 +236,7 @@ base::RunLoop run_loop; TestTimePtr ptr; - TestTimeImpl impl(GetProxy(&ptr)); + TestTimeImpl impl(MakeRequest(&ptr)); base::TimeDelta t = base::TimeDelta::FromDays(123); @@ -249,7 +249,7 @@ base::RunLoop run_loop; TestTimePtr ptr; - TestTimeImpl impl(GetProxy(&ptr)); + TestTimeImpl impl(MakeRequest(&ptr)); base::TimeTicks t = base::TimeTicks::Now(); @@ -260,7 +260,7 @@ TEST_F(CommonCustomTypesTest, Value) { TestValuePtr ptr; - TestValueImpl impl(GetProxy(&ptr)); + TestValueImpl impl(MakeRequest(&ptr)); base::DictionaryValue dict; dict.SetBoolean("bool", false); @@ -304,7 +304,7 @@ base::RunLoop run_loop; TestString16Ptr ptr; - TestString16Impl impl(GetProxy(&ptr)); + TestString16Impl impl(MakeRequest(&ptr)); base::string16 str16 = base::ASCIIToUTF16("hello world"); @@ -317,7 +317,7 @@ base::RunLoop run_loop; TestString16Ptr ptr; - TestString16Impl impl(GetProxy(&ptr)); + TestString16Impl impl(MakeRequest(&ptr)); base::string16 str16; @@ -331,7 +331,7 @@ ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); TestFilePtr ptr; - TestFileImpl impl(GetProxy(&ptr)); + TestFileImpl impl(MakeRequest(&ptr)); base::File file( temp_dir.GetPath().AppendASCII("test_file.txt"), @@ -356,7 +356,7 @@ TEST_F(CommonCustomTypesTest, InvalidFile) { TestFilePtr ptr; - TestFileImpl impl(GetProxy(&ptr)); + TestFileImpl impl(MakeRequest(&ptr)); base::ScopedTempDir temp_dir; ASSERT_TRUE(temp_dir.CreateUniqueTempDir());
diff --git a/mojo/edk/js/tests/js_to_cpp_tests.cc b/mojo/edk/js/tests/js_to_cpp_tests.cc index b4bddcbb..cfd9d646 100644 --- a/mojo/edk/js/tests/js_to_cpp_tests.cc +++ b/mojo/edk/js/tests/js_to_cpp_tests.cc
@@ -388,11 +388,11 @@ cpp_side->set_run_loop(&run_loop_); js_to_cpp::JsSidePtr js_side; - auto js_side_proxy = GetProxy(&js_side); + auto js_side_proxy = MakeRequest(&js_side); cpp_side->set_js_side(js_side.get()); js_to_cpp::CppSidePtr cpp_side_ptr; - cpp_side->Bind(GetProxy(&cpp_side_ptr)); + cpp_side->Bind(MakeRequest(&cpp_side_ptr)); js_side->SetCppSide(std::move(cpp_side_ptr));
diff --git a/mojo/public/cpp/bindings/associated_interface_ptr.h b/mojo/public/cpp/bindings/associated_interface_ptr.h index e5c068e2..e760c7d 100644 --- a/mojo/public/cpp/bindings/associated_interface_ptr.h +++ b/mojo/public/cpp/bindings/associated_interface_ptr.h
@@ -212,7 +212,7 @@ // as soon as the request is sent, |ptr| is usable. There is no need to wait // until the request is bound to an implementation at the remote side. template <typename Interface> -AssociatedInterfaceRequest<Interface> GetProxy( +AssociatedInterfaceRequest<Interface> MakeRequest( AssociatedInterfacePtr<Interface>* ptr, AssociatedGroup* group, scoped_refptr<base::SingleThreadTaskRunner> runner = @@ -228,7 +228,7 @@ // Creates an associated interface proxy in its own AssociatedGroup. template <typename Interface> -AssociatedInterfaceRequest<Interface> GetProxyForTesting( +AssociatedInterfaceRequest<Interface> MakeRequestForTesting( AssociatedInterfacePtr<Interface>* ptr, scoped_refptr<base::SingleThreadTaskRunner> runner = base::ThreadTaskRunnerHandle::Get()) { @@ -264,7 +264,7 @@ internal::MultiplexRouter::MULTI_INTERFACE, false, base::ThreadTaskRunnerHandle::Get()); std::unique_ptr<AssociatedGroup> group = router->CreateAssociatedGroup(); - GetProxy(proxy, group.get()); + MakeRequest(proxy, group.get()); } } // namespace mojo
diff --git a/mojo/public/cpp/bindings/binding_set.h b/mojo/public/cpp/bindings/binding_set.h index 0ae23889..473bc0c 100644 --- a/mojo/public/cpp/bindings/binding_set.h +++ b/mojo/public/cpp/bindings/binding_set.h
@@ -27,8 +27,8 @@ using ProxyType = InterfacePtr<Interface>; using RequestType = InterfaceRequest<Interface>; - static RequestType GetProxy(ProxyType* proxy) { - return mojo::GetProxy(proxy); + static RequestType MakeRequest(ProxyType* proxy) { + return mojo::MakeRequest(proxy); } }; @@ -114,7 +114,7 @@ ProxyType CreateInterfacePtrAndBind(Interface* impl, BindingId* id_storage = nullptr) { ProxyType proxy; - BindingId id = AddBinding(impl, Traits::GetProxy(&proxy)); + BindingId id = AddBinding(impl, Traits::MakeRequest(&proxy)); if (id_storage) *id_storage = id; return proxy;
diff --git a/mojo/public/cpp/bindings/interface_request.h b/mojo/public/cpp/bindings/interface_request.h index 5d75dd3e6..773e05db 100644 --- a/mojo/public/cpp/bindings/interface_request.h +++ b/mojo/public/cpp/bindings/interface_request.h
@@ -120,9 +120,9 @@ // // DatabasePtr database = ...; // Connect to database. // TablePtr table; -// database->OpenTable(GetProxy(&table)); +// database->OpenTable(MakeRequest(&table)); // -// Upon return from GetProxy, |table| is ready to have methods called on it. +// Upon return from MakeRequest, |table| is ready to have methods called on it. // // Example #2: Registering a local implementation with a remote service. // ===================================================================== @@ -136,12 +136,12 @@ // // CollectorPtr collector = ...; // Connect to Collector. // SourcePtr source; -// InterfaceRequest<Source> source_request = GetProxy(&source); +// InterfaceRequest<Source> source_request = MakeRequest(&source); // collector->RegisterSource(std::move(source)); // CreateSource(std::move(source_request)); // Create implementation locally. // template <typename Interface> -InterfaceRequest<Interface> GetProxy( +InterfaceRequest<Interface> MakeRequest( InterfacePtr<Interface>* ptr, scoped_refptr<base::SingleThreadTaskRunner> runner = base::ThreadTaskRunnerHandle::Get()) {
diff --git a/mojo/public/cpp/bindings/tests/associated_interface_unittest.cc b/mojo/public/cpp/bindings/tests/associated_interface_unittest.cc index 0bc12c20..1aeaa17 100644 --- a/mojo/public/cpp/bindings/tests/associated_interface_unittest.cc +++ b/mojo/public/cpp/bindings/tests/associated_interface_unittest.cc
@@ -552,11 +552,11 @@ TEST_F(AssociatedInterfaceTest, PassAssociatedInterfaces) { IntegerSenderConnectionPtr connection_ptr; - IntegerSenderConnectionImpl connection(GetProxy(&connection_ptr)); + IntegerSenderConnectionImpl connection(MakeRequest(&connection_ptr)); IntegerSenderAssociatedPtr sender0; connection_ptr->GetSender( - GetProxy(&sender0, connection_ptr.associated_group())); + MakeRequest(&sender0, connection_ptr.associated_group())); int32_t echoed_value = 0; base::RunLoop run_loop; @@ -581,11 +581,11 @@ TEST_F(AssociatedInterfaceTest, BindingWaitAndPauseWhenNoAssociatedInterfaces) { IntegerSenderConnectionPtr connection_ptr; - IntegerSenderConnectionImpl connection(GetProxy(&connection_ptr)); + IntegerSenderConnectionImpl connection(MakeRequest(&connection_ptr)); IntegerSenderAssociatedPtr sender0; connection_ptr->GetSender( - GetProxy(&sender0, connection_ptr.associated_group())); + MakeRequest(&sender0, connection_ptr.associated_group())); EXPECT_FALSE(connection.binding()->HasAssociatedInterfaces()); // There are no associated interfaces running on the pipe yet. It is okay to @@ -690,11 +690,11 @@ // binding in a group operates with its own set of filters. TEST_F(AssociatedInterfaceTest, BindingWithFilters) { AssociatedPingProviderPtr provider; - PingProviderImpl provider_impl(GetProxy(&provider)); + PingProviderImpl provider_impl(MakeRequest(&provider)); PingServiceAssociatedPtr ping_a, ping_b; - provider->GetPing(GetProxy(&ping_a, provider.associated_group())); - provider->GetPing(GetProxy(&ping_b, provider.associated_group())); + provider->GetPing(MakeRequest(&ping_a, provider.associated_group())); + provider->GetPing(MakeRequest(&ping_b, provider.associated_group())); provider_impl.WaitForBindings(2); ASSERT_EQ(2u, provider_impl.ping_services().size()); @@ -838,7 +838,7 @@ TEST_F(AssociatedInterfaceTest, BindingFlushForTesting) { IntegerSenderConnectionPtr ptr; - IntegerSenderConnectionImpl impl(GetProxy(&ptr)); + IntegerSenderConnectionImpl impl(MakeRequest(&ptr)); bool called = false; ptr->AsyncGetSender(base::Bind( &SetBoolWithUnusedParameter<IntegerSenderAssociatedPtrInfo>, &called)); @@ -854,7 +854,7 @@ TEST_F(AssociatedInterfaceTest, BindingFlushForTestingWithClosedPeer) { IntegerSenderConnectionPtr ptr; - IntegerSenderConnectionImpl impl(GetProxy(&ptr)); + IntegerSenderConnectionImpl impl(MakeRequest(&ptr)); bool called = false; impl.binding()->set_connection_error_handler(base::Bind(&SetBool, &called)); ptr.reset(); @@ -869,10 +869,10 @@ auto binding = MakeStrongBinding(base::MakeUnique<IntegerSenderConnectionImpl>( IntegerSenderConnectionRequest{}), - GetProxy(&ptr)); + MakeRequest(&ptr)); bool called = false; IntegerSenderAssociatedPtr sender_ptr; - ptr->GetSender(GetProxy(&sender_ptr, ptr.associated_group())); + ptr->GetSender(MakeRequest(&sender_ptr, ptr.associated_group())); sender_ptr->Echo(1, base::Bind(&SetBoolWithUnusedParameter<int>, &called)); EXPECT_FALSE(called); // Because the flush is sent from the binding, it only guarantees that the @@ -891,7 +891,7 @@ auto binding = MakeStrongBinding(base::MakeUnique<IntegerSenderConnectionImpl>( IntegerSenderConnectionRequest{}), - GetProxy(&ptr)); + MakeRequest(&ptr)); binding->set_connection_error_handler(base::Bind(&SetBool, &called)); ptr.reset(); EXPECT_FALSE(called); @@ -903,7 +903,7 @@ TEST_F(AssociatedInterfaceTest, PtrFlushForTesting) { IntegerSenderConnectionPtr ptr; - IntegerSenderConnectionImpl impl(GetProxy(&ptr)); + IntegerSenderConnectionImpl impl(MakeRequest(&ptr)); bool called = false; ptr.set_connection_error_handler(base::Bind(&Fail)); ptr->AsyncGetSender(base::Bind( @@ -915,7 +915,7 @@ TEST_F(AssociatedInterfaceTest, PtrFlushForTestingWithClosedPeer) { IntegerSenderConnectionPtr ptr; - GetProxy(&ptr); + MakeRequest(&ptr); bool called = false; ptr.set_connection_error_handler(base::Bind(&SetBool, &called)); EXPECT_FALSE(called); @@ -997,11 +997,11 @@ TEST_F(AssociatedInterfaceTest, ThreadSafeAssociatedInterfacePtr) { IntegerSenderConnectionPtr connection_ptr; - IntegerSenderConnectionImpl connection(GetProxy(&connection_ptr)); + IntegerSenderConnectionImpl connection(MakeRequest(&connection_ptr)); IntegerSenderAssociatedPtr sender; connection_ptr->GetSender( - GetProxy(&sender, connection_ptr.associated_group())); + MakeRequest(&sender, connection_ptr.associated_group())); scoped_refptr<ThreadSafeIntegerSenderAssociatedPtr> thread_safe_sender = ThreadSafeIntegerSenderAssociatedPtr::Create(std::move(sender)); @@ -1077,10 +1077,10 @@ // We are on the background thread, create the interface ptr. context->interface_impl = base::MakeUnique<IntegerSenderConnectionImpl>( - GetProxy(&(context->connection_ptr))); + MakeRequest(&(context->connection_ptr))); IntegerSenderAssociatedPtr sender; context->connection_ptr->GetSender( - GetProxy(&sender, context->connection_ptr.associated_group())); + MakeRequest(&sender, context->connection_ptr.associated_group())); thread_safe_ptr->Bind(std::move(sender)); main_task_runner->PostTask(FROM_HERE, quit_closure); },
diff --git a/mojo/public/cpp/bindings/tests/bind_task_runner_unittest.cc b/mojo/public/cpp/bindings/tests/bind_task_runner_unittest.cc index dab64f0..aa4dac7 100644 --- a/mojo/public/cpp/bindings/tests/bind_task_runner_unittest.cc +++ b/mojo/public/cpp/bindings/tests/bind_task_runner_unittest.cc
@@ -187,7 +187,7 @@ binding_task_runner_ = scoped_refptr<TestTaskRunner>(new TestTaskRunner); ptr_task_runner_ = scoped_refptr<TestTaskRunner>(new TestTaskRunner); - auto request = GetProxy(&ptr_, ptr_task_runner_); + auto request = MakeRequest(&ptr_, ptr_task_runner_); impl_.reset(new ImplType(std::move(request), binding_task_runner_)); } @@ -213,7 +213,7 @@ sender_ptr_task_runner_ = scoped_refptr<TestTaskRunner>(new TestTaskRunner); auto connection_request = - GetProxy(&connection_ptr_, connection_ptr_task_runner_); + MakeRequest(&connection_ptr_, connection_ptr_task_runner_); connection_impl_.reset(new IntegerSenderConnectionImpl( std::move(connection_request), connection_binding_task_runner_, sender_binding_task_runner_)); @@ -222,9 +222,9 @@ base::Bind(&AssociatedBindTaskRunnerTest::QuitTaskRunner, base::Unretained(this))); - connection_ptr_->GetSender(GetProxy(&sender_ptr_, - connection_ptr_.associated_group(), - sender_ptr_task_runner_)); + connection_ptr_->GetSender(MakeRequest(&sender_ptr_, + connection_ptr_.associated_group(), + sender_ptr_task_runner_)); connection_binding_task_runner_->Run(); }
diff --git a/mojo/public/cpp/bindings/tests/binding_callback_unittest.cc b/mojo/public/cpp/bindings/tests/binding_callback_unittest.cc index 02b082a..ad51580 100644 --- a/mojo/public/cpp/bindings/tests/binding_callback_unittest.cc +++ b/mojo/public/cpp/bindings/tests/binding_callback_unittest.cc
@@ -140,7 +140,7 @@ TEST_F(BindingCallbackTest, Basic) { // Create the ServerImpl and the Binding. InterfaceImpl server_impl; - Binding<sample::Provider> binding(&server_impl, GetProxy(&interface_ptr_)); + Binding<sample::Provider> binding(&server_impl, MakeRequest(&interface_ptr_)); // Initialize the test values. server_impl.resetLastServerValueSeen(); @@ -199,7 +199,8 @@ base::RunLoop run_loop; { // Create the binding in an inner scope so it can be deleted first. - Binding<sample::Provider> binding(&server_impl, GetProxy(&interface_ptr_)); + Binding<sample::Provider> binding(&server_impl, + MakeRequest(&interface_ptr_)); interface_ptr_.set_connection_error_handler(run_loop.QuitClosure()); // Initialize the test values. @@ -244,7 +245,8 @@ InterfaceImpl server_impl; { // Create the binding in an inner scope so it can be deleted first. - Binding<sample::Provider> binding(&server_impl, GetProxy(&interface_ptr_)); + Binding<sample::Provider> binding(&server_impl, + MakeRequest(&interface_ptr_)); // Initialize the test values. server_impl.resetLastServerValueSeen(); @@ -275,7 +277,7 @@ TEST_F(BindingCallbackTest, CloseBindingBeforeDeletingCallback) { // Create the ServerImpl and the Binding. InterfaceImpl server_impl; - Binding<sample::Provider> binding(&server_impl, GetProxy(&interface_ptr_)); + Binding<sample::Provider> binding(&server_impl, MakeRequest(&interface_ptr_)); // Initialize the test values. server_impl.resetLastServerValueSeen(); @@ -310,7 +312,7 @@ TEST_F(BindingCallbackTest, DeleteCallbackBeforeBindingDeathTest) { // Create the ServerImpl and the Binding. InterfaceImpl server_impl; - Binding<sample::Provider> binding(&server_impl, GetProxy(&interface_ptr_)); + Binding<sample::Provider> binding(&server_impl, MakeRequest(&interface_ptr_)); // Initialize the test values. server_impl.resetLastServerValueSeen();
diff --git a/mojo/public/cpp/bindings/tests/binding_set_unittest.cc b/mojo/public/cpp/bindings/tests/binding_set_unittest.cc index b12be444..b34c70b 100644 --- a/mojo/public/cpp/bindings/tests/binding_set_unittest.cc +++ b/mojo/public/cpp/bindings/tests/binding_set_unittest.cc
@@ -79,8 +79,8 @@ BindingSet<PingService> bindings_(BindingSetDispatchMode::WITH_CONTEXT); PingServicePtr ping_a, ping_b; - bindings_.AddBinding(&impl, GetProxy(&ping_a), context_a); - bindings_.AddBinding(&impl, GetProxy(&ping_b), context_b); + bindings_.AddBinding(&impl, MakeRequest(&ping_a), context_a); + bindings_.AddBinding(&impl, MakeRequest(&ping_b), context_b); { impl.set_ping_handler(ExpectContext(&bindings_, context_a)); @@ -119,7 +119,7 @@ PingImpl impl; PingServicePtr ptr; BindingSet<PingService> bindings; - bindings.AddBinding(&impl, GetProxy(&ptr)); + bindings.AddBinding(&impl, MakeRequest(&ptr)); base::RunLoop run_loop; bindings.set_connection_error_with_reason_handler(base::Bind( @@ -175,7 +175,7 @@ TEST_F(BindingSetTest, AssociatedBindingSetContext) { AssociatedPingProviderPtr provider; PingProviderImpl impl; - Binding<AssociatedPingProvider> binding(&impl, GetProxy(&provider)); + Binding<AssociatedPingProvider> binding(&impl, MakeRequest(&provider)); void* context_a = reinterpret_cast<void*>(1); void* context_b = reinterpret_cast<void*>(2); @@ -185,7 +185,7 @@ base::RunLoop loop; impl.set_new_ping_context(context_a); impl.set_new_ping_handler(loop.QuitClosure()); - provider->GetPing(GetProxy(&ping_a, provider.associated_group())); + provider->GetPing(MakeRequest(&ping_a, provider.associated_group())); loop.Run(); } @@ -194,7 +194,7 @@ base::RunLoop loop; impl.set_new_ping_context(context_b); impl.set_new_ping_handler(loop.QuitClosure()); - provider->GetPing(GetProxy(&ping_b, provider.associated_group())); + provider->GetPing(MakeRequest(&ping_b, provider.associated_group())); loop.Run(); } @@ -242,15 +242,15 @@ void* context_a = reinterpret_cast<void*>(1); void* context_b = reinterpret_cast<void*>(2); - bindings.AddBinding(&impl, GetProxy(&provider_a), context_a); - bindings.AddBinding(&impl, GetProxy(&provider_b), context_b); + bindings.AddBinding(&impl, MakeRequest(&provider_a), context_a); + bindings.AddBinding(&impl, MakeRequest(&provider_b), context_b); { PingServiceAssociatedPtr ping; base::RunLoop loop; impl.set_new_ping_handler( Sequence(ExpectContext(&bindings, context_a), loop.QuitClosure())); - provider_a->GetPing(GetProxy(&ping, provider_a.associated_group())); + provider_a->GetPing(MakeRequest(&ping, provider_a.associated_group())); loop.Run(); } @@ -259,7 +259,7 @@ base::RunLoop loop; impl.set_new_ping_handler( Sequence(ExpectContext(&bindings, context_b), loop.QuitClosure())); - provider_b->GetPing(GetProxy(&ping, provider_b.associated_group())); + provider_b->GetPing(MakeRequest(&ping, provider_b.associated_group())); loop.Run(); } @@ -299,7 +299,7 @@ run_loop.QuitClosure())); PingServiceAssociatedPtr ptr; - master_ptr->GetPing(GetProxy(&ptr, master_ptr.associated_group())); + master_ptr->GetPing(MakeRequest(&ptr, master_ptr.associated_group())); ptr.ResetWithReason(2048u, "bye");
diff --git a/mojo/public/cpp/bindings/tests/binding_unittest.cc b/mojo/public/cpp/bindings/tests/binding_unittest.cc index a2a26c6..2fc7ddf 100644 --- a/mojo/public/cpp/bindings/tests/binding_unittest.cc +++ b/mojo/public/cpp/bindings/tests/binding_unittest.cc
@@ -83,7 +83,7 @@ TEST_F(BindingTest, Close) { bool called = false; sample::ServicePtr ptr; - auto request = GetProxy(&ptr); + auto request = MakeRequest(&ptr); base::RunLoop run_loop; ptr.set_connection_error_handler( SetFlagAndRunClosure(&called, run_loop.QuitClosure())); @@ -101,7 +101,7 @@ bool encountered_error = false; ServiceImpl impl; sample::ServicePtr ptr; - auto request = GetProxy(&ptr); + auto request = MakeRequest(&ptr); base::RunLoop run_loop; ptr.set_connection_error_handler( SetFlagAndRunClosure(&encountered_error, run_loop.QuitClosure())); @@ -137,7 +137,7 @@ { ServiceImpl impl; sample::ServicePtr ptr; - Binding<sample::Service> binding(&impl, GetProxy(&ptr)); + Binding<sample::Service> binding(&impl, MakeRequest(&ptr)); base::RunLoop run_loop; binding.set_connection_error_handler( SetFlagAndRunClosure(&called, run_loop.QuitClosure())); @@ -156,7 +156,7 @@ TEST_F(BindingTest, CloseDoesntCallConnectionErrorHandler) { ServiceImpl impl; sample::ServicePtr ptr; - Binding<sample::Service> binding(&impl, GetProxy(&ptr)); + Binding<sample::Service> binding(&impl, MakeRequest(&ptr)); bool called = false; binding.set_connection_error_handler(SetFlagAndRunClosure(&called)); binding.Close(); @@ -203,7 +203,7 @@ // This should delete itself on connection error. base::RunLoop run_loop; new ServiceImplWithBinding(&was_deleted, run_loop.QuitClosure(), - GetProxy(&ptr)); + MakeRequest(&ptr)); ptr.reset(); EXPECT_FALSE(was_deleted); run_loop.Run(); @@ -214,7 +214,7 @@ TEST_F(BindingTest, Unbind) { ServiceImpl impl; sample::ServicePtr ptr; - Binding<sample::Service> binding(&impl, GetProxy(&ptr)); + Binding<sample::Service> binding(&impl, MakeRequest(&ptr)); bool called = false; base::RunLoop run_loop; @@ -272,7 +272,7 @@ bool called = false; base::RunLoop run_loop; sample::ServicePtr ptr; - auto request = GetProxy(&ptr); + auto request = MakeRequest(&ptr); ServiceImpl impl; Binding<sample::Service> binding(&impl, std::move(request)); binding.PauseIncomingMethodCallProcessing(); @@ -295,7 +295,7 @@ bool called = false; base::RunLoop run_loop; sample::ServicePtr ptr; - auto request = GetProxy(&ptr); + auto request = MakeRequest(&ptr); ServiceImpl impl; Binding<sample::Service> binding(&impl, std::move(request)); binding.set_connection_error_handler( @@ -360,7 +360,7 @@ TEST_F(BindingTest, MessageFilter) { test::PingServicePtr ptr; PingServiceImpl impl; - mojo::Binding<test::PingService> binding(&impl, GetProxy(&ptr)); + mojo::Binding<test::PingService> binding(&impl, MakeRequest(&ptr)); int status = 0; auto handler_helper = [] (int* status, int expected_status, int new_status) { @@ -391,7 +391,7 @@ TEST_F(BindingTest, FlushForTesting) { bool called = false; sample::ServicePtr ptr; - auto request = GetProxy(&ptr); + auto request = MakeRequest(&ptr); ServiceImpl impl; Binding<sample::Service> binding(&impl, std::move(request)); binding.set_connection_error_handler(base::Bind(&Fail)); @@ -410,7 +410,7 @@ TEST_F(BindingTest, FlushForTestingWithClosedPeer) { bool called = false; sample::ServicePtr ptr; - auto request = GetProxy(&ptr); + auto request = MakeRequest(&ptr); ServiceImpl impl; Binding<sample::Service> binding(&impl, std::move(request)); binding.set_connection_error_handler(SetFlagAndRunClosure(&called)); @@ -424,7 +424,7 @@ TEST_F(BindingTest, ConnectionErrorWithReason) { sample::ServicePtr ptr; - auto request = GetProxy(&ptr); + auto request = MakeRequest(&ptr); ServiceImpl impl; Binding<sample::Service> binding(&impl, std::move(request)); @@ -460,7 +460,7 @@ test::PingServicePtr proxy; WeakBinding<test::PingService> binding(weak_factory.GetWeakPtr(), - GetProxy(&proxy)); + MakeRequest(&proxy)); { // Ensure the binding is functioning. @@ -495,7 +495,7 @@ bool encountered_error = false; bool was_deleted = false; sample::ServicePtr ptr; - auto request = GetProxy(&ptr); + auto request = MakeRequest(&ptr); ptr.set_connection_error_handler( SetFlagAndRunClosure(&encountered_error, run_loop.QuitClosure())); bool called = false; @@ -528,7 +528,7 @@ // Will delete itself. base::RunLoop run_loop; new ServiceImplWithBinding(&was_deleted, run_loop.QuitClosure(), - GetProxy(&ptr)); + MakeRequest(&ptr)); base::RunLoop().RunUntilIdle(); EXPECT_FALSE(was_deleted); @@ -543,7 +543,7 @@ bool called = false; bool was_deleted = false; sample::ServicePtr ptr; - auto request = GetProxy(&ptr); + auto request = MakeRequest(&ptr); auto binding = MakeStrongBinding(base::MakeUnique<ServiceImpl>(&was_deleted), std::move(request)); binding->set_connection_error_handler(base::Bind(&Fail)); @@ -571,7 +571,7 @@ bool called = false; bool was_deleted = false; sample::ServicePtr ptr; - auto request = GetProxy(&ptr); + auto request = MakeRequest(&ptr); auto binding = MakeStrongBinding(base::MakeUnique<ServiceImpl>(&was_deleted), std::move(request)); binding->set_connection_error_handler(SetFlagAndRunClosure(&called)); @@ -588,7 +588,7 @@ TEST_F(StrongBindingTest, ConnectionErrorWithReason) { sample::ServicePtr ptr; - auto request = GetProxy(&ptr); + auto request = MakeRequest(&ptr); auto binding = MakeStrongBinding(base::MakeUnique<ServiceImpl>(), std::move(request)); base::RunLoop run_loop;
diff --git a/mojo/public/cpp/bindings/tests/bindings_perftest.cc b/mojo/public/cpp/bindings/tests/bindings_perftest.cc index 0da5af6..44fa8e3 100644 --- a/mojo/public/cpp/bindings/tests/bindings_perftest.cc +++ b/mojo/public/cpp/bindings/tests/bindings_perftest.cc
@@ -86,9 +86,7 @@ } struct BoundPingService { - BoundPingService() : binding(&impl) { - binding.Bind(GetProxy(&service)); - } + BoundPingService() : binding(&impl) { binding.Bind(MakeRequest(&service)); } PingServiceImpl impl; test::PingServicePtr service; @@ -106,7 +104,7 @@ TEST_F(MojoBindingsPerftest, InProcessPingPong) { test::PingServicePtr service; PingServiceImpl impl; - Binding<test::PingService> binding(&impl, GetProxy(&service)); + Binding<test::PingService> binding(&impl, MakeRequest(&service)); PingPongTest test(std::move(service)); {
diff --git a/mojo/public/cpp/bindings/tests/data_view_unittest.cc b/mojo/public/cpp/bindings/tests/data_view_unittest.cc index 71f60a8..0ebfda5 100644 --- a/mojo/public/cpp/bindings/tests/data_view_unittest.cc +++ b/mojo/public/cpp/bindings/tests/data_view_unittest.cc
@@ -167,7 +167,7 @@ TEST_F(DataViewTest, InterfaceArray) { TestInterfacePtr ptr; - TestInterfaceImpl impl(GetProxy(&ptr)); + TestInterfaceImpl impl(MakeRequest(&ptr)); TestStructPtr obj(TestStruct::New()); obj->f_interface_array.push_back(std::move(ptr));
diff --git a/mojo/public/cpp/bindings/tests/equals_unittest.cc b/mojo/public/cpp/bindings/tests/equals_unittest.cc index 376c2bd..466b58d 100644 --- a/mojo/public/cpp/bindings/tests/equals_unittest.cc +++ b/mojo/public/cpp/bindings/tests/equals_unittest.cc
@@ -124,13 +124,13 @@ EXPECT_TRUE(inf1.Equals(inf1)); EXPECT_TRUE(inf1.Equals(inf2)); - auto inf1_request = GetProxy(&inf1); + auto inf1_request = MakeRequest(&inf1); ALLOW_UNUSED_LOCAL(inf1_request); EXPECT_TRUE(inf1.Equals(inf1)); EXPECT_FALSE(inf1.Equals(inf2)); - auto inf2_request = GetProxy(&inf2); + auto inf2_request = MakeRequest(&inf2); ALLOW_UNUSED_LOCAL(inf2_request); EXPECT_FALSE(inf1.Equals(inf2)); @@ -146,13 +146,13 @@ EXPECT_TRUE(req1.Equals(req2)); SomeInterfacePtr inf1; - req1 = GetProxy(&inf1); + req1 = MakeRequest(&inf1); EXPECT_TRUE(req1.Equals(req1)); EXPECT_FALSE(req1.Equals(req2)); SomeInterfacePtr inf2; - req2 = GetProxy(&inf2); + req2 = MakeRequest(&inf2); EXPECT_FALSE(req1.Equals(req2)); }
diff --git a/mojo/public/cpp/bindings/tests/handle_passing_unittest.cc b/mojo/public/cpp/bindings/tests/handle_passing_unittest.cc index feeeef2..9d31620 100644 --- a/mojo/public/cpp/bindings/tests/handle_passing_unittest.cc +++ b/mojo/public/cpp/bindings/tests/handle_passing_unittest.cc
@@ -200,7 +200,7 @@ TEST_F(HandlePassingTest, Basic) { sample::FactoryPtr factory; - SampleFactoryImpl factory_impl(GetProxy(&factory)); + SampleFactoryImpl factory_impl(MakeRequest(&factory)); MessagePipe pipe0; EXPECT_TRUE(WriteTextMessage(pipe0.handle1.get(), kText1)); @@ -210,7 +210,7 @@ imported::ImportedInterfacePtr imported; base::RunLoop run_loop; - ImportedInterfaceImpl imported_impl(GetProxy(&imported), + ImportedInterfaceImpl imported_impl(MakeRequest(&imported), run_loop.QuitClosure()); sample::RequestPtr request(sample::Request::New()); @@ -237,7 +237,7 @@ TEST_F(HandlePassingTest, PassInvalid) { sample::FactoryPtr factory; - SampleFactoryImpl factory_impl(GetProxy(&factory)); + SampleFactoryImpl factory_impl(MakeRequest(&factory)); sample::RequestPtr request(sample::Request::New()); request->x = 1; @@ -258,7 +258,7 @@ // Verifies DataPipeConsumer can be passed and read from. TEST_F(HandlePassingTest, DataPipe) { sample::FactoryPtr factory; - SampleFactoryImpl factory_impl(GetProxy(&factory)); + SampleFactoryImpl factory_impl(MakeRequest(&factory)); // Writes a string to a data pipe and passes the data pipe (consumer) to the // factory. @@ -296,7 +296,7 @@ TEST_F(HandlePassingTest, PipesAreClosed) { sample::FactoryPtr factory; - SampleFactoryImpl factory_impl(GetProxy(&factory)); + SampleFactoryImpl factory_impl(MakeRequest(&factory)); MessagePipe extra_pipe; @@ -322,12 +322,12 @@ TEST_F(HandlePassingTest, CreateNamedObject) { sample::FactoryPtr factory; - SampleFactoryImpl factory_impl(GetProxy(&factory)); + SampleFactoryImpl factory_impl(MakeRequest(&factory)); sample::NamedObjectPtr object1; EXPECT_FALSE(object1); - InterfaceRequest<sample::NamedObject> object1_request = GetProxy(&object1); + InterfaceRequest<sample::NamedObject> object1_request = MakeRequest(&object1); EXPECT_TRUE(object1_request.is_pending()); factory->CreateNamedObject(std::move(object1_request)); EXPECT_FALSE(object1_request.is_pending()); // We've passed the request. @@ -336,7 +336,7 @@ object1->SetName("object1"); sample::NamedObjectPtr object2; - factory->CreateNamedObject(GetProxy(&object2)); + factory->CreateNamedObject(MakeRequest(&object2)); object2->SetName("object2"); base::RunLoop run_loop, run_loop2;
diff --git a/mojo/public/cpp/bindings/tests/interface_ptr_unittest.cc b/mojo/public/cpp/bindings/tests/interface_ptr_unittest.cc index 650effcc..138a9271 100644 --- a/mojo/public/cpp/bindings/tests/interface_ptr_unittest.cc +++ b/mojo/public/cpp/bindings/tests/interface_ptr_unittest.cc
@@ -221,13 +221,13 @@ TEST_F(InterfacePtrTest, IsBound) { math::CalculatorPtr calc; EXPECT_FALSE(calc.is_bound()); - MathCalculatorImpl calc_impl(GetProxy(&calc)); + MathCalculatorImpl calc_impl(MakeRequest(&calc)); EXPECT_TRUE(calc.is_bound()); } TEST_F(InterfacePtrTest, EndToEnd) { math::CalculatorPtr calc; - MathCalculatorImpl calc_impl(GetProxy(&calc)); + MathCalculatorImpl calc_impl(MakeRequest(&calc)); // Suppose this is instantiated in a process that has pipe1_. MathCalculatorUI calculator_ui(std::move(calc)); @@ -243,7 +243,7 @@ TEST_F(InterfacePtrTest, EndToEnd_Synchronous) { math::CalculatorPtr calc; - MathCalculatorImpl calc_impl(GetProxy(&calc)); + MathCalculatorImpl calc_impl(MakeRequest(&calc)); // Suppose this is instantiated in a process that has pipe1_. MathCalculatorUI calculator_ui(std::move(calc)); @@ -268,7 +268,7 @@ TEST_F(InterfacePtrTest, Movable) { math::CalculatorPtr a; math::CalculatorPtr b; - MathCalculatorImpl calc_impl(GetProxy(&b)); + MathCalculatorImpl calc_impl(MakeRequest(&b)); EXPECT_TRUE(!a); EXPECT_FALSE(!b); @@ -315,7 +315,7 @@ TEST_F(InterfacePtrTest, EncounteredError) { math::CalculatorPtr proxy; - MathCalculatorImpl calc_impl(GetProxy(&proxy)); + MathCalculatorImpl calc_impl(MakeRequest(&proxy)); MathCalculatorUI calculator_ui(std::move(proxy)); @@ -344,7 +344,7 @@ TEST_F(InterfacePtrTest, EncounteredErrorCallback) { math::CalculatorPtr proxy; - MathCalculatorImpl calc_impl(GetProxy(&proxy)); + MathCalculatorImpl calc_impl(MakeRequest(&proxy)); bool encountered_error = false; base::RunLoop run_loop; @@ -381,7 +381,7 @@ TEST_F(InterfacePtrTest, DestroyInterfacePtrOnMethodResponse) { math::CalculatorPtr proxy; - MathCalculatorImpl calc_impl(GetProxy(&proxy)); + MathCalculatorImpl calc_impl(MakeRequest(&proxy)); EXPECT_EQ(0, SelfDestructingMathCalculatorUI::num_instances()); @@ -396,7 +396,7 @@ TEST_F(InterfacePtrTest, NestedDestroyInterfacePtrOnMethodResponse) { math::CalculatorPtr proxy; - MathCalculatorImpl calc_impl(GetProxy(&proxy)); + MathCalculatorImpl calc_impl(MakeRequest(&proxy)); EXPECT_EQ(0, SelfDestructingMathCalculatorUI::num_instances()); @@ -411,7 +411,7 @@ TEST_F(InterfacePtrTest, ReentrantWaitForIncomingMethodCall) { sample::ServicePtr proxy; - ReentrantServiceImpl impl(GetProxy(&proxy)); + ReentrantServiceImpl impl(MakeRequest(&proxy)); base::RunLoop run_loop, run_loop2; proxy->Frobinate(nullptr, sample::Service::BazOptions::REGULAR, nullptr, @@ -430,7 +430,7 @@ TEST_F(InterfacePtrTest, QueryVersion) { IntegerAccessorImpl impl; sample::IntegerAccessorPtr ptr; - Binding<sample::IntegerAccessor> binding(&impl, GetProxy(&ptr)); + Binding<sample::IntegerAccessor> binding(&impl, MakeRequest(&ptr)); EXPECT_EQ(0u, ptr.version()); @@ -445,7 +445,7 @@ TEST_F(InterfacePtrTest, RequireVersion) { IntegerAccessorImpl impl; sample::IntegerAccessorPtr ptr; - Binding<sample::IntegerAccessor> binding(&impl, GetProxy(&ptr)); + Binding<sample::IntegerAccessor> binding(&impl, MakeRequest(&ptr)); EXPECT_EQ(0u, ptr.version()); @@ -511,8 +511,9 @@ math::CalculatorPtr calc; base::RunLoop run_loop; - auto binding = MakeStrongBinding( - base::MakeUnique<StrongMathCalculatorImpl>(&destroyed), GetProxy(&calc)); + auto binding = + MakeStrongBinding(base::MakeUnique<StrongMathCalculatorImpl>(&destroyed), + MakeRequest(&calc)); binding->set_connection_error_handler(base::Bind( &SetFlagAndRunClosure, &error_received, run_loop.QuitClosure())); @@ -668,15 +669,15 @@ TEST_F(InterfacePtrTest, Scoping) { APtr a; base::RunLoop run_loop; - AImpl a_impl(GetProxy(&a), run_loop.QuitClosure()); + AImpl a_impl(MakeRequest(&a), run_loop.QuitClosure()); EXPECT_FALSE(a_impl.d_called()); { BPtr b; - a->GetB(GetProxy(&b)); + a->GetB(MakeRequest(&b)); CPtr c; - b->GetC(GetProxy(&c)); + b->GetC(MakeRequest(&c)); c->D(); } @@ -703,11 +704,11 @@ // Tests that FuseProxy does what it's supposed to do. TEST_F(InterfacePtrTest, Fusion) { sample::PingTestPtr proxy; - PingTestImpl impl(GetProxy(&proxy)); + PingTestImpl impl(MakeRequest(&proxy)); // Create another PingTest pipe. sample::PingTestPtr ptr; - sample::PingTestRequest request = GetProxy(&ptr); + sample::PingTestRequest request = MakeRequest(&ptr); // Fuse the new pipe to the one hanging off |impl|. EXPECT_TRUE(FuseInterface(std::move(request), proxy.PassInterface())); @@ -726,7 +727,7 @@ TEST_F(InterfacePtrTest, FlushForTesting) { math::CalculatorPtr calc; - MathCalculatorImpl calc_impl(GetProxy(&calc)); + MathCalculatorImpl calc_impl(MakeRequest(&calc)); calc.set_connection_error_handler(base::Bind(&Fail)); MathCalculatorUI calculator_ui(std::move(calc)); @@ -747,7 +748,7 @@ TEST_F(InterfacePtrTest, FlushForTestingWithClosedPeer) { math::CalculatorPtr calc; - GetProxy(&calc); + MakeRequest(&calc); bool called = false; calc.set_connection_error_handler(base::Bind(&SetBool, &called)); calc.FlushForTesting(); @@ -757,7 +758,7 @@ TEST_F(InterfacePtrTest, ConnectionErrorWithReason) { math::CalculatorPtr calc; - MathCalculatorImpl calc_impl(GetProxy(&calc)); + MathCalculatorImpl calc_impl(MakeRequest(&calc)); base::RunLoop run_loop; calc.set_connection_error_with_reason_handler(base::Bind( @@ -776,7 +777,7 @@ TEST_F(InterfacePtrTest, InterfaceRequestResetWithReason) { math::CalculatorPtr calc; - auto request = GetProxy(&calc); + auto request = MakeRequest(&calc); base::RunLoop run_loop; calc.set_connection_error_with_reason_handler(base::Bind( @@ -795,7 +796,7 @@ TEST_F(InterfacePtrTest, CallbackOwnsInterfacePtr) { sample::PingTestPtr ptr; - sample::PingTestRequest request = GetProxy(&ptr); + sample::PingTestRequest request = MakeRequest(&ptr); base::RunLoop run_loop; @@ -814,7 +815,7 @@ TEST_F(InterfacePtrTest, ThreadSafeInterfacePointer) { math::CalculatorPtr ptr; - MathCalculatorImpl calc_impl(GetProxy(&ptr)); + MathCalculatorImpl calc_impl(MakeRequest(&ptr)); scoped_refptr<math::ThreadSafeCalculatorPtr> thread_safe_ptr = math::ThreadSafeCalculatorPtr::Create(std::move(ptr)); @@ -872,7 +873,7 @@ MathCalculatorImpl** math_calc_impl) { math::CalculatorPtr ptr; // In real life, the implementation would have a legitimate owner. - *math_calc_impl = new MathCalculatorImpl(GetProxy(&ptr)); + *math_calc_impl = new MathCalculatorImpl(MakeRequest(&ptr)); thread_safe_ptr->Bind(std::move(ptr)); main_task_runner->PostTask(FROM_HERE, quit_closure); },
diff --git a/mojo/public/cpp/bindings/tests/pickle_unittest.cc b/mojo/public/cpp/bindings/tests/pickle_unittest.cc index bd716cc..92a5c13 100644 --- a/mojo/public/cpp/bindings/tests/pickle_unittest.cc +++ b/mojo/public/cpp/bindings/tests/pickle_unittest.cc
@@ -160,7 +160,7 @@ template <typename ProxyType = PicklePasser> InterfacePtr<ProxyType> ConnectToChromiumService() { InterfacePtr<ProxyType> proxy; - InterfaceRequest<ProxyType> request = GetProxy(&proxy); + InterfaceRequest<ProxyType> request = MakeRequest(&proxy); chromium_bindings_.AddBinding( &chromium_service_, ConvertInterfaceRequest<PicklePasser>(std::move(request))); @@ -170,7 +170,7 @@ template <typename ProxyType = blink::PicklePasser> InterfacePtr<ProxyType> ConnectToBlinkService() { InterfacePtr<ProxyType> proxy; - InterfaceRequest<ProxyType> request = GetProxy(&proxy); + InterfaceRequest<ProxyType> request = MakeRequest(&proxy); blink_bindings_.AddBinding( &blink_service_, ConvertInterfaceRequest<blink::PicklePasser>(std::move(request)));
diff --git a/mojo/public/cpp/bindings/tests/report_bad_message_unittest.cc b/mojo/public/cpp/bindings/tests/report_bad_message_unittest.cc index cf33df1..1bf3f7a 100644 --- a/mojo/public/cpp/bindings/tests/report_bad_message_unittest.cc +++ b/mojo/public/cpp/bindings/tests/report_bad_message_unittest.cc
@@ -66,7 +66,7 @@ base::Bind(&ReportBadMessageTest::OnProcessError, base::Unretained(this))); - impl_.BindImpl(GetProxy(&proxy_)); + impl_.BindImpl(MakeRequest(&proxy_)); } void TearDown() override {
diff --git a/mojo/public/cpp/bindings/tests/request_response_unittest.cc b/mojo/public/cpp/bindings/tests/request_response_unittest.cc index 5e203a2..43b8f0dc 100644 --- a/mojo/public/cpp/bindings/tests/request_response_unittest.cc +++ b/mojo/public/cpp/bindings/tests/request_response_unittest.cc
@@ -95,7 +95,7 @@ TEST_F(RequestResponseTest, EchoString) { sample::ProviderPtr provider; - ProviderImpl provider_impl(GetProxy(&provider)); + ProviderImpl provider_impl(MakeRequest(&provider)); std::string buf; base::RunLoop run_loop; @@ -109,7 +109,7 @@ TEST_F(RequestResponseTest, EchoStrings) { sample::ProviderPtr provider; - ProviderImpl provider_impl(GetProxy(&provider)); + ProviderImpl provider_impl(MakeRequest(&provider)); std::string buf; base::RunLoop run_loop; @@ -123,7 +123,7 @@ TEST_F(RequestResponseTest, EchoMessagePipeHandle) { sample::ProviderPtr provider; - ProviderImpl provider_impl(GetProxy(&provider)); + ProviderImpl provider_impl(MakeRequest(&provider)); MessagePipe pipe2; base::RunLoop run_loop; @@ -141,7 +141,7 @@ TEST_F(RequestResponseTest, EchoEnum) { sample::ProviderPtr provider; - ProviderImpl provider_impl(GetProxy(&provider)); + ProviderImpl provider_impl(MakeRequest(&provider)); sample::Enum value; base::RunLoop run_loop;
diff --git a/mojo/public/cpp/bindings/tests/struct_traits_unittest.cc b/mojo/public/cpp/bindings/tests/struct_traits_unittest.cc index f21b4c86..0f6ade8 100644 --- a/mojo/public/cpp/bindings/tests/struct_traits_unittest.cc +++ b/mojo/public/cpp/bindings/tests/struct_traits_unittest.cc
@@ -201,7 +201,7 @@ TEST_F(StructTraitsTest, ChromiumProxyToChromiumService) { RectServicePtr chromium_proxy; - BindToChromiumService(GetProxy(&chromium_proxy)); + BindToChromiumService(MakeRequest(&chromium_proxy)); { base::RunLoop loop; chromium_proxy->AddRect(RectChromium(1, 1, 4, 5)); @@ -221,7 +221,7 @@ TEST_F(StructTraitsTest, ChromiumToBlinkService) { RectServicePtr chromium_proxy; - BindToBlinkService(GetProxy(&chromium_proxy)); + BindToBlinkService(MakeRequest(&chromium_proxy)); { base::RunLoop loop; chromium_proxy->AddRect(RectChromium(1, 1, 4, 5)); @@ -251,7 +251,7 @@ TEST_F(StructTraitsTest, BlinkProxyToBlinkService) { blink::RectServicePtr blink_proxy; - BindToBlinkService(GetProxy(&blink_proxy)); + BindToBlinkService(MakeRequest(&blink_proxy)); { base::RunLoop loop; blink_proxy->AddRect(RectBlink(1, 1, 4, 5)); @@ -271,7 +271,7 @@ TEST_F(StructTraitsTest, BlinkProxyToChromiumService) { blink::RectServicePtr blink_proxy; - BindToChromiumService(GetProxy(&blink_proxy)); + BindToChromiumService(MakeRequest(&blink_proxy)); { base::RunLoop loop; blink_proxy->AddRect(RectBlink(1, 1, 4, 5));
diff --git a/mojo/public/cpp/bindings/tests/sync_method_unittest.cc b/mojo/public/cpp/bindings/tests/sync_method_unittest.cc index 1253930..acd379a 100644 --- a/mojo/public/cpp/bindings/tests/sync_method_unittest.cc +++ b/mojo/public/cpp/bindings/tests/sync_method_unittest.cc
@@ -267,7 +267,7 @@ protected: void SetUp() override { - master_impl_.reset(new TestSyncMasterImpl(GetProxy(&master_ptr_))); + master_impl_.reset(new TestSyncMasterImpl(MakeRequest(&master_ptr_))); master_ptr_.associated_group()->CreateAssociatedInterface( AssociatedGroup::WILL_PASS_REQUEST, &asso_ptr_info_, &asso_request_); @@ -342,7 +342,7 @@ TYPED_TEST(SyncMethodCommonTest, CallSyncMethodAsynchronously) { InterfacePtr<TypeParam> ptr; - typename ImplTraits<TypeParam>::Type impl(GetProxy(&ptr)); + typename ImplTraits<TypeParam>::Type impl(MakeRequest(&ptr)); base::RunLoop run_loop; ptr->Echo(123, base::Bind(&ExpectValueAndRunClosure, 123, @@ -357,7 +357,7 @@ service_thread.thread()->task_runner()->PostTask( FROM_HERE, base::Bind(&TestSyncServiceThread<TypeParam>::SetUp, base::Unretained(&service_thread), - base::Passed(GetProxy(&ptr)))); + base::Passed(MakeRequest(&ptr)))); ASSERT_TRUE(ptr->Ping()); ASSERT_TRUE(service_thread.ping_called()); @@ -379,7 +379,7 @@ InterfacePtr<TypeParam> ptr; // The binding lives on the same thread as the interface pointer. - typename ImplTraits<TypeParam>::Type impl(GetProxy(&ptr)); + typename ImplTraits<TypeParam>::Type impl(MakeRequest(&ptr)); int32_t output_value = -1; ASSERT_TRUE(ptr->Echo(42, &output_value)); EXPECT_EQ(42, output_value); @@ -390,7 +390,7 @@ // destroyed while it is waiting for a sync call response. InterfacePtr<TypeParam> ptr; - typename ImplTraits<TypeParam>::Type impl(GetProxy(&ptr)); + typename ImplTraits<TypeParam>::Type impl(MakeRequest(&ptr)); impl.set_ping_handler([&ptr](const TestSync::PingCallback& callback) { ptr.reset(); callback.Run(); @@ -404,7 +404,7 @@ // corresponding interface pointer is waiting for a sync call response. InterfacePtr<TypeParam> ptr; - typename ImplTraits<TypeParam>::Type impl(GetProxy(&ptr)); + typename ImplTraits<TypeParam>::Type impl(MakeRequest(&ptr)); impl.set_ping_handler([&impl](const TestSync::PingCallback& callback) { impl.binding()->Close(); callback.Run(); @@ -417,7 +417,7 @@ // already a sync call ongoing. The responses arrive in order. InterfacePtr<TypeParam> ptr; - typename ImplTraits<TypeParam>::Type impl(GetProxy(&ptr)); + typename ImplTraits<TypeParam>::Type impl(MakeRequest(&ptr)); // The same variable is used to store the output of the two sync calls, in // order to test that responses are handled in the correct order. @@ -443,7 +443,7 @@ // already a sync call ongoing. The responses arrive out of order. InterfacePtr<TypeParam> ptr; - typename ImplTraits<TypeParam>::Type impl(GetProxy(&ptr)); + typename ImplTraits<TypeParam>::Type impl(MakeRequest(&ptr)); // The same variable is used to store the output of the two sync calls, in // order to test that responses are handled in the correct order. @@ -469,7 +469,7 @@ // call, async responses are queued until the sync call completes. InterfacePtr<TypeParam> ptr; - typename ImplTraits<TypeParam>::Type impl(GetProxy(&ptr)); + typename ImplTraits<TypeParam>::Type impl(MakeRequest(&ptr)); int32_t async_echo_request_value = -1; TestSync::AsyncEchoCallback async_echo_request_callback; @@ -525,7 +525,7 @@ // until the sync call completes. InterfacePtr<TypeParam> ptr; - typename ImplTraits<TypeParam>::Type impl(GetProxy(&ptr)); + typename ImplTraits<TypeParam>::Type impl(MakeRequest(&ptr)); bool async_echo_request_dispatched = false; impl.set_async_echo_handler([&async_echo_request_dispatched]( @@ -576,7 +576,7 @@ // notification is delayed until all the queued messages are processed. InterfacePtr<TypeParam> ptr; - typename ImplTraits<TypeParam>::Type impl(GetProxy(&ptr)); + typename ImplTraits<TypeParam>::Type impl(MakeRequest(&ptr)); int32_t async_echo_request_value = -1; TestSync::AsyncEchoCallback async_echo_request_callback;
diff --git a/mojo/public/cpp/bindings/tests/union_unittest.cc b/mojo/public/cpp/bindings/tests/union_unittest.cc index b461380d7..29197be 100644 --- a/mojo/public/cpp/bindings/tests/union_unittest.cc +++ b/mojo/public/cpp/bindings/tests/union_unittest.cc
@@ -1178,7 +1178,7 @@ base::RunLoop run_loop; SmallCacheImpl impl(run_loop.QuitClosure()); SmallCachePtr ptr; - Binding<SmallCache> bindings(&impl, GetProxy(&ptr)); + Binding<SmallCache> bindings(&impl, MakeRequest(&ptr)); HandleUnionPtr handle(HandleUnion::New()); handle->set_f_small_cache(std::move(ptr)); @@ -1193,7 +1193,7 @@ base::RunLoop run_loop; SmallCacheImpl impl(run_loop.QuitClosure()); SmallCachePtr ptr; - Binding<SmallCache> bindings(&impl, GetProxy(&ptr)); + Binding<SmallCache> bindings(&impl, MakeRequest(&ptr)); mojo::internal::SerializationContext context; HandleUnionPtr handle(HandleUnion::New()); @@ -1235,7 +1235,7 @@ base::MessageLoop message_loop; UnionInterfaceImpl impl; UnionInterfacePtr ptr; - Binding<UnionInterface> bindings(&impl, GetProxy(&ptr)); + Binding<UnionInterface> bindings(&impl, MakeRequest(&ptr)); PodUnionPtr pod(PodUnion::New()); pod->set_f_int16(16);
diff --git a/mojo/public/cpp/bindings/tests/wtf_types_unittest.cc b/mojo/public/cpp/bindings/tests/wtf_types_unittest.cc index 16b36d31c..cc2963a 100644 --- a/mojo/public/cpp/bindings/tests/wtf_types_unittest.cc +++ b/mojo/public/cpp/bindings/tests/wtf_types_unittest.cc
@@ -253,7 +253,7 @@ TEST_F(WTFTypesTest, SendString) { blink::TestWTFPtr ptr; - TestWTFImpl impl(ConvertInterfaceRequest<TestWTF>(GetProxy(&ptr))); + TestWTFImpl impl(ConvertInterfaceRequest<TestWTF>(MakeRequest(&ptr))); WTF::Vector<WTF::String> strs = ConstructStringArray(); @@ -272,7 +272,7 @@ TEST_F(WTFTypesTest, SendStringArray) { blink::TestWTFPtr ptr; - TestWTFImpl impl(ConvertInterfaceRequest<TestWTF>(GetProxy(&ptr))); + TestWTFImpl impl(ConvertInterfaceRequest<TestWTF>(MakeRequest(&ptr))); WTF::Optional<WTF::Vector<WTF::String>> arrs[3]; // arrs[0] is empty. @@ -298,7 +298,7 @@ TEST_F(WTFTypesTest, SendStringMap) { blink::TestWTFPtr ptr; - TestWTFImpl impl(ConvertInterfaceRequest<TestWTF>(GetProxy(&ptr))); + TestWTFImpl impl(ConvertInterfaceRequest<TestWTF>(MakeRequest(&ptr))); WTF::Optional<WTF::HashMap<WTF::String, WTF::String>> maps[3]; // maps[0] is empty.
diff --git a/mojo/public/cpp/bindings/thread_safe_interface_ptr.h b/mojo/public/cpp/bindings/thread_safe_interface_ptr.h index d1fc9c4f..533f677 100644 --- a/mojo/public/cpp/bindings/thread_safe_interface_ptr.h +++ b/mojo/public/cpp/bindings/thread_safe_interface_ptr.h
@@ -32,7 +32,7 @@ // // Ex for ThreadSafeInterfacePtr: // frob::FrobinatorPtr frobinator; -// frob::FrobinatorImpl impl(GetProxy(&frobinator)); +// frob::FrobinatorImpl impl(MakeRequest(&frobinator)); // scoped_refptr<frob::ThreadSafeFrobinatorPtr> thread_safe_frobinator = // frob::ThreadSafeFrobinatorPtr::Create(std::move(frobinator)); // (*thread_safe_frobinator)->FrobinateToTheMax();
diff --git a/net/dns/host_resolver_mojo.cc b/net/dns/host_resolver_mojo.cc index 3c311c4a..6321979 100644 --- a/net/dns/host_resolver_mojo.cc +++ b/net/dns/host_resolver_mojo.cc
@@ -89,7 +89,7 @@ interfaces::HostResolverRequestClientPtr handle; std::unique_ptr<Job> job(new Job(key, addresses, callback, - mojo::GetProxy(&handle), + mojo::MakeRequest(&handle), host_cache_weak_factory_.GetWeakPtr())); request->reset(new RequestImpl(std::move(job)));
diff --git a/net/dns/mojo_host_resolver_impl_unittest.cc b/net/dns/mojo_host_resolver_impl_unittest.cc index 9405c71..186a7389 100644 --- a/net/dns/mojo_host_resolver_impl_unittest.cc +++ b/net/dns/mojo_host_resolver_impl_unittest.cc
@@ -162,7 +162,7 @@ TEST_F(MojoHostResolverImplTest, Resolve) { interfaces::HostResolverRequestClientPtr client_ptr; - TestRequestClient client(mojo::GetProxy(&client_ptr)); + TestRequestClient client(mojo::MakeRequest(&client_ptr)); resolver_service_->Resolve(CreateRequest("example.com", 80, false), std::move(client_ptr)); @@ -176,7 +176,7 @@ TEST_F(MojoHostResolverImplTest, ResolveSynchronous) { interfaces::HostResolverRequestClientPtr client_ptr; - TestRequestClient client(mojo::GetProxy(&client_ptr)); + TestRequestClient client(mojo::MakeRequest(&client_ptr)); mock_host_resolver_.set_synchronous_mode(true); @@ -192,9 +192,9 @@ TEST_F(MojoHostResolverImplTest, ResolveMultiple) { interfaces::HostResolverRequestClientPtr client1_ptr; - TestRequestClient client1(mojo::GetProxy(&client1_ptr)); + TestRequestClient client1(mojo::MakeRequest(&client1_ptr)); interfaces::HostResolverRequestClientPtr client2_ptr; - TestRequestClient client2(mojo::GetProxy(&client2_ptr)); + TestRequestClient client2(mojo::MakeRequest(&client2_ptr)); mock_host_resolver_.set_ondemand_mode(true); @@ -220,9 +220,9 @@ TEST_F(MojoHostResolverImplTest, ResolveDuplicate) { interfaces::HostResolverRequestClientPtr client1_ptr; - TestRequestClient client1(mojo::GetProxy(&client1_ptr)); + TestRequestClient client1(mojo::MakeRequest(&client1_ptr)); interfaces::HostResolverRequestClientPtr client2_ptr; - TestRequestClient client2(mojo::GetProxy(&client2_ptr)); + TestRequestClient client2(mojo::MakeRequest(&client2_ptr)); mock_host_resolver_.set_ondemand_mode(true); @@ -248,7 +248,7 @@ TEST_F(MojoHostResolverImplTest, ResolveFailure) { interfaces::HostResolverRequestClientPtr client_ptr; - TestRequestClient client(mojo::GetProxy(&client_ptr)); + TestRequestClient client(mojo::MakeRequest(&client_ptr)); resolver_service_->Resolve(CreateRequest("failure.fail", 80, false), std::move(client_ptr)); @@ -261,7 +261,7 @@ TEST_F(MojoHostResolverImplTest, DestroyClient) { interfaces::HostResolverRequestClientPtr client_ptr; std::unique_ptr<TestRequestClient> client( - new TestRequestClient(mojo::GetProxy(&client_ptr))); + new TestRequestClient(mojo::MakeRequest(&client_ptr))); mock_host_resolver_.set_ondemand_mode(true);
diff --git a/net/proxy/in_process_mojo_proxy_resolver_factory.cc b/net/proxy/in_process_mojo_proxy_resolver_factory.cc index 5c3920a..eae58fd 100644 --- a/net/proxy/in_process_mojo_proxy_resolver_factory.cc +++ b/net/proxy/in_process_mojo_proxy_resolver_factory.cc
@@ -20,7 +20,7 @@ InProcessMojoProxyResolverFactory::InProcessMojoProxyResolverFactory() { mojo::MakeStrongBinding(base::MakeUnique<MojoProxyResolverFactoryImpl>(), - mojo::GetProxy(&factory_)); + mojo::MakeRequest(&factory_)); } InProcessMojoProxyResolverFactory::~InProcessMojoProxyResolverFactory() =
diff --git a/net/proxy/mojo_proxy_resolver_factory_impl_unittest.cc b/net/proxy/mojo_proxy_resolver_factory_impl_unittest.cc index a266131..945e9e5 100644 --- a/net/proxy/mojo_proxy_resolver_factory_impl_unittest.cc +++ b/net/proxy/mojo_proxy_resolver_factory_impl_unittest.cc
@@ -101,7 +101,7 @@ mock_factory_ = new TestProxyResolverFactory(&waiter_); mojo::MakeStrongBinding(base::MakeUnique<MojoProxyResolverFactoryImpl>( base::WrapUnique(mock_factory_)), - mojo::GetProxy(&factory_)); + mojo::MakeRequest(&factory_)); } void OnConnectionError() { waiter_.NotifyEvent(CONNECTION_ERROR); } @@ -135,8 +135,8 @@ interfaces::ProxyResolverPtr proxy_resolver; interfaces::ProxyResolverFactoryRequestClientPtr client_ptr; mojo::Binding<ProxyResolverFactoryRequestClient> client_binding( - this, mojo::GetProxy(&client_ptr)); - factory_->CreateResolver(kScriptData, mojo::GetProxy(&proxy_resolver), + this, mojo::MakeRequest(&client_ptr)); + factory_->CreateResolver(kScriptData, mojo::MakeRequest(&proxy_resolver), std::move(client_ptr)); proxy_resolver.set_connection_error_handler( base::Bind(&MojoProxyResolverFactoryImplTest::OnConnectionError, @@ -162,8 +162,8 @@ interfaces::ProxyResolverPtr proxy_resolver; interfaces::ProxyResolverFactoryRequestClientPtr client_ptr; mojo::Binding<ProxyResolverFactoryRequestClient> client_binding( - this, mojo::GetProxy(&client_ptr)); - factory_->CreateResolver(kScriptData, mojo::GetProxy(&proxy_resolver), + this, mojo::MakeRequest(&client_ptr)); + factory_->CreateResolver(kScriptData, mojo::MakeRequest(&proxy_resolver), std::move(client_ptr)); proxy_resolver.set_connection_error_handler( base::Bind(&MojoProxyResolverFactoryImplTest::OnConnectionError, @@ -183,8 +183,8 @@ interfaces::ProxyResolverPtr proxy_resolver; interfaces::ProxyResolverFactoryRequestClientPtr client_ptr; mojo::Binding<ProxyResolverFactoryRequestClient> client_binding( - this, mojo::GetProxy(&client_ptr)); - factory_->CreateResolver(kScriptData, mojo::GetProxy(&proxy_resolver), + this, mojo::MakeRequest(&client_ptr)); + factory_->CreateResolver(kScriptData, mojo::MakeRequest(&proxy_resolver), std::move(client_ptr)); proxy_resolver.set_connection_error_handler( base::Bind(&MojoProxyResolverFactoryImplTest::OnConnectionError, @@ -201,8 +201,8 @@ interfaces::ProxyResolverPtr proxy_resolver; interfaces::ProxyResolverFactoryRequestClientPtr client_ptr; mojo::Binding<ProxyResolverFactoryRequestClient> client_binding( - this, mojo::GetProxy(&client_ptr)); - factory_->CreateResolver(kScriptData, mojo::GetProxy(&proxy_resolver), + this, mojo::MakeRequest(&client_ptr)); + factory_->CreateResolver(kScriptData, mojo::MakeRequest(&proxy_resolver), std::move(client_ptr)); proxy_resolver.set_connection_error_handler( base::Bind(&MojoProxyResolverFactoryImplTest::OnConnectionError,
diff --git a/net/proxy/mojo_proxy_resolver_impl_unittest.cc b/net/proxy/mojo_proxy_resolver_impl_unittest.cc index 0022478..3e32c2b1 100644 --- a/net/proxy/mojo_proxy_resolver_impl_unittest.cc +++ b/net/proxy/mojo_proxy_resolver_impl_unittest.cc
@@ -208,7 +208,7 @@ TEST_F(MojoProxyResolverImplTest, GetProxyForUrl) { interfaces::ProxyResolverRequestClientPtr client_ptr; - TestRequestClient client(mojo::GetProxy(&client_ptr)); + TestRequestClient client(mojo::MakeRequest(&client_ptr)); resolver_->GetProxyForUrl(GURL(GURL("http://example.com")), std::move(client_ptr)); @@ -255,7 +255,7 @@ TEST_F(MojoProxyResolverImplTest, GetProxyForUrlFailure) { interfaces::ProxyResolverRequestClientPtr client_ptr; - TestRequestClient client(mojo::GetProxy(&client_ptr)); + TestRequestClient client(mojo::MakeRequest(&client_ptr)); resolver_->GetProxyForUrl(GURL("http://example.com"), std::move(client_ptr)); ASSERT_EQ(1u, mock_proxy_resolver_->pending_jobs().size()); @@ -273,9 +273,9 @@ TEST_F(MojoProxyResolverImplTest, GetProxyForUrlMultiple) { interfaces::ProxyResolverRequestClientPtr client_ptr1; - TestRequestClient client1(mojo::GetProxy(&client_ptr1)); + TestRequestClient client1(mojo::MakeRequest(&client_ptr1)); interfaces::ProxyResolverRequestClientPtr client_ptr2; - TestRequestClient client2(mojo::GetProxy(&client_ptr2)); + TestRequestClient client2(mojo::MakeRequest(&client_ptr2)); resolver_->GetProxyForUrl(GURL("http://example.com"), std::move(client_ptr1)); resolver_->GetProxyForUrl(GURL("https://example.com"), @@ -316,7 +316,7 @@ TEST_F(MojoProxyResolverImplTest, DestroyClient) { interfaces::ProxyResolverRequestClientPtr client_ptr; std::unique_ptr<TestRequestClient> client( - new TestRequestClient(mojo::GetProxy(&client_ptr))); + new TestRequestClient(mojo::MakeRequest(&client_ptr))); resolver_->GetProxyForUrl(GURL("http://example.com"), std::move(client_ptr)); ASSERT_EQ(1u, mock_proxy_resolver_->pending_jobs().size()); @@ -330,7 +330,7 @@ TEST_F(MojoProxyResolverImplTest, DestroyService) { interfaces::ProxyResolverRequestClientPtr client_ptr; - TestRequestClient client(mojo::GetProxy(&client_ptr)); + TestRequestClient client(mojo::MakeRequest(&client_ptr)); resolver_->GetProxyForUrl(GURL("http://example.com"), std::move(client_ptr)); ASSERT_EQ(1u, mock_proxy_resolver_->pending_jobs().size());
diff --git a/net/proxy/proxy_resolver_factory_mojo.cc b/net/proxy/proxy_resolver_factory_mojo.cc index 948328bc..254e158 100644 --- a/net/proxy/proxy_resolver_factory_mojo.cc +++ b/net/proxy/proxy_resolver_factory_mojo.cc
@@ -305,7 +305,8 @@ binding_(this), error_observer_(std::move(error_observer)) { on_delete_callback_runner_ = factory_->mojo_proxy_factory_->CreateResolver( - base::UTF16ToUTF8(pac_script->utf16()), mojo::GetProxy(&resolver_ptr_), + base::UTF16ToUTF8(pac_script->utf16()), + mojo::MakeRequest(&resolver_ptr_), binding_.CreateInterfacePtrAndBind()); resolver_ptr_.set_connection_error_handler( base::Bind(&ProxyResolverFactoryMojo::Job::OnConnectionError,
diff --git a/net/proxy/proxy_resolver_factory_mojo_unittest.cc b/net/proxy/proxy_resolver_factory_mojo_unittest.cc index a53bbd0..1ea381fb 100644 --- a/net/proxy/proxy_resolver_factory_mojo_unittest.cc +++ b/net/proxy/proxy_resolver_factory_mojo_unittest.cc
@@ -279,7 +279,7 @@ auto request = base::MakeUnique<HostResolver::RequestInfo>( HostPortPair(url.spec(), 12345)); interfaces::HostResolverRequestClientPtr dns_client; - mojo::GetProxy(&dns_client); + mojo::MakeRequest(&dns_client); client->ResolveDns(std::move(request), std::move(dns_client)); blocked_clients_.push_back( base::MakeUnique<interfaces::ProxyResolverRequestClientPtr>( @@ -447,7 +447,7 @@ auto request = base::MakeUnique<HostResolver::RequestInfo>( HostPortPair(pac_script, 12345)); interfaces::HostResolverRequestClientPtr dns_client; - mojo::GetProxy(&dns_client); + mojo::MakeRequest(&dns_client); client->ResolveDns(std::move(request), std::move(dns_client)); blocked_clients_.push_back( base::MakeUnique<interfaces::ProxyResolverFactoryRequestClientPtr>( @@ -523,7 +523,7 @@ public: void SetUp() override { mock_proxy_resolver_factory_.reset(new MockMojoProxyResolverFactory( - &mock_proxy_resolver_, mojo::GetProxy(&factory_ptr_))); + &mock_proxy_resolver_, mojo::MakeRequest(&factory_ptr_))); proxy_resolver_factory_mojo_.reset(new ProxyResolverFactoryMojo( this, &host_resolver_, base::Callback<std::unique_ptr<ProxyResolverErrorObserver>()>(),
diff --git a/services/catalog/catalog.cc b/services/catalog/catalog.cc index 6b145c6c..7985ec4a 100644 --- a/services/catalog/catalog.cc +++ b/services/catalog/catalog.cc
@@ -115,7 +115,7 @@ Catalog::Catalog(std::unique_ptr<Store> store) : store_(std::move(store)), weak_factory_(this) { - service_manager::mojom::ServiceRequest request = GetProxy(&service_); + service_manager::mojom::ServiceRequest request = MakeRequest(&service_); service_context_.reset(new service_manager::ServiceContext( base::MakeUnique<ServiceImpl>(this), std::move(request))); }
diff --git a/services/navigation/navigation_unittest.cc b/services/navigation/navigation_unittest.cc index b1a367409..e16865478 100644 --- a/services/navigation/navigation_unittest.cc +++ b/services/navigation/navigation_unittest.cc
@@ -77,7 +77,7 @@ connector()->ConnectToInterface("navigation", &view_factory); mojom::ViewPtr view; - view_factory->CreateView(GetViewClient(), GetProxy(&view)); + view_factory->CreateView(GetViewClient(), MakeRequest(&view)); view->NavigateTo(GURL("about:blank")); base::RunLoop loop;
diff --git a/services/navigation/public/cpp/view.cc b/services/navigation/public/cpp/view.cc index fc4055e..649f34f2 100644 --- a/services/navigation/public/cpp/view.cc +++ b/services/navigation/public/cpp/view.cc
@@ -24,8 +24,8 @@ View::View(mojom::ViewFactoryPtr factory) : binding_(this) { mojom::ViewClientPtr client; - binding_.Bind(GetProxy(&client)); - factory->CreateView(std::move(client), GetProxy(&view_)); + binding_.Bind(MakeRequest(&client)); + factory->CreateView(std::move(client), MakeRequest(&view_)); } View::View(mojom::ViewPtr view, mojom::ViewClientRequest request) @@ -95,7 +95,7 @@ void View::EmbedInWindow(aura::Window* parent) { ui::mojom::WindowTreeClientPtr client; - view_->GetWindowTreeClient(GetProxy(&client)); + view_->GetWindowTreeClient(MakeRequest(&client)); const uint32_t embed_flags = 0u; // Nothing special. aura::WindowPortMus::Get(parent)->Embed(std::move(client), embed_flags, base::Bind(&EmbedCallback));
diff --git a/services/navigation/view_impl.cc b/services/navigation/view_impl.cc index 6434335e..83c28b6 100644 --- a/services/navigation/view_impl.cc +++ b/services/navigation/view_impl.cc
@@ -148,8 +148,8 @@ bool* was_blocked) { mojom::ViewClientPtr client; mojom::ViewPtr view; - mojom::ViewRequest view_request = GetProxy(&view); - client_->ViewCreated(std::move(view), GetProxy(&client), + mojom::ViewRequest view_request = MakeRequest(&view); + client_->ViewCreated(std::move(view), MakeRequest(&client), disposition == WindowOpenDisposition::NEW_POPUP, initial_rect, user_gesture);
diff --git a/services/preferences/public/cpp/tests/pref_observer_store_unittest.cc b/services/preferences/public/cpp/tests/pref_observer_store_unittest.cc index d18cfbe..36e6d394 100644 --- a/services/preferences/public/cpp/tests/pref_observer_store_unittest.cc +++ b/services/preferences/public/cpp/tests/pref_observer_store_unittest.cc
@@ -91,7 +91,7 @@ }; void PrefObserverStoreTest::SetUp() { - manager_.reset(new TestPreferenceManager(mojo::GetProxy(&proxy_))); + manager_.reset(new TestPreferenceManager(mojo::MakeRequest(&proxy_))); store_ = new PrefObserverStore(std::move(proxy_)); store_->AddObserver(&observer_); }
diff --git a/services/service_manager/README.md b/services/service_manager/README.md index 7bcf94e..4239bc6 100644 --- a/services/service_manager/README.md +++ b/services/service_manager/README.md
@@ -663,7 +663,7 @@ service_manager::Identity target("exe:target",service_manager::mojom::kInheritUserID); service_manager::Connector::ConnectParams params(target); params.set_client_process_connection(std::move(factory), - GetProxy(&receiver)); + MakeRequest(&receiver)); std::unique_ptr<service_manager::Connection> connection = connector->Connect(¶ms); base::LaunchOptions options;
diff --git a/services/service_manager/connect_util.cc b/services/service_manager/connect_util.cc index e3e3fe4..d873621 100644 --- a/services/service_manager/connect_util.cc +++ b/services/service_manager/connect_util.cc
@@ -21,7 +21,7 @@ std::unique_ptr<ConnectParams> params(new ConnectParams); params->set_source(source); params->set_target(target); - params->set_remote_interfaces(mojo::GetProxy(&remote_interfaces)); + params->set_remote_interfaces(mojo::MakeRequest(&remote_interfaces)); service_manager->Connect(std::move(params)); mojo::MessagePipe pipe; remote_interfaces->GetInterface(interface_name, std::move(pipe.handle1));
diff --git a/services/service_manager/public/cpp/lib/connector_impl.cc b/services/service_manager/public/cpp/lib/connector_impl.cc index e704037..a00b288 100644 --- a/services/service_manager/public/cpp/lib/connector_impl.cc +++ b/services/service_manager/public/cpp/lib/connector_impl.cc
@@ -49,7 +49,8 @@ DCHECK(params); mojom::InterfaceProviderPtr remote_interfaces; - mojom::InterfaceProviderRequest remote_request = GetProxy(&remote_interfaces); + mojom::InterfaceProviderRequest remote_request = + MakeRequest(&remote_interfaces); std::unique_ptr<internal::ConnectionImpl> connection( new internal::ConnectionImpl(params->target(), Connection::State::PENDING)); @@ -89,7 +90,7 @@ return nullptr; mojom::ConnectorPtr connector; - mojom::ConnectorRequest request = GetProxy(&connector); + mojom::ConnectorRequest request = MakeRequest(&connector); connector_->Clone(std::move(request)); return base::MakeUnique<ConnectorImpl>(connector.PassInterface()); } @@ -125,7 +126,7 @@ std::unique_ptr<Connector> Connector::Create(mojom::ConnectorRequest* request) { mojom::ConnectorPtr proxy; - *request = mojo::GetProxy(&proxy); + *request = mojo::MakeRequest(&proxy); return base::MakeUnique<ConnectorImpl>(proxy.PassInterface()); }
diff --git a/services/service_manager/public/cpp/lib/interface_provider.cc b/services/service_manager/public/cpp/lib/interface_provider.cc index 2034933..484722e2 100644 --- a/services/service_manager/public/cpp/lib/interface_provider.cc +++ b/services/service_manager/public/cpp/lib/interface_provider.cc
@@ -10,7 +10,7 @@ namespace service_manager { InterfaceProvider::InterfaceProvider() : weak_factory_(this) { - pending_request_ = GetProxy(&interface_provider_); + pending_request_ = MakeRequest(&interface_provider_); } InterfaceProvider::~InterfaceProvider() {}
diff --git a/services/service_manager/public/cpp/lib/service_context.cc b/services/service_manager/public/cpp/lib/service_context.cc index d2997a67c..87e4c45 100644 --- a/services/service_manager/public/cpp/lib/service_context.cc +++ b/services/service_manager/public/cpp/lib/service_context.cc
@@ -79,8 +79,9 @@ void ServiceContext::OnStart(const ServiceInfo& info, const OnStartCallback& callback) { local_info_ = info; - callback.Run(std::move(pending_connector_request_), - mojo::GetProxy(&service_control_, binding_.associated_group())); + callback.Run( + std::move(pending_connector_request_), + mojo::MakeRequest(&service_control_, binding_.associated_group())); service_->set_context(this); service_->OnStart();
diff --git a/services/service_manager/service_manager.cc b/services/service_manager/service_manager.cc index ba429dd..2ca6a3a 100644 --- a/services/service_manager/service_manager.cc +++ b/services/service_manager/service_manager.cc
@@ -514,7 +514,7 @@ std::move(service_process_launcher_factory)), weak_ptr_factory_(this) { mojom::ServicePtr service; - mojom::ServiceRequest request = mojo::GetProxy(&service); + mojom::ServiceRequest request = mojo::MakeRequest(&service); InterfaceProviderSpec spec; spec.provides[kCapability_ServiceManager].insert( @@ -581,7 +581,7 @@ params->set_target(embedder_identity); mojom::ServicePtr service; - mojom::ServiceRequest request = mojo::GetProxy(&service); + mojom::ServiceRequest request = mojo::MakeRequest(&service); Connect(std::move(params), std::move(service), nullptr); return request; @@ -879,7 +879,7 @@ std::move(client_process_connection)); } else { // Otherwise we create a new Service pipe. - mojom::ServiceRequest request = GetProxy(&service); + mojom::ServiceRequest request = MakeRequest(&service); CHECK(!result->package_path.empty()); // The catalog was unable to read a manifest for this service. We can't do
diff --git a/services/service_manager/standalone/context.cc b/services/service_manager/standalone/context.cc index 85880af..14ace78 100644 --- a/services/service_manager/standalone/context.cc +++ b/services/service_manager/standalone/context.cc
@@ -268,7 +268,7 @@ std::unique_ptr<ConnectParams> params(new ConnectParams); params->set_source(CreateServiceManagerIdentity()); params->set_target(Identity(name, mojom::kRootUserID)); - params->set_remote_interfaces(mojo::GetProxy(&remote_interfaces)); + params->set_remote_interfaces(mojo::MakeRequest(&remote_interfaces)); service_manager_->Connect(std::move(params)); }
diff --git a/services/service_manager/tests/lifecycle/lifecycle_unittest.cc b/services/service_manager/tests/lifecycle/lifecycle_unittest.cc index 0bcbed6..1f383a9 100644 --- a/services/service_manager/tests/lifecycle/lifecycle_unittest.cc +++ b/services/service_manager/tests/lifecycle/lifecycle_unittest.cc
@@ -199,7 +199,7 @@ &service_manager); mojom::ServiceManagerListenerPtr listener; base::RunLoop loop; - InstanceState* state = new InstanceState(GetProxy(&listener), &loop); + InstanceState* state = new InstanceState(MakeRequest(&listener), &loop); service_manager->AddListener(std::move(listener)); loop.Run(); return base::WrapUnique(state);
diff --git a/services/service_manager/tests/service_manager/service_manager_unittest.cc b/services/service_manager/tests/service_manager/service_manager_unittest.cc index 48b8735..9c299c5 100644 --- a/services/service_manager/tests/service_manager/service_manager_unittest.cc +++ b/services/service_manager/tests/service_manager/service_manager_unittest.cc
@@ -186,7 +186,7 @@ service_manager::mojom::kInheritUserID); service_manager::Connector::ConnectParams params(target); params.set_client_process_connection(std::move(client), - GetProxy(&receiver)); + MakeRequest(&receiver)); std::unique_ptr<service_manager::Connection> connection = connector()->Connect(¶ms); connection->AddConnectionCompletedClosure(
diff --git a/services/service_manager/tests/util.cc b/services/service_manager/tests/util.cc index 2e51df5..1cc1088 100644 --- a/services/service_manager/tests/util.cc +++ b/services/service_manager/tests/util.cc
@@ -75,7 +75,8 @@ service_manager::mojom::PIDReceiverPtr receiver; service_manager::Connector::ConnectParams params(target); - params.set_client_process_connection(std::move(client), GetProxy(&receiver)); + params.set_client_process_connection(std::move(client), + MakeRequest(&receiver)); std::unique_ptr<service_manager::Connection> connection = connector->Connect(¶ms); {
diff --git a/services/tracing/public/cpp/provider.cc b/services/tracing/public/cpp/provider.cc index ad0e97e..9b09b09 100644 --- a/services/tracing/public/cpp/provider.cc +++ b/services/tracing/public/cpp/provider.cc
@@ -45,7 +45,7 @@ void Provider::InitializeWithFactoryInternal(mojom::FactoryPtr* factory) { mojom::ProviderPtr provider; - Bind(GetProxy(&provider)); + Bind(MakeRequest(&provider)); (*factory)->CreateRecorder(std::move(provider)); #ifdef NDEBUG if (base::CommandLine::ForCurrentProcess()->HasSwitch(
diff --git a/services/tracing/service.cc b/services/tracing/service.cc index b4044c7a..360a931 100644 --- a/services/tracing/service.cc +++ b/services/tracing/service.cc
@@ -55,7 +55,7 @@ if (tracing_active_) { mojom::RecorderPtr recorder_ptr; recorder_impls_.push_back( - new Recorder(GetProxy(&recorder_ptr), sink_.get())); + new Recorder(MakeRequest(&recorder_ptr), sink_.get())); provider->StartTracing(tracing_categories_, std::move(recorder_ptr)); } provider_ptrs_.AddPtr(std::move(provider)); @@ -68,8 +68,7 @@ provider_ptrs_.ForAllPtrs( [categories, this](mojom::Provider* controller) { mojom::RecorderPtr ptr; - recorder_impls_.push_back( - new Recorder(GetProxy(&ptr), sink_.get())); + recorder_impls_.push_back(new Recorder(MakeRequest(&ptr), sink_.get())); controller->StartTracing(categories, std::move(ptr)); }); tracing_active_ = true;
diff --git a/services/ui/gpu/gpu_main.cc b/services/ui/gpu/gpu_main.cc index 948106e..ce1c079 100644 --- a/services/ui/gpu/gpu_main.cc +++ b/services/ui/gpu/gpu_main.cc
@@ -158,7 +158,8 @@ : nullptr; mojom::GpuServicePtr gpu_service; - mojom::GpuServiceRequest gpu_service_request = mojo::GetProxy(&gpu_service); + mojom::GpuServiceRequest gpu_service_request = + mojo::MakeRequest(&gpu_service); if (gpu_thread_.task_runner()->BelongsToCurrentThread()) { // If the DisplayCompositor creation was delayed because GpuService
diff --git a/services/ui/ime/ime_unittest.cc b/services/ui/ime/ime_unittest.cc index 6209514..79d6c34b 100644 --- a/services/ui/ime/ime_unittest.cc +++ b/services/ui/ime/ime_unittest.cc
@@ -90,10 +90,10 @@ // Tests sending a KeyEvent to the IMEDriver through the Mus IMEServer. TEST_F(IMEAppTest, ProcessKeyEvent) { ui::mojom::TextInputClientPtr client_ptr; - TestTextInputClient client(GetProxy(&client_ptr)); + TestTextInputClient client(MakeRequest(&client_ptr)); ui::mojom::InputMethodPtr input_method; - ime_server_->StartSession(std::move(client_ptr), GetProxy(&input_method)); + ime_server_->StartSession(std::move(client_ptr), MakeRequest(&input_method)); // Send character key event. ui::KeyEvent char_event('A', ui::VKEY_A, 0);
diff --git a/services/ui/ime/test_ime_driver/test_ime_application.cc b/services/ui/ime/test_ime_driver/test_ime_application.cc index 82c83aa..f16bf51 100644 --- a/services/ui/ime/test_ime_driver/test_ime_application.cc +++ b/services/ui/ime/test_ime_driver/test_ime_application.cc
@@ -21,7 +21,7 @@ void TestIMEApplication::OnStart() { mojom::IMEDriverPtr ime_driver_ptr; mojo::MakeStrongBinding(base::MakeUnique<TestIMEDriver>(), - GetProxy(&ime_driver_ptr)); + MakeRequest(&ime_driver_ptr)); ui::mojom::IMERegistrarPtr ime_registrar; context()->connector()->ConnectToInterface(ui::mojom::kServiceName,
diff --git a/services/ui/public/cpp/window_compositor_frame_sink.cc b/services/ui/public/cpp/window_compositor_frame_sink.cc index 2d89373..b39bdf17 100644 --- a/services/ui/public/cpp/window_compositor_frame_sink.cc +++ b/services/ui/public/cpp/window_compositor_frame_sink.cc
@@ -21,10 +21,10 @@ cc::mojom::MojoCompositorFrameSinkClientPtr compositor_frame_sink_client; cc::mojom::MojoCompositorFrameSinkClientRequest compositor_frame_sink_client_request = - GetProxy(&compositor_frame_sink_client); + MakeRequest(&compositor_frame_sink_client); compositor_frame_sink_binding->reset(new WindowCompositorFrameSinkBinding( - GetProxy(&compositor_frame_sink), + MakeRequest(&compositor_frame_sink), compositor_frame_sink_client.PassInterface())); return base::WrapUnique(new WindowCompositorFrameSink( std::move(context_provider), gpu_memory_buffer_manager,
diff --git a/services/ui/public/cpp/window_tree_client.cc b/services/ui/public/cpp/window_tree_client.cc index d708659..2dbd61d 100644 --- a/services/ui/public/cpp/window_tree_client.cc +++ b/services/ui/public/cpp/window_tree_client.cc
@@ -153,7 +153,7 @@ mojom::WindowTreeFactoryPtr factory; connector->ConnectToInterface(ui::mojom::kServiceName, &factory); mojom::WindowTreePtr window_tree; - factory->CreateWindowTree(GetProxy(&window_tree), + factory->CreateWindowTree(MakeRequest(&window_tree), binding_.CreateInterfacePtrAndBind()); SetWindowTree(std::move(window_tree)); } @@ -165,7 +165,7 @@ mojom::WindowManagerWindowTreeFactoryPtr factory; connector->ConnectToInterface(ui::mojom::kServiceName, &factory); mojom::WindowTreePtr window_tree; - factory->CreateWindowTree(GetProxy(&window_tree), + factory->CreateWindowTree(MakeRequest(&window_tree), binding_.CreateInterfacePtrAndBind()); SetWindowTree(std::move(window_tree)); } @@ -567,8 +567,8 @@ &WindowTreeClient::OnConnectionLost, weak_factory_.GetWeakPtr())); if (window_manager_delegate_) { - tree_ptr_->GetWindowManagerClient(GetProxy(&window_manager_internal_client_, - tree_ptr_.associated_group())); + tree_ptr_->GetWindowManagerClient(MakeRequest( + &window_manager_internal_client_, tree_ptr_.associated_group())); } } @@ -800,8 +800,8 @@ is_from_embed_ = true; if (window_manager_delegate_) { - tree_ptr_->GetWindowManagerClient(GetProxy(&window_manager_internal_client_, - tree_ptr_.associated_group())); + tree_ptr_->GetWindowManagerClient(MakeRequest( + &window_manager_internal_client_, tree_ptr_.associated_group())); } OnEmbedImpl(tree_ptr_.get(), client_id, std::move(root_data), display_id,
diff --git a/services/ui/public/cpp/window_tree_host_factory.cc b/services/ui/public/cpp/window_tree_host_factory.cc index c78dbe1..0fb45fd5 100644 --- a/services/ui/public/cpp/window_tree_host_factory.cc +++ b/services/ui/public/cpp/window_tree_host_factory.cc
@@ -20,8 +20,8 @@ mojom::WindowTreeClientPtr tree_client; std::unique_ptr<WindowTreeClient> window_tree_client = base::MakeUnique<WindowTreeClient>(delegate, window_manager_delegate, - GetProxy(&tree_client)); - factory->CreateWindowTreeHost(GetProxy(host), std::move(tree_client)); + MakeRequest(&tree_client)); + factory->CreateWindowTreeHost(MakeRequest(host), std::move(tree_client)); return window_tree_client; }
diff --git a/services/ui/ws/frame_generator.cc b/services/ui/ws/frame_generator.cc index 5ba20d1d..c91684d 100644 --- a/services/ui/ws/frame_generator.cc +++ b/services/ui/ws/frame_generator.cc
@@ -42,7 +42,7 @@ gfx::AcceleratedWidget widget) { DCHECK_NE(gfx::kNullAcceleratedWidget, widget); cc::mojom::MojoCompositorFrameSinkRequest request = - mojo::GetProxy(&compositor_frame_sink_); + mojo::MakeRequest(&compositor_frame_sink_); root_window_->CreateDisplayCompositorFrameSink( widget, std::move(request), binding_.CreateInterfacePtrAndBind()); // TODO(fsamuel): This means we're always requesting a new BeginFrame signal
diff --git a/services/ui/ws/gpu_host.cc b/services/ui/ws/gpu_host.cc index 26f6c5c..ab97043 100644 --- a/services/ui/ws/gpu_host.cc +++ b/services/ui/ws/gpu_host.cc
@@ -98,11 +98,11 @@ next_client_id_(kInternalGpuChannelClientId + 1), main_thread_task_runner_(base::ThreadTaskRunnerHandle::Get()), gpu_host_binding_(this) { - gpu_main_impl_ = base::MakeUnique<GpuMain>(GetProxy(&gpu_main_)); + gpu_main_impl_ = base::MakeUnique<GpuMain>(MakeRequest(&gpu_main_)); gpu_main_impl_->OnStart(); // TODO(sad): Once GPU process is split, this would look like: // connector->ConnectToInterface("gpu", &gpu_main_); - gpu_main_->CreateGpuService(GetProxy(&gpu_service_), + gpu_main_->CreateGpuService(MakeRequest(&gpu_service_), gpu_host_binding_.CreateInterfacePtrAndBind()); gpu_memory_buffer_manager_ = base::MakeUnique<ServerGpuMemoryBufferManager>( gpu_service_.get(), next_client_id_++);
diff --git a/services/ui/ws/server_window_compositor_frame_sink_manager.cc b/services/ui/ws/server_window_compositor_frame_sink_manager.cc index 51091085..0b06422 100644 --- a/services/ui/ws/server_window_compositor_frame_sink_manager.cc +++ b/services/ui/ws/server_window_compositor_frame_sink_manager.cc
@@ -64,7 +64,7 @@ CompositorFrameSinkData& data = type_to_compositor_frame_sink_map_[compositor_frame_sink_type]; data.pending_compositor_frame_sink_request = - mojo::GetProxy(&data.compositor_frame_sink); + mojo::MakeRequest(&data.compositor_frame_sink); data.compositor_frame_sink->AddChildFrameSink(frame_sink_id); } @@ -158,7 +158,7 @@ if (data.pending_compositor_frame_sink_request.is_pending()) { private_request = std::move(data.pending_compositor_frame_sink_request); } else { - private_request = mojo::GetProxy(&data.compositor_frame_sink); + private_request = mojo::MakeRequest(&data.compositor_frame_sink); } if (widget != gfx::kNullAcceleratedWidget) {
diff --git a/services/ui/ws/test_utils.cc b/services/ui/ws/test_utils.cc index c30f4472..e4275ac6 100644 --- a/services/ui/ws/test_utils.cc +++ b/services/ui/ws/test_utils.cc
@@ -511,7 +511,7 @@ EXPECT_TRUE(wm_tree->AddWindow(FirstRootId(wm_tree), embed_window_id)); display_->root_window()->SetBounds(root_window_bounds); mojom::WindowTreeClientPtr client; - mojom::WindowTreeClientRequest client_request = GetProxy(&client); + mojom::WindowTreeClientRequest client_request = MakeRequest(&client); wm_client_->Bind(std::move(client_request)); const uint32_t embed_flags = 0; wm_tree->Embed(embed_window_id, std::move(client), embed_flags);
diff --git a/services/ui/ws/window_manager_state_unittest.cc b/services/ui/ws/window_manager_state_unittest.cc index 94b9bfa..401ae50 100644 --- a/services/ui/ws/window_manager_state_unittest.cc +++ b/services/ui/ws/window_manager_state_unittest.cc
@@ -79,7 +79,7 @@ WindowTree** embed_tree, TestWindowTreeClient** embed_client_proxy) { mojom::WindowTreeClientPtr embed_client; - mojom::WindowTreeClientRequest client_request = GetProxy(&embed_client); + mojom::WindowTreeClientRequest client_request = MakeRequest(&embed_client); ASSERT_TRUE( tree->Embed(embed_window_id, std::move(embed_client), embed_flags)); TestWindowTreeClient* client =
diff --git a/services/ui/ws/window_server.cc b/services/ui/ws/window_server.cc index ab573c2..e7ef19e6 100644 --- a/services/ui/ws/window_server.cc +++ b/services/ui/ws/window_server.cc
@@ -60,7 +60,7 @@ user_id_tracker_.AddObserver(this); OnUserIdAdded(user_id_tracker_.active_id()); gpu_host_->CreateDisplayCompositor( - mojo::GetProxy(&display_compositor_), + mojo::MakeRequest(&display_compositor_), display_compositor_client_binding_.CreateInterfacePtrAndBind()); } @@ -108,7 +108,7 @@ tree->set_embedder_intercepts_events(); mojom::WindowTreePtr window_tree_ptr; - mojom::WindowTreeRequest window_tree_request = GetProxy(&window_tree_ptr); + mojom::WindowTreeRequest window_tree_request = MakeRequest(&window_tree_ptr); std::unique_ptr<WindowTreeBinding> binding = delegate_->CreateWindowTreeBinding( WindowServerDelegate::BindingType::EMBED, this, tree,
diff --git a/services/ui/ws/window_tree_binding.cc b/services/ui/ws/window_tree_binding.cc index 39e3825..97c3953 100644 --- a/services/ui/ws/window_tree_binding.cc +++ b/services/ui/ws/window_tree_binding.cc
@@ -50,7 +50,7 @@ mojom::WindowManager* DefaultWindowTreeBinding::GetWindowManager() { client_->GetWindowManager( - GetProxy(&window_manager_internal_, client_.associated_group())); + MakeRequest(&window_manager_internal_, client_.associated_group())); return window_manager_internal_.get(); } @@ -64,7 +64,7 @@ mojom::WindowTreeClient* DefaultWindowTreeBinding::CreateClientForShutdown() { client_.reset(); - GetProxy(&client_); + MakeRequest(&client_); return client_.get(); }
diff --git a/services/ui/ws/window_tree_client_unittest.cc b/services/ui/ws/window_tree_client_unittest.cc index 467ac50..00f775cb 100644 --- a/services/ui/ws/window_tree_client_unittest.cc +++ b/services/ui/ws/window_tree_client_unittest.cc
@@ -433,7 +433,7 @@ base::MakeUnique<mojo::AssociatedBinding<mojom::WindowManager>>( this, std::move(internal)); tree_->GetWindowManagerClient( - GetProxy(&window_manager_client_, tree_.associated_group())); + MakeRequest(&window_manager_client_, tree_.associated_group())); } // mojom::WindowManager: @@ -657,9 +657,9 @@ mojom::WindowTreeClientPtr tree_client_ptr; wt_client1_ = base::MakeUnique<TestWindowTreeClient>(); - wt_client1_->Bind(GetProxy(&tree_client_ptr)); + wt_client1_->Bind(MakeRequest(&tree_client_ptr)); - factory->CreateWindowTreeHost(GetProxy(&host_), + factory->CreateWindowTreeHost(MakeRequest(&host_), std::move(tree_client_ptr)); // Next we should get an embed call on the "window manager" client. @@ -2157,10 +2157,10 @@ cc::mojom::MojoCompositorFrameSinkPtr surface_ptr; cc::mojom::MojoCompositorFrameSinkClientRequest client_request; cc::mojom::MojoCompositorFrameSinkClientPtr surface_client_ptr; - client_request = mojo::GetProxy(&surface_client_ptr); + client_request = mojo::MakeRequest(&surface_client_ptr); wt2()->AttachCompositorFrameSink( window_2_101, mojom::CompositorFrameSinkType::DEFAULT, - mojo::GetProxy(&surface_ptr), std::move(surface_client_ptr)); + mojo::MakeRequest(&surface_ptr), std::move(surface_client_ptr)); cc::CompositorFrame compositor_frame; std::unique_ptr<cc::RenderPass> render_pass = cc::RenderPass::Create(); gfx::Rect frame_rect(0, 0, 100, 100);
diff --git a/services/ui/ws/window_tree_unittest.cc b/services/ui/ws/window_tree_unittest.cc index 2c0ded3..fc21e53 100644 --- a/services/ui/ws/window_tree_unittest.cc +++ b/services/ui/ws/window_tree_unittest.cc
@@ -222,7 +222,7 @@ EXPECT_TRUE(wm_tree()->AddWindow(wm_root_id, embed_window_id)); display()->root_window()->SetBounds(gfx::Rect(0, 0, 100, 100)); mojom::WindowTreeClientPtr client; - mojom::WindowTreeClientRequest client_request = GetProxy(&client); + mojom::WindowTreeClientRequest client_request = MakeRequest(&client); wm_client()->Bind(std::move(client_request)); const uint32_t embed_flags = 0; wm_tree()->Embed(embed_window_id, std::move(client), embed_flags);
diff --git a/services/video_capture/test/fake_device_descriptor_unittest.cc b/services/video_capture/test/fake_device_descriptor_unittest.cc index a747e57b..c69e0a8 100644 --- a/services/video_capture/test/fake_device_descriptor_unittest.cc +++ b/services/video_capture/test/fake_device_descriptor_unittest.cc
@@ -27,7 +27,7 @@ Run(mojom::DeviceAccessResultCode::SUCCESS)) .Times(1); factory_->CreateDevice( - fake_device_descriptor_.device_id, mojo::GetProxy(&device_proxy_1), + fake_device_descriptor_.device_id, mojo::MakeRequest(&device_proxy_1), base::Bind(&MockCreateDeviceProxyCallback::Run, base::Unretained(&create_device_proxy_callback_1))); device_proxy_1.set_connection_error_handler( @@ -43,7 +43,7 @@ .Times(1) .WillOnce(InvokeWithoutArgs([&wait_loop]() { wait_loop.Quit(); })); factory_->CreateDevice( - fake_device_descriptor_.device_id, mojo::GetProxy(&device_proxy_2), + fake_device_descriptor_.device_id, mojo::MakeRequest(&device_proxy_2), base::Bind(&MockCreateDeviceProxyCallback::Run, base::Unretained(&create_device_proxy_callback_2))); device_proxy_2.set_connection_error_handler( @@ -58,13 +58,13 @@ TEST_F(FakeDeviceDescriptorTest, CanUseSecondRequestedProxy) { mojom::DevicePtr device_proxy_1; factory_->CreateDevice( - fake_device_descriptor_.device_id, mojo::GetProxy(&device_proxy_1), + fake_device_descriptor_.device_id, mojo::MakeRequest(&device_proxy_1), base::Bind([](mojom::DeviceAccessResultCode result_code) {})); base::RunLoop wait_loop; mojom::DevicePtr device_proxy_2; factory_->CreateDevice( - fake_device_descriptor_.device_id, mojo::GetProxy(&device_proxy_2), + fake_device_descriptor_.device_id, mojo::MakeRequest(&device_proxy_2), base::Bind( [](base::RunLoop* wait_loop, mojom::DeviceAccessResultCode result_code) { wait_loop->Quit(); }, @@ -81,7 +81,7 @@ base::RunLoop wait_loop_2; mojom::ReceiverPtr receiver_proxy; - MockReceiver receiver(mojo::GetProxy(&receiver_proxy)); + MockReceiver receiver(mojo::MakeRequest(&receiver_proxy)); EXPECT_CALL(receiver, OnIncomingCapturedVideoFramePtr(_)) .WillRepeatedly( InvokeWithoutArgs([&wait_loop_2]() { wait_loop_2.Quit(); }));
diff --git a/services/video_capture/test/fake_device_test.cc b/services/video_capture/test/fake_device_test.cc index 8273d97..bb2c42e4 100644 --- a/services/video_capture/test/fake_device_test.cc +++ b/services/video_capture/test/fake_device_test.cc
@@ -46,7 +46,7 @@ factory_->CreateDevice( std::move(fake_device_descriptor_.device_id), - mojo::GetProxy(&fake_device_proxy_), + mojo::MakeRequest(&fake_device_proxy_), base::Bind([](mojom::DeviceAccessResultCode result_code) { ASSERT_EQ(mojom::DeviceAccessResultCode::SUCCESS, result_code); }));
diff --git a/services/video_capture/test/fake_device_unittest.cc b/services/video_capture/test/fake_device_unittest.cc index b0ce65b28..7af7a1af6 100644 --- a/services/video_capture/test/fake_device_unittest.cc +++ b/services/video_capture/test/fake_device_unittest.cc
@@ -35,7 +35,7 @@ const int kNumFramesToWaitFor = 3; int num_frames_arrived = 0; mojom::ReceiverPtr receiver_proxy; - MockReceiver receiver(mojo::GetProxy(&receiver_proxy)); + MockReceiver receiver(mojo::MakeRequest(&receiver_proxy)); EXPECT_CALL(receiver, OnIncomingCapturedVideoFramePtr(_)) .WillRepeatedly(InvokeWithoutArgs( [&wait_loop, &kNumFramesToWaitFor, &num_frames_arrived]() { @@ -57,7 +57,7 @@ constexpr int num_frames_to_receive = 2; FrameInfo received_frame_infos[num_frames_to_receive]; int received_frame_count = 0; - MockReceiver receiver(mojo::GetProxy(&receiver_proxy)); + MockReceiver receiver(mojo::MakeRequest(&receiver_proxy)); EXPECT_CALL(receiver, OnIncomingCapturedVideoFramePtr(_)) .WillRepeatedly(Invoke( [&received_frame_infos, &received_frame_count, &num_frames_to_receive,
diff --git a/services/video_capture/test/mock_device_test.cc b/services/video_capture/test/mock_device_test.cc index a8e3274f..7fbdf81 100644 --- a/services/video_capture/test/mock_device_test.cc +++ b/services/video_capture/test/mock_device_test.cc
@@ -55,7 +55,7 @@ std::move(mock_device_factory), base::Bind(CreateJpegDecoder)); mock_factory_binding_ = base::MakeUnique<mojo::Binding<mojom::DeviceFactory>>( - mock_device_factory_adapter_.get(), mojo::GetProxy(&factory_)); + mock_device_factory_adapter_.get(), mojo::MakeRequest(&factory_)); media::VideoCaptureDeviceDescriptor mock_descriptor; mock_descriptor.device_id = "MockDeviceId"; @@ -63,7 +63,7 @@ // Obtain the mock device from the factory factory_->CreateDevice( - mock_descriptor.device_id, mojo::GetProxy(&device_proxy_), + mock_descriptor.device_id, mojo::MakeRequest(&device_proxy_), base::Bind([](mojom::DeviceAccessResultCode result_code) {})); requested_settings_.format.frame_size = gfx::Size(800, 600); @@ -74,7 +74,7 @@ media::PowerLineFrequency::FREQUENCY_DEFAULT; mock_receiver_ = - base::MakeUnique<MockReceiver>(mojo::GetProxy(&mock_receiver_proxy_)); + base::MakeUnique<MockReceiver>(mojo::MakeRequest(&mock_receiver_proxy_)); } } // namespace video_capture
diff --git a/services/video_capture/test/service_test.cc b/services/video_capture/test/service_test.cc index 1695b7ee..3276975 100644 --- a/services/video_capture/test/service_test.cc +++ b/services/video_capture/test/service_test.cc
@@ -14,7 +14,7 @@ void ServiceTest::SetUp() { service_manager::test::ServiceTest::SetUp(); connector()->ConnectToInterface("video_capture", &service_); - service_->ConnectToFakeDeviceFactory(mojo::GetProxy(&factory_)); + service_->ConnectToFakeDeviceFactory(mojo::MakeRequest(&factory_)); } } // namespace video_capture
diff --git a/services/video_capture/test/service_unittest.cc b/services/video_capture/test/service_unittest.cc index c79f964..7f38215 100644 --- a/services/video_capture/test/service_unittest.cc +++ b/services/video_capture/test/service_unittest.cc
@@ -63,7 +63,7 @@ .Times(1) .WillOnce(InvokeWithoutArgs([&wait_loop]() { wait_loop.Quit(); })); factory_->CreateDevice( - invalid_device_id, mojo::GetProxy(&fake_device_proxy), + invalid_device_id, mojo::MakeRequest(&fake_device_proxy), base::Bind(&MockCreateDeviceProxyCallback::Run, base::Unretained(&create_device_proxy_callback))); wait_loop.Run();
diff --git a/third_party/WebKit/LayoutTests/TestExpectations b/third_party/WebKit/LayoutTests/TestExpectations index 7e3a723..c68dd08c 100644 --- a/third_party/WebKit/LayoutTests/TestExpectations +++ b/third_party/WebKit/LayoutTests/TestExpectations
@@ -2247,6 +2247,9 @@ crbug.com/674858 [ Linux ] virtual/threaded/printing/offscreencanvas-2d-printing.html [ Pass Failure Crash ] crbug.com/674858 [ Linux ] virtual/threaded/printing/offscreencanvas-webgl-printing.html [ Pass Failure Crash ] +# Added 2016-12-20 +crbug.com/675907 fast/input/placeholder-wrongly-placed-if-too-tall.html [ Pass Timeout ] + # for Skia DEPS roll crbug.com/674509 compositing/overlap-blending/reflection-opacity-huge.html [ NeedsRebaseline ] crbug.com/674509 compositing/reflections/animation-inside-reflection.html [ NeedsRebaseline ]
diff --git a/third_party/WebKit/LayoutTests/css3/flexbox/percentage-max-width-cross-axis.html b/third_party/WebKit/LayoutTests/css3/flexbox/percentage-max-width-cross-axis.html new file mode 100644 index 0000000..edb7fb2 --- /dev/null +++ b/third_party/WebKit/LayoutTests/css3/flexbox/percentage-max-width-cross-axis.html
@@ -0,0 +1,22 @@ +<!DOCTYPE html> + +<link rel="stylesheet" href="resources/flexbox.css"> + +<script src="../../resources/testharness.js"></script> +<script src="../../resources/testharnessreport.js"></script> +<script src="../../resources/check-layout-th.js"></script> + +<body onload="checkLayout('.flexbox')"> + +<p>Both bars should be the same width</p> +<div class="flexbox column" style="width: 400px;"> + <div data-expected-width="200" style="margin-left: 50%; width: 50%; background: green;"> + Content + </div> +</div> + +<div class="flexbox column" style="width: 400px;"> + <div data-expected-width="200" style="margin-left: 50%; max-width: 50%; background: blue;"> + Content + </div> +</div>
diff --git a/third_party/WebKit/Source/core/dom/Document.cpp b/third_party/WebKit/Source/core/dom/Document.cpp index 2a0fec7..7e71bc5 100644 --- a/third_party/WebKit/Source/core/dom/Document.cpp +++ b/third_party/WebKit/Source/core/dom/Document.cpp
@@ -4377,7 +4377,7 @@ mojom::blink::SensitiveInputVisibilityServicePtr sensitiveInputServicePtr; frame()->interfaceProvider()->getInterface( - mojo::GetProxy(&sensitiveInputServicePtr)); + mojo::MakeRequest(&sensitiveInputServicePtr)); if (m_passwordCount > 0) { sensitiveInputServicePtr->PasswordFieldVisibleInInsecureContext(); return;
diff --git a/third_party/WebKit/Source/core/layout/LayoutFlexibleBox.cpp b/third_party/WebKit/Source/core/layout/LayoutFlexibleBox.cpp index 0a17cb9..c765794 100644 --- a/third_party/WebKit/Source/core/layout/LayoutFlexibleBox.cpp +++ b/third_party/WebKit/Source/core/layout/LayoutFlexibleBox.cpp
@@ -2132,8 +2132,8 @@ LayoutUnit childWidth = (lineCrossAxisExtent - crossAxisMarginExtentForChild(child)) .clampNegativeToZero(); - childWidth = - child.constrainLogicalWidthByMinMax(childWidth, childWidth, this); + childWidth = child.constrainLogicalWidthByMinMax( + childWidth, crossAxisContentExtent(), this); if (childWidth != child.logicalWidth()) { child.setOverrideLogicalContentWidth(
diff --git a/third_party/WebKit/Source/modules/background_sync/SyncManager.cpp b/third_party/WebKit/Source/modules/background_sync/SyncManager.cpp index 2375cbca..618149be 100644 --- a/third_party/WebKit/Source/modules/background_sync/SyncManager.cpp +++ b/third_party/WebKit/Source/modules/background_sync/SyncManager.cpp
@@ -70,7 +70,7 @@ SyncManager::getBackgroundSyncServicePtr() { if (!m_backgroundSyncService.get()) { Platform::current()->interfaceProvider()->getInterface( - mojo::GetProxy(&m_backgroundSyncService)); + mojo::MakeRequest(&m_backgroundSyncService)); } return m_backgroundSyncService; }
diff --git a/third_party/WebKit/Source/modules/battery/BatteryDispatcher.cpp b/third_party/WebKit/Source/modules/battery/BatteryDispatcher.cpp index 7b7891d..942567dec 100644 --- a/third_party/WebKit/Source/modules/battery/BatteryDispatcher.cpp +++ b/third_party/WebKit/Source/modules/battery/BatteryDispatcher.cpp
@@ -45,7 +45,7 @@ void BatteryDispatcher::startListening() { DCHECK(!m_monitor.is_bound()); Platform::current()->interfaceProvider()->getInterface( - mojo::GetProxy(&m_monitor)); + mojo::MakeRequest(&m_monitor)); queryNextStatus(); }
diff --git a/third_party/WebKit/Source/modules/broadcastchannel/BroadcastChannel.cpp b/third_party/WebKit/Source/modules/broadcastchannel/BroadcastChannel.cpp index 707da82..03063fa4 100644 --- a/third_party/WebKit/Source/modules/broadcastchannel/BroadcastChannel.cpp +++ b/third_party/WebKit/Source/modules/broadcastchannel/BroadcastChannel.cpp
@@ -28,7 +28,7 @@ new ThreadSpecific<mojom::blink::BroadcastChannelProviderPtr>); if (!provider.isSet()) { Platform::current()->interfaceProvider()->getInterface( - mojo::GetProxy(&*provider)); + mojo::MakeRequest(&*provider)); } return *provider; }
diff --git a/third_party/WebKit/Source/modules/budget/BudgetService.cpp b/third_party/WebKit/Source/modules/budget/BudgetService.cpp index fda4afeb..5308d86 100644 --- a/third_party/WebKit/Source/modules/budget/BudgetService.cpp +++ b/third_party/WebKit/Source/modules/budget/BudgetService.cpp
@@ -44,7 +44,7 @@ BudgetService::BudgetService() { Platform::current()->interfaceProvider()->getInterface( - mojo::GetProxy(&m_service)); + mojo::MakeRequest(&m_service)); // Set a connection error handler, so that if an embedder doesn't // implement a BudgetSerice mojo service, the developer will get a
diff --git a/third_party/WebKit/Source/modules/geolocation/Geolocation.cpp b/third_party/WebKit/Source/modules/geolocation/Geolocation.cpp index 49d77234..921da19 100644 --- a/third_party/WebKit/Source/modules/geolocation/Geolocation.cpp +++ b/third_party/WebKit/Source/modules/geolocation/Geolocation.cpp
@@ -423,7 +423,7 @@ m_geolocationPermission = PermissionRequested; frame->interfaceProvider()->getInterface( - mojo::GetProxy(&m_permissionService)); + mojo::MakeRequest(&m_permissionService)); m_permissionService.set_connection_error_handler( convertToBaseCallback(WTF::bind(&Geolocation::onPermissionConnectionError, wrapWeakPersistent(this)))); @@ -495,7 +495,7 @@ return; frame()->interfaceProvider()->getInterface( - mojo::GetProxy(&m_geolocationService)); + mojo::MakeRequest(&m_geolocationService)); m_geolocationService.set_connection_error_handler(convertToBaseCallback( WTF::bind(&Geolocation::onGeolocationConnectionError, wrapWeakPersistent(this))));
diff --git a/third_party/WebKit/Source/modules/imagecapture/ImageCapture.cpp b/third_party/WebKit/Source/modules/imagecapture/ImageCapture.cpp index cde4775d..d07159f 100644 --- a/third_party/WebKit/Source/modules/imagecapture/ImageCapture.cpp +++ b/third_party/WebKit/Source/modules/imagecapture/ImageCapture.cpp
@@ -273,7 +273,7 @@ DCHECK(!m_service.is_bound()); Platform::current()->interfaceProvider()->getInterface( - mojo::GetProxy(&m_service)); + mojo::MakeRequest(&m_service)); m_service.set_connection_error_handler(convertToBaseCallback(WTF::bind( &ImageCapture::onServiceConnectionError, wrapWeakPersistent(this))));
diff --git a/third_party/WebKit/Source/modules/mediasession/MediaSession.cpp b/third_party/WebKit/Source/modules/mediasession/MediaSession.cpp index a1d0e46..50c4613 100644 --- a/third_party/WebKit/Source/modules/mediasession/MediaSession.cpp +++ b/third_party/WebKit/Source/modules/mediasession/MediaSession.cpp
@@ -164,7 +164,7 @@ if (!interfaceProvider) return nullptr; - interfaceProvider->getInterface(mojo::GetProxy(&m_service)); + interfaceProvider->getInterface(mojo::MakeRequest(&m_service)); if (m_service.get()) m_service->SetClient(m_clientBinding.CreateInterfacePtrAndBind());
diff --git a/third_party/WebKit/Source/modules/nfc/NFC.cpp b/third_party/WebKit/Source/modules/nfc/NFC.cpp index 3cf1e87a..0f0a5b7 100644 --- a/third_party/WebKit/Source/modules/nfc/NFC.cpp +++ b/third_party/WebKit/Source/modules/nfc/NFC.cpp
@@ -574,7 +574,7 @@ : PageVisibilityObserver(frame->page()), ContextLifecycleObserver(frame->document()), m_client(this) { - frame->interfaceProvider()->getInterface(mojo::GetProxy(&m_nfc)); + frame->interfaceProvider()->getInterface(mojo::MakeRequest(&m_nfc)); m_nfc.set_connection_error_handler(convertToBaseCallback( WTF::bind(&NFC::OnConnectionError, wrapWeakPersistent(this)))); m_nfc->SetClient(m_client.CreateInterfacePtrAndBind());
diff --git a/third_party/WebKit/Source/modules/notifications/NotificationManager.cpp b/third_party/WebKit/Source/modules/notifications/NotificationManager.cpp index 07dd280f..f3951aa 100644 --- a/third_party/WebKit/Source/modules/notifications/NotificationManager.cpp +++ b/third_party/WebKit/Source/modules/notifications/NotificationManager.cpp
@@ -47,9 +47,10 @@ mojom::blink::PermissionStatus NotificationManager::permissionStatus( ExecutionContext* executionContext) { - if (!m_notificationService) + if (!m_notificationService) { Platform::current()->interfaceProvider()->getInterface( - mojo::GetProxy(&m_notificationService)); + mojo::MakeRequest(&m_notificationService)); + } mojom::blink::PermissionStatus permissionStatus; const bool result = m_notificationService->GetPermissionStatus( @@ -65,7 +66,8 @@ ExecutionContext* context = scriptState->getExecutionContext(); if (!m_permissionService) { - connectToPermissionService(context, mojo::GetProxy(&m_permissionService)); + connectToPermissionService(context, + mojo::MakeRequest(&m_permissionService)); m_permissionService.set_connection_error_handler(convertToBaseCallback( WTF::bind(&NotificationManager::onPermissionServiceConnectionError, wrapWeakPersistent(this))));
diff --git a/third_party/WebKit/Source/modules/payments/PaymentAppManager.cpp b/third_party/WebKit/Source/modules/payments/PaymentAppManager.cpp index 501f479..d7ec888 100644 --- a/third_party/WebKit/Source/modules/payments/PaymentAppManager.cpp +++ b/third_party/WebKit/Source/modules/payments/PaymentAppManager.cpp
@@ -136,7 +136,7 @@ : m_registration(registration) { DCHECK(registration); Platform::current()->interfaceProvider()->getInterface( - mojo::GetProxy(&m_manager)); + mojo::MakeRequest(&m_manager)); m_manager.set_connection_error_handler(convertToBaseCallback(WTF::bind( &PaymentAppManager::onServiceConnectionError, wrapWeakPersistent(this))));
diff --git a/third_party/WebKit/Source/modules/payments/PaymentRequest.cpp b/third_party/WebKit/Source/modules/payments/PaymentRequest.cpp index 4368664..42630cb 100644 --- a/third_party/WebKit/Source/modules/payments/PaymentRequest.cpp +++ b/third_party/WebKit/Source/modules/payments/PaymentRequest.cpp
@@ -707,7 +707,7 @@ m_shippingType = getValidShippingType(m_options.shippingType()); document.frame()->interfaceProvider()->getInterface( - mojo::GetProxy(&m_paymentProvider)); + mojo::MakeRequest(&m_paymentProvider)); m_paymentProvider.set_connection_error_handler(convertToBaseCallback( WTF::bind(&PaymentRequest::OnError, wrapWeakPersistent(this), PaymentErrorReason::UNKNOWN)));
diff --git a/third_party/WebKit/Source/modules/permissions/PermissionStatus.cpp b/third_party/WebKit/Source/modules/permissions/PermissionStatus.cpp index 2f59ffa..41e71ae 100644 --- a/third_party/WebKit/Source/modules/permissions/PermissionStatus.cpp +++ b/third_party/WebKit/Source/modules/permissions/PermissionStatus.cpp
@@ -84,7 +84,8 @@ void PermissionStatus::startListening() { DCHECK(!m_service); - connectToPermissionService(getExecutionContext(), mojo::GetProxy(&m_service)); + connectToPermissionService(getExecutionContext(), + mojo::MakeRequest(&m_service)); m_service->GetNextPermissionChange( m_descriptor->Clone(), getExecutionContext()->getSecurityOrigin(), m_status,
diff --git a/third_party/WebKit/Source/modules/permissions/Permissions.cpp b/third_party/WebKit/Source/modules/permissions/Permissions.cpp index 0050013..22a986cf 100644 --- a/third_party/WebKit/Source/modules/permissions/Permissions.cpp +++ b/third_party/WebKit/Source/modules/permissions/Permissions.cpp
@@ -257,8 +257,8 @@ } PermissionService* Permissions::getService(ExecutionContext* executionContext) { - if (!m_service && - connectToPermissionService(executionContext, mojo::GetProxy(&m_service))) + if (!m_service && connectToPermissionService(executionContext, + mojo::MakeRequest(&m_service))) m_service.set_connection_error_handler(convertToBaseCallback(WTF::bind( &Permissions::serviceConnectionError, wrapWeakPersistent(this)))); return m_service.get();
diff --git a/third_party/WebKit/Source/modules/quota/StorageManager.cpp b/third_party/WebKit/Source/modules/quota/StorageManager.cpp index c49c45e..ed5c5f2 100644 --- a/third_party/WebKit/Source/modules/quota/StorageManager.cpp +++ b/third_party/WebKit/Source/modules/quota/StorageManager.cpp
@@ -142,7 +142,7 @@ ExecutionContext* executionContext) { if (!m_permissionService && connectToPermissionService(executionContext, - mojo::GetProxy(&m_permissionService))) + mojo::MakeRequest(&m_permissionService))) m_permissionService.set_connection_error_handler(convertToBaseCallback( WTF::bind(&StorageManager::permissionServiceConnectionError, wrapWeakPersistent(this))));
diff --git a/third_party/WebKit/Source/modules/sensor/SensorProviderProxy.cpp b/third_party/WebKit/Source/modules/sensor/SensorProviderProxy.cpp index be951e0..20d7679 100644 --- a/third_party/WebKit/Source/modules/sensor/SensorProviderProxy.cpp +++ b/third_party/WebKit/Source/modules/sensor/SensorProviderProxy.cpp
@@ -20,7 +20,8 @@ void SensorProviderProxy::initialize(LocalFrame* frame) { DCHECK(!isInitialized()); - frame->interfaceProvider()->getInterface(mojo::GetProxy(&m_sensorProvider)); + frame->interfaceProvider()->getInterface( + mojo::MakeRequest(&m_sensorProvider)); m_sensorProvider.set_connection_error_handler(convertToBaseCallback( WTF::bind(&SensorProviderProxy::onSensorProviderConnectionError, wrapWeakPersistent(this))));
diff --git a/third_party/WebKit/Source/modules/sensor/SensorProxy.cpp b/third_party/WebKit/Source/modules/sensor/SensorProxy.cpp index 44df768..632a04d 100644 --- a/third_party/WebKit/Source/modules/sensor/SensorProxy.cpp +++ b/third_party/WebKit/Source/modules/sensor/SensorProxy.cpp
@@ -63,8 +63,8 @@ m_state = Initializing; auto callback = convertToBaseCallback( WTF::bind(&SensorProxy::onSensorCreated, wrapWeakPersistent(this))); - m_provider->getSensorProvider()->GetSensor(m_type, mojo::GetProxy(&m_sensor), - callback); + m_provider->getSensorProvider()->GetSensor( + m_type, mojo::MakeRequest(&m_sensor), callback); } void SensorProxy::addConfiguration(
diff --git a/third_party/WebKit/Source/modules/shapedetection/BarcodeDetector.cpp b/third_party/WebKit/Source/modules/shapedetection/BarcodeDetector.cpp index 647bf50..cf82763b 100644 --- a/third_party/WebKit/Source/modules/shapedetection/BarcodeDetector.cpp +++ b/third_party/WebKit/Source/modules/shapedetection/BarcodeDetector.cpp
@@ -20,7 +20,7 @@ } BarcodeDetector::BarcodeDetector(LocalFrame& frame) : ShapeDetector(frame) { - frame.interfaceProvider()->getInterface(mojo::GetProxy(&m_barcodeService)); + frame.interfaceProvider()->getInterface(mojo::MakeRequest(&m_barcodeService)); m_barcodeService.set_connection_error_handler(convertToBaseCallback( WTF::bind(&BarcodeDetector::onBarcodeServiceConnectionError, wrapWeakPersistent(this))));
diff --git a/third_party/WebKit/Source/modules/shapedetection/FaceDetector.cpp b/third_party/WebKit/Source/modules/shapedetection/FaceDetector.cpp index 982ecd4..060c66f8 100644 --- a/third_party/WebKit/Source/modules/shapedetection/FaceDetector.cpp +++ b/third_party/WebKit/Source/modules/shapedetection/FaceDetector.cpp
@@ -29,8 +29,8 @@ faceDetectorOptions->max_detected_faces = options.maxDetectedFaces(); faceDetectorOptions->fast_mode = options.fastMode(); mojom::blink::FaceDetectionProviderPtr provider; - frame.interfaceProvider()->getInterface(mojo::GetProxy(&provider)); - provider->CreateFaceDetection(mojo::GetProxy(&m_faceService), + frame.interfaceProvider()->getInterface(mojo::MakeRequest(&provider)); + provider->CreateFaceDetection(mojo::MakeRequest(&m_faceService), std::move(faceDetectorOptions)); m_faceService.set_connection_error_handler(convertToBaseCallback(WTF::bind(
diff --git a/third_party/WebKit/Source/modules/time_zone_monitor/TimeZoneMonitorClient.cpp b/third_party/WebKit/Source/modules/time_zone_monitor/TimeZoneMonitorClient.cpp index 4d211c04..18e2ff1 100644 --- a/third_party/WebKit/Source/modules/time_zone_monitor/TimeZoneMonitorClient.cpp +++ b/third_party/WebKit/Source/modules/time_zone_monitor/TimeZoneMonitorClient.cpp
@@ -37,7 +37,7 @@ device::mojom::blink::TimeZoneMonitorPtr monitor; Platform::current()->interfaceProvider()->getInterface( - mojo::GetProxy(&monitor)); + mojo::MakeRequest(&monitor)); monitor->AddClient(instance.m_binding.CreateInterfacePtrAndBind()); }
diff --git a/third_party/WebKit/Source/modules/vibration/VibrationController.cpp b/third_party/WebKit/Source/modules/vibration/VibrationController.cpp index 35e4ad1..0e518f9 100644 --- a/third_party/WebKit/Source/modules/vibration/VibrationController.cpp +++ b/third_party/WebKit/Source/modules/vibration/VibrationController.cpp
@@ -81,7 +81,7 @@ m_isCallingCancel(false), m_isCallingVibrate(false) { document.frame()->interfaceProvider()->getInterface( - mojo::GetProxy(&m_service)); + mojo::MakeRequest(&m_service)); } VibrationController::~VibrationController() {}
diff --git a/third_party/WebKit/Source/modules/vr/VRController.cpp b/third_party/WebKit/Source/modules/vr/VRController.cpp index 692fcbd..52a02079 100644 --- a/third_party/WebKit/Source/modules/vr/VRController.cpp +++ b/third_party/WebKit/Source/modules/vr/VRController.cpp
@@ -22,7 +22,7 @@ m_displaySynced(false), m_binding(this) { navigatorVR->document()->frame()->interfaceProvider()->getInterface( - mojo::GetProxy(&m_service)); + mojo::MakeRequest(&m_service)); m_service->SetClient( m_binding.CreateInterfacePtrAndBind(), convertToBaseCallback(
diff --git a/third_party/WebKit/Source/modules/wake_lock/ScreenWakeLock.cpp b/third_party/WebKit/Source/modules/wake_lock/ScreenWakeLock.cpp index ac76134..522b215 100644 --- a/third_party/WebKit/Source/modules/wake_lock/ScreenWakeLock.cpp +++ b/third_party/WebKit/Source/modules/wake_lock/ScreenWakeLock.cpp
@@ -67,7 +67,7 @@ m_keepAwake(false) { DCHECK(!m_service.is_bound()); DCHECK(frame.interfaceProvider()); - frame.interfaceProvider()->getInterface(mojo::GetProxy(&m_service)); + frame.interfaceProvider()->getInterface(mojo::MakeRequest(&m_service)); } bool ScreenWakeLock::keepAwake() const {
diff --git a/third_party/WebKit/Source/modules/webmidi/MIDIAccessInitializer.cpp b/third_party/WebKit/Source/modules/webmidi/MIDIAccessInitializer.cpp index cb81adc..fd8e307 100644 --- a/third_party/WebKit/Source/modules/webmidi/MIDIAccessInitializer.cpp +++ b/third_party/WebKit/Source/modules/webmidi/MIDIAccessInitializer.cpp
@@ -40,7 +40,7 @@ m_accessor = MIDIAccessor::create(this); connectToPermissionService(getExecutionContext(), - mojo::GetProxy(&m_permissionService)); + mojo::MakeRequest(&m_permissionService)); m_permissionService->RequestPermission( createMidiPermissionDescriptor(m_options.hasSysex() && m_options.sysex()), getExecutionContext()->getSecurityOrigin(),
diff --git a/third_party/WebKit/Source/modules/webshare/NavigatorShare.cpp b/third_party/WebKit/Source/modules/webshare/NavigatorShare.cpp index 9004c72..de92c36a 100644 --- a/third_party/WebKit/Source/modules/webshare/NavigatorShare.cpp +++ b/third_party/WebKit/Source/modules/webshare/NavigatorShare.cpp
@@ -100,7 +100,7 @@ if (!m_service) { LocalFrame* frame = doc->frame(); DCHECK(frame); - frame->interfaceProvider()->getInterface(mojo::GetProxy(&m_service)); + frame->interfaceProvider()->getInterface(mojo::MakeRequest(&m_service)); m_service.set_connection_error_handler(convertToBaseCallback(WTF::bind( &NavigatorShare::onConnectionError, wrapWeakPersistent(this)))); DCHECK(m_service);
diff --git a/third_party/WebKit/Source/modules/websockets/WebSocketHandleImpl.cpp b/third_party/WebKit/Source/modules/websockets/WebSocketHandleImpl.cpp index ee031e1..efc1aa3 100644 --- a/third_party/WebKit/Source/modules/websockets/WebSocketHandleImpl.cpp +++ b/third_party/WebKit/Source/modules/websockets/WebSocketHandleImpl.cpp
@@ -40,7 +40,7 @@ NETWORK_DVLOG(1) << this << " initialize(...)"; DCHECK(!m_websocket); - interfaceProvider->getInterface(mojo::GetProxy(&m_websocket)); + interfaceProvider->getInterface(mojo::MakeRequest(&m_websocket)); m_websocket.set_connection_error_with_reason_handler( convertToBaseCallback(WTF::bind(&WebSocketHandleImpl::onConnectionError,
diff --git a/third_party/WebKit/Source/modules/webusb/USB.cpp b/third_party/WebKit/Source/modules/webusb/USB.cpp index d3f179b5..c2ec9d3 100644 --- a/third_party/WebKit/Source/modules/webusb/USB.cpp +++ b/third_party/WebKit/Source/modules/webusb/USB.cpp
@@ -53,7 +53,7 @@ USB::USB(LocalFrame& frame) : ContextLifecycleObserver(frame.document()), m_clientBinding(this) { - frame.interfaceProvider()->getInterface(mojo::GetProxy(&m_deviceManager)); + frame.interfaceProvider()->getInterface(mojo::MakeRequest(&m_deviceManager)); m_deviceManager.set_connection_error_handler(convertToBaseCallback(WTF::bind( &USB::onDeviceManagerConnectionError, wrapWeakPersistent(this)))); m_deviceManager->SetClient(m_clientBinding.CreateInterfacePtrAndBind()); @@ -112,7 +112,8 @@ resolver->reject(DOMException::create(NotSupportedError)); return promise; } - frame->interfaceProvider()->getInterface(mojo::GetProxy(&m_chooserService)); + frame->interfaceProvider()->getInterface( + mojo::MakeRequest(&m_chooserService)); m_chooserService.set_connection_error_handler( convertToBaseCallback(WTF::bind(&USB::onChooserServiceConnectionError, wrapWeakPersistent(this)))); @@ -161,7 +162,7 @@ if (!device) { String guid = deviceInfo->guid; usb::DevicePtr pipe; - m_deviceManager->GetDevice(guid, mojo::GetProxy(&pipe)); + m_deviceManager->GetDevice(guid, mojo::MakeRequest(&pipe)); device = USBDevice::create(std::move(deviceInfo), std::move(pipe), getExecutionContext()); m_deviceCache.add(guid, device);
diff --git a/third_party/WebKit/Source/platform/graphics/CanvasSurfaceLayerBridge.cpp b/third_party/WebKit/Source/platform/graphics/CanvasSurfaceLayerBridge.cpp index 0c58ec6..036fc041 100644 --- a/third_party/WebKit/Source/platform/graphics/CanvasSurfaceLayerBridge.cpp +++ b/third_party/WebKit/Source/platform/graphics/CanvasSurfaceLayerBridge.cpp
@@ -66,10 +66,10 @@ DCHECK(!m_service.is_bound()); mojom::blink::OffscreenCanvasSurfaceFactoryPtr serviceFactory; Platform::current()->interfaceProvider()->getInterface( - mojo::GetProxy(&serviceFactory)); + mojo::MakeRequest(&serviceFactory)); serviceFactory->CreateOffscreenCanvasSurface( m_frameSinkId, m_binding.CreateInterfacePtrAndBind(), - mojo::GetProxy(&m_service)); + mojo::MakeRequest(&m_service)); } CanvasSurfaceLayerBridge::~CanvasSurfaceLayerBridge() {
diff --git a/third_party/WebKit/Source/platform/graphics/OffscreenCanvasFrameDispatcherImpl.cpp b/third_party/WebKit/Source/platform/graphics/OffscreenCanvasFrameDispatcherImpl.cpp index f1c74dc..d3291101 100644 --- a/third_party/WebKit/Source/platform/graphics/OffscreenCanvasFrameDispatcherImpl.cpp +++ b/third_party/WebKit/Source/platform/graphics/OffscreenCanvasFrameDispatcherImpl.cpp
@@ -43,10 +43,10 @@ DCHECK(!m_sink.is_bound()); mojom::blink::OffscreenCanvasCompositorFrameSinkProviderPtr provider; Platform::current()->interfaceProvider()->getInterface( - mojo::GetProxy(&provider)); + mojo::MakeRequest(&provider)); provider->CreateCompositorFrameSink(m_frameSinkId, m_binding.CreateInterfacePtrAndBind(), - mojo::GetProxy(&m_sink)); + mojo::MakeRequest(&m_sink)); } void OffscreenCanvasFrameDispatcherImpl::setTransferableResourceToSharedBitmap(
diff --git a/third_party/WebKit/Source/platform/mojo/CommonCustomTypesStructTraitsTest.cpp b/third_party/WebKit/Source/platform/mojo/CommonCustomTypesStructTraitsTest.cpp index f208d99..80e3588 100644 --- a/third_party/WebKit/Source/platform/mojo/CommonCustomTypesStructTraitsTest.cpp +++ b/third_party/WebKit/Source/platform/mojo/CommonCustomTypesStructTraitsTest.cpp
@@ -44,7 +44,7 @@ TEST_F(CommonCustomTypesStructTraitsTest, String16) { mojo::common::test::blink::TestString16Ptr ptr; - TestString16Impl impl(GetProxy(&ptr)); + TestString16Impl impl(MakeRequest(&ptr)); // |str| is 8-bit. String str = String::fromUTF8("hello world"); @@ -63,7 +63,7 @@ TEST_F(CommonCustomTypesStructTraitsTest, EmptyString16) { mojo::common::test::blink::TestString16Ptr ptr; - TestString16Impl impl(GetProxy(&ptr)); + TestString16Impl impl(MakeRequest(&ptr)); String str = String::fromUTF8(""); String output;
diff --git a/third_party/WebKit/Source/platform/mojo/KURLSecurityOriginTest.cpp b/third_party/WebKit/Source/platform/mojo/KURLSecurityOriginTest.cpp index 61845cc..59e4da46 100644 --- a/third_party/WebKit/Source/platform/mojo/KURLSecurityOriginTest.cpp +++ b/third_party/WebKit/Source/platform/mojo/KURLSecurityOriginTest.cpp
@@ -38,7 +38,7 @@ base::MessageLoop messageLoop; url::mojom::blink::UrlTestPtr proxy; - UrlTestImpl impl(GetProxy(&proxy)); + UrlTestImpl impl(MakeRequest(&proxy)); const char* serializeCases[] = { "http://www.google.com/", "http://user:pass@host.com:888/foo;bar?baz#nop",
diff --git a/third_party/WebKit/Source/platform/network/mime/MIMETypeRegistry.cpp b/third_party/WebKit/Source/platform/network/mime/MIMETypeRegistry.cpp index 5a21f4ed..d3ba4637 100644 --- a/third_party/WebKit/Source/platform/network/mime/MIMETypeRegistry.cpp +++ b/third_party/WebKit/Source/platform/network/mime/MIMETypeRegistry.cpp
@@ -24,7 +24,7 @@ public: MimeRegistryPtrHolder() { Platform::current()->interfaceProvider()->getInterface( - mojo::GetProxy(&mimeRegistry)); + mojo::MakeRequest(&mimeRegistry)); } ~MimeRegistryPtrHolder() {}
diff --git a/third_party/WebKit/Source/platform/scheduler/renderer/renderer_scheduler_impl_unittest.cc b/third_party/WebKit/Source/platform/scheduler/renderer/renderer_scheduler_impl_unittest.cc index fb05ed4..fda7d476 100644 --- a/third_party/WebKit/Source/platform/scheduler/renderer/renderer_scheduler_impl_unittest.cc +++ b/third_party/WebKit/Source/platform/scheduler/renderer/renderer_scheduler_impl_unittest.cc
@@ -2285,6 +2285,14 @@ RunUntilIdle(); EXPECT_THAT(run_order, testing::ElementsAre(std::string("L1"), std::string("T1"))); + + run_order.clear(); + PostTestTasks(&run_order, "D2 T2"); + // The renderer is foregrounded. Suspending doesn't take effect. + scheduler_->SuspendRenderer(); + RunUntilIdle(); + EXPECT_THAT(run_order, + testing::ElementsAre(std::string("D2"), std::string("T2"))); } TEST_F(RendererSchedulerImplTest, ResumeRenderer) { @@ -2336,6 +2344,14 @@ RunUntilIdle(); EXPECT_THAT(run_order, testing::ElementsAre(std::string("D3"), std::string("T3"))); + + run_order.clear(); + PostTestTasks(&run_order, "D4 T4"); + // The renderer is foregrounded. Resuming doesn't take effect. + scheduler_->ResumeRenderer(); + RunUntilIdle(); + EXPECT_THAT(run_order, + testing::ElementsAre(std::string("D4"), std::string("T4"))); } TEST_F(RendererSchedulerImplTest, UseCaseToString) {
diff --git a/third_party/WebKit/Source/platform/text/hyphenation/HyphenationMinikin.cpp b/third_party/WebKit/Source/platform/text/hyphenation/HyphenationMinikin.cpp index 9ff19bf7..18d4e204 100644 --- a/third_party/WebKit/Source/platform/text/hyphenation/HyphenationMinikin.cpp +++ b/third_party/WebKit/Source/platform/text/hyphenation/HyphenationMinikin.cpp
@@ -38,7 +38,7 @@ static mojom::blink::HyphenationPtr connectToRemoteService() { mojom::blink::HyphenationPtr service; Platform::current()->interfaceProvider()->getInterface( - mojo::GetProxy(&service)); + mojo::MakeRequest(&service)); return service; }
diff --git a/tools/metrics/histograms/histograms.xml b/tools/metrics/histograms/histograms.xml index e3e89d6..30ef6d0 100644 --- a/tools/metrics/histograms/histograms.xml +++ b/tools/metrics/histograms/histograms.xml
@@ -110100,6 +110100,15 @@ <suffix name="BackgroundLaunch" label="Time from onLaunched event is called to the window is created."/> <suffix name="BackgroundRestart" label="Time to create a window on restart."/> + <suffix name="ImportElements" + label="Time to initialize the polymer elements."/> + <suffix name="InitBackgroundPage" + label="Time to initialize the background page."/> + <suffix name="InitDocuments" + label="Time to initialize the background page and the elements."/> + <suffix name="InitSettings" label="Time to restore user settings."/> + <suffix name="InitUI" + label="Time to initialize all UI after all elements are initialized."/> <affected-histogram name="FileBrowser.Load"/> </histogram_suffixes>
diff --git a/ui/aura/mus/input_method_mus.cc b/ui/aura/mus/input_method_mus.cc index eb39d53f..4ad612e9 100644 --- a/ui/aura/mus/input_method_mus.cc +++ b/ui/aura/mus/input_method_mus.cc
@@ -127,7 +127,7 @@ text_input_client_ = base::MakeUnique<TextInputClientImpl>(focused); if (ime_server_) { ime_server_->StartSession(text_input_client_->CreateInterfacePtrAndBind(), - GetProxy(&input_method_)); + MakeRequest(&input_method_)); } }
diff --git a/ui/aura/mus/window_compositor_frame_sink.cc b/ui/aura/mus/window_compositor_frame_sink.cc index 7d252b89..6d645381 100644 --- a/ui/aura/mus/window_compositor_frame_sink.cc +++ b/ui/aura/mus/window_compositor_frame_sink.cc
@@ -20,10 +20,10 @@ cc::mojom::MojoCompositorFrameSinkClientPtr compositor_frame_sink_client; cc::mojom::MojoCompositorFrameSinkClientRequest compositor_frame_sink_client_request = - GetProxy(&compositor_frame_sink_client); + MakeRequest(&compositor_frame_sink_client); compositor_frame_sink_binding->reset(new WindowCompositorFrameSinkBinding( - GetProxy(&compositor_frame_sink), + MakeRequest(&compositor_frame_sink), compositor_frame_sink_client.PassInterface())); return base::WrapUnique(new WindowCompositorFrameSink( std::move(context_provider), gpu_memory_buffer_manager,
diff --git a/ui/aura/mus/window_tree_client.cc b/ui/aura/mus/window_tree_client.cc index 10a25a3..4aa192b4 100644 --- a/ui/aura/mus/window_tree_client.cc +++ b/ui/aura/mus/window_tree_client.cc
@@ -209,7 +209,7 @@ ui::mojom::WindowTreeFactoryPtr factory; connector_->ConnectToInterface(ui::mojom::kServiceName, &factory); ui::mojom::WindowTreePtr window_tree; - factory->CreateWindowTree(GetProxy(&window_tree), + factory->CreateWindowTree(MakeRequest(&window_tree), binding_.CreateInterfacePtrAndBind()); SetWindowTree(std::move(window_tree)); } @@ -220,7 +220,7 @@ ui::mojom::WindowManagerWindowTreeFactoryPtr factory; connector_->ConnectToInterface(ui::mojom::kServiceName, &factory); ui::mojom::WindowTreePtr window_tree; - factory->CreateWindowTree(GetProxy(&window_tree), + factory->CreateWindowTree(MakeRequest(&window_tree), binding_.CreateInterfacePtrAndBind()); SetWindowTree(std::move(window_tree)); } @@ -445,8 +445,8 @@ &WindowTreeClient::OnConnectionLost, weak_factory_.GetWeakPtr())); if (window_manager_delegate_) { - tree_ptr_->GetWindowManagerClient(GetProxy(&window_manager_internal_client_, - tree_ptr_.associated_group())); + tree_ptr_->GetWindowManagerClient(MakeRequest( + &window_manager_internal_client_, tree_ptr_.associated_group())); } } @@ -843,8 +843,8 @@ is_from_embed_ = true; if (window_manager_delegate_) { - tree_ptr_->GetWindowManagerClient(GetProxy(&window_manager_internal_client_, - tree_ptr_.associated_group())); + tree_ptr_->GetWindowManagerClient(MakeRequest( + &window_manager_internal_client_, tree_ptr_.associated_group())); } OnEmbedImpl(tree_ptr_.get(), client_id, std::move(root_data), display_id,
diff --git a/ui/file_manager/file_manager/foreground/js/elements_importer.js b/ui/file_manager/file_manager/foreground/js/elements_importer.js index c821ad9..0d9d88d 100644 --- a/ui/file_manager/file_manager/foreground/js/elements_importer.js +++ b/ui/file_manager/file_manager/foreground/js/elements_importer.js
@@ -10,11 +10,17 @@ * elements for file manager UI are loaded. */ window.importElementsPromise = new Promise(function(resolve, reject) { + var startTime = Date.now(); + var link = document.createElement('link'); link.rel = 'import'; link.href = 'foreground/elements/elements_bundle.html'; link.setAttribute('async', ''); - link.onload = resolve; + link.onload = function() { + chrome.metricsPrivate.recordTime( + 'FileBrowser.Load.ImportElements', Date.now() - startTime); + resolve(); + }; link.onerror = reject; document.head.appendChild(link); });
diff --git a/ui/file_manager/file_manager/foreground/js/file_manager.js b/ui/file_manager/file_manager/foreground/js/file_manager.js index c2ead981..ea40548 100644 --- a/ui/file_manager/file_manager/foreground/js/file_manager.js +++ b/ui/file_manager/file_manager/foreground/js/file_manager.js
@@ -466,9 +466,13 @@ * @private */ FileManager.prototype.startInitSettings_ = function() { + metrics.startInterval('Load.InitSettings'); this.appStateController_ = new AppStateController(this.dialogType); return new Promise(function(resolve) { - this.appStateController_.loadInitialViewOptions().then(resolve); + this.appStateController_.loadInitialViewOptions().then(function() { + metrics.recordInterval('Load.InitSettings'); + resolve(); + }); }.bind(this)); }; @@ -715,16 +719,20 @@ this.dialogDom_ = dialogDom; this.document_ = this.dialogDom_.ownerDocument; + metrics.startInterval('Load.InitDocuments'); return Promise.all([ this.initBackgroundPagePromise_, window.importElementsPromise ]).then(function() { + metrics.recordInterval('Load.InitDocuments'); + metrics.startInterval('Load.InitUI'); this.initEssentialUI_(); this.initAdditionalUI_(); return this.initSettingsPromise_; }.bind(this)).then(function() { this.initFileSystemUI_(); this.initUIFocus_(); + metrics.recordInterval('Load.InitUI'); }.bind(this)); }; @@ -770,6 +778,7 @@ */ FileManager.prototype.startInitBackgroundPage_ = function() { return new Promise(function(resolve) { + metrics.startInterval('Load.InitBackgroundPage'); chrome.runtime.getBackgroundPage(/** @type {function(Window=)} */ ( function(opt_backgroundPage) { assert(opt_backgroundPage); @@ -787,6 +796,7 @@ this.backgroundPage_.background.mediaScanner; this.historyLoader_ = this.backgroundPage_.background.historyLoader; + metrics.recordInterval('Load.InitBackgroundPage'); resolve(); }.bind(this)); }.bind(this)));
diff --git a/ui/views/mus/input_method_mus.cc b/ui/views/mus/input_method_mus.cc index 9dd1c7c..ce274ca 100644 --- a/ui/views/mus/input_method_mus.cc +++ b/ui/views/mus/input_method_mus.cc
@@ -123,7 +123,7 @@ text_input_client_ = base::MakeUnique<TextInputClientImpl>(focused); ime_server_->StartSession(text_input_client_->CreateInterfacePtrAndBind(), - GetProxy(&input_method_)); + MakeRequest(&input_method_)); } void InputMethodMus::UpdateTextInputType() {
diff --git a/url/mojo/url_gurl_struct_traits_unittest.cc b/url/mojo/url_gurl_struct_traits_unittest.cc index 4f7e908..8556e0a 100644 --- a/url/mojo/url_gurl_struct_traits_unittest.cc +++ b/url/mojo/url_gurl_struct_traits_unittest.cc
@@ -38,7 +38,7 @@ base::MessageLoop message_loop; mojom::UrlTestPtr proxy; - UrlTestImpl impl(GetProxy(&proxy)); + UrlTestImpl impl(MakeRequest(&proxy)); const char* serialize_cases[] = { "http://www.google.com/",