Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(335)

Side by Side Diff: chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.cc

Issue 2617883002: Add a new BindInterface() method to Connector. (Closed)
Patch Set: . Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h" 5 #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "ash/common/ash_constants.h" 9 #include "ash/common/ash_constants.h"
10 #include "ash/common/wallpaper/wallpaper_controller.h" 10 #include "ash/common/wallpaper/wallpaper_controller.h"
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 void SetWallpaper(const gfx::ImageSkia& image, 197 void SetWallpaper(const gfx::ImageSkia& image,
198 wallpaper::WallpaperLayout layout) { 198 wallpaper::WallpaperLayout layout) {
199 if (chrome::IsRunningInMash()) { 199 if (chrome::IsRunningInMash()) {
200 // In mash, connect to the WallpaperController interface via mojo. 200 // In mash, connect to the WallpaperController interface via mojo.
201 service_manager::Connector* connector = 201 service_manager::Connector* connector =
202 content::ServiceManagerConnection::GetForProcess()->GetConnector(); 202 content::ServiceManagerConnection::GetForProcess()->GetConnector();
203 if (!connector) 203 if (!connector)
204 return; 204 return;
205 205
206 ash::mojom::WallpaperControllerPtr wallpaper_controller; 206 ash::mojom::WallpaperControllerPtr wallpaper_controller;
207 connector->ConnectToInterface(ash_util::GetAshServiceName(), 207 connector->BindInterface(ash_util::GetAshServiceName(),
208 &wallpaper_controller); 208 &wallpaper_controller);
209 // TODO(crbug.com/655875): Optimize ash wallpaper transport; avoid sending 209 // TODO(crbug.com/655875): Optimize ash wallpaper transport; avoid sending
210 // large bitmaps over Mojo; use shared memory like BitmapUploader, etc. 210 // large bitmaps over Mojo; use shared memory like BitmapUploader, etc.
211 wallpaper_controller->SetWallpaper(*image.bitmap(), layout); 211 wallpaper_controller->SetWallpaper(*image.bitmap(), layout);
212 } else if (ash::WmShell::HasInstance()) { 212 } else if (ash::WmShell::HasInstance()) {
213 // Note: Wallpaper setting is skipped in unit tests without shell instances. 213 // Note: Wallpaper setting is skipped in unit tests without shell instances.
214 // In classic ash, interact with the WallpaperController class directly. 214 // In classic ash, interact with the WallpaperController class directly.
215 ash::WmShell::Get()->wallpaper_controller()->SetWallpaperImage(image, 215 ash::WmShell::Get()->wallpaper_controller()->SetWallpaperImage(image,
216 layout); 216 layout);
217 } 217 }
218 } 218 }
(...skipping 661 matching lines...) Expand 10 before | Expand all | Expand 10 after
880 ->GetSequencedTaskRunnerWithShutdownBehavior( 880 ->GetSequencedTaskRunnerWithShutdownBehavior(
881 sequence_token_, base::SequencedWorkerPool::CONTINUE_ON_SHUTDOWN); 881 sequence_token_, base::SequencedWorkerPool::CONTINUE_ON_SHUTDOWN);
882 882
883 user_manager::UserManager::Get()->AddSessionStateObserver(this); 883 user_manager::UserManager::Get()->AddSessionStateObserver(this);
884 884
885 content::ServiceManagerConnection* connection = 885 content::ServiceManagerConnection* connection =
886 content::ServiceManagerConnection::GetForProcess(); 886 content::ServiceManagerConnection::GetForProcess();
887 if (connection && connection->GetConnector()) { 887 if (connection && connection->GetConnector()) {
888 // Connect to the wallpaper controller interface in the ash service. 888 // Connect to the wallpaper controller interface in the ash service.
889 ash::mojom::WallpaperControllerPtr wallpaper_controller_ptr; 889 ash::mojom::WallpaperControllerPtr wallpaper_controller_ptr;
890 connection->GetConnector()->ConnectToInterface( 890 connection->GetConnector()->BindInterface(ash_util::GetAshServiceName(),
891 ash_util::GetAshServiceName(), &wallpaper_controller_ptr); 891 &wallpaper_controller_ptr);
892 // Register this object as the wallpaper picker. 892 // Register this object as the wallpaper picker.
893 wallpaper_controller_ptr->SetWallpaperPicker( 893 wallpaper_controller_ptr->SetWallpaperPicker(
894 binding_.CreateInterfacePtrAndBind()); 894 binding_.CreateInterfacePtrAndBind());
895 } 895 }
896 } 896 }
897 897
898 WallpaperManager::PendingWallpaper* WallpaperManager::GetPendingWallpaper( 898 WallpaperManager::PendingWallpaper* WallpaperManager::GetPendingWallpaper(
899 const AccountId& account_id, 899 const AccountId& account_id,
900 bool delayed) { 900 bool delayed) {
901 if (!pending_inactive_) { 901 if (!pending_inactive_) {
(...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after
1406 1406
1407 UMA_HISTOGRAM_ENUMERATION( 1407 UMA_HISTOGRAM_ENUMERATION(
1408 "Ash.Wallpaper.Apps", 1408 "Ash.Wallpaper.Apps",
1409 wallpaper_manager_util::ShouldUseAndroidWallpapersApp(profile) 1409 wallpaper_manager_util::ShouldUseAndroidWallpapersApp(profile)
1410 ? WALLPAPERS_APP_ANDROID 1410 ? WALLPAPERS_APP_ANDROID
1411 : WALLPAPERS_PICKER_APP_CHROMEOS, 1411 : WALLPAPERS_PICKER_APP_CHROMEOS,
1412 WALLPAPERS_APPS_NUM); 1412 WALLPAPERS_APPS_NUM);
1413 } 1413 }
1414 1414
1415 } // namespace chromeos 1415 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/locale_change_guard.cc ('k') | chrome/browser/chromeos/settings/shutdown_policy_forwarder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698