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

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

Issue 2413503002: Cleanup mojo Wallpaper interfaces for mash. (Closed)
Patch Set: Cleanup. Created 4 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.cc
diff --git a/chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.cc b/chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.cc
index 34437eb8a1d1b963d3e3f1059b8766b32c26f364..29d460ec4e123e43e4256091557727c1d8c3df6b 100644
--- a/chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.cc
+++ b/chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.cc
@@ -4,29 +4,19 @@
#include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h"
-#include <stdint.h>
-#include <numeric>
#include <utility>
-#include <vector>
#include "ash/common/ash_constants.h"
#include "ash/common/wallpaper/wallpaper_controller.h"
#include "ash/common/wm_shell.h"
-#include "ash/public/interfaces/wallpaper.mojom.h"
#include "base/bind.h"
#include "base/bind_helpers.h"
#include "base/command_line.h"
-#include "base/files/file_enumerator.h"
#include "base/files/file_path.h"
-#include "base/files/file_util.h"
#include "base/logging.h"
-#include "base/macros.h"
#include "base/metrics/histogram_macros.h"
-#include "base/path_service.h"
#include "base/sha1.h"
#include "base/strings/string_number_conversions.h"
-#include "base/strings/string_util.h"
-#include "base/strings/stringprintf.h"
#include "base/sys_info.h"
#include "base/threading/worker_pool.h"
#include "base/time/time.h"
@@ -35,25 +25,23 @@
#include "chrome/browser/browser_process.h"
#include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/chromeos/customization/customization_document.h"
+#include "chrome/browser/chromeos/extensions/wallpaper_manager_util.h"
#include "chrome/browser/chromeos/login/startup_utils.h"
+#include "chrome/browser/chromeos/login/users/avatar/user_image_loader.h"
#include "chrome/browser/chromeos/login/wizard_controller.h"
-#include "chrome/browser/chromeos/settings/cros_settings.h"
+#include "chrome/browser/image_decoder.h"
#include "chrome/browser/ui/ash/ash_util.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/pref_names.h"
#include "chromeos/chromeos_switches.h"
#include "chromeos/cryptohome/system_salt_getter.h"
-#include "chromeos/dbus/dbus_thread_manager.h"
#include "chromeos/login/user_names.h"
#include "components/prefs/pref_registry_simple.h"
#include "components/prefs/pref_service.h"
#include "components/prefs/scoped_user_pref_update.h"
#include "components/signin/core/account_id/account_id.h"
#include "components/user_manager/known_user.h"
-#include "components/user_manager/user.h"
-#include "components/user_manager/user_image/user_image.h"
-#include "components/user_manager/user_manager.h"
#include "components/user_manager/user_type.h"
#include "components/wallpaper/wallpaper_files_id.h"
#include "components/wallpaper/wallpaper_layout.h"
@@ -62,10 +50,6 @@
#include "content/public/common/content_switches.h"
#include "content/public/common/service_manager_connection.h"
#include "services/shell/public/cpp/connector.h"
-#include "third_party/skia/include/core/SkColor.h"
-#include "ui/gfx/codec/jpeg_codec.h"
-#include "ui/gfx/image/image_skia_operations.h"
-#include "ui/gfx/skia_util.h"
James Cook 2016/10/11 23:21:49 You're so good at keeping includes clean!
using content::BrowserThread;
using wallpaper::WallpaperManagerBase;
@@ -209,20 +193,22 @@ ash::mojom::WallpaperLayout WallpaperLayoutToMojo(
// A helper to set the wallpaper image for Ash and Mash.
void SetWallpaper(const gfx::ImageSkia& image,
wallpaper::WallpaperLayout layout) {
+ shell::Connector* connector =
+ content::ServiceManagerConnection::GetForProcess()->GetConnector();
+ if (!connector)
+ return;
+
+ ash::mojom::WallpaperControllerPtr wallpaper_controller;
+ // Under mash the WallpaperController interface is in the ash process. In
+ // classic ash we provide it to ourself.
if (chrome::IsRunningInMash()) {
- shell::Connector* connector =
- content::ServiceManagerConnection::GetForProcess()->GetConnector();
- ash::mojom::WallpaperControllerPtr wallpaper_controller;
connector->ConnectToInterface("service:ash", &wallpaper_controller);
- wallpaper_controller->SetWallpaper(*image.bitmap(),
- WallpaperLayoutToMojo(layout));
- return;
- }
- // Avoid loading unnecessary wallpapers in tests without a shell instance.
- if (ash::WmShell::HasInstance()) {
- ash::WmShell::Get()->wallpaper_controller()->SetWallpaperImage(image,
- layout);
+ } else {
+ connector->ConnectToInterface("service:content_browser",
+ &wallpaper_controller);
}
+ wallpaper_controller->SetWallpaper(*image.bitmap(),
+ WallpaperLayoutToMojo(layout));
}
} // namespace
@@ -400,6 +386,11 @@ void WallpaperManager::Shutdown() {
wallpaper_manager = nullptr;
}
+void WallpaperManager::BindRequest(
+ ash::mojom::WallpaperManagerRequest request) {
+ bindings_.AddBinding(this, std::move(request));
+}
+
WallpaperManager::WallpaperResolution
WallpaperManager::GetAppropriateResolution() {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
@@ -478,6 +469,10 @@ void WallpaperManager::InitializeWallpaper() {
SetUserWallpaperDelayed(user_manager->GetLoggedInUser()->GetAccountId());
}
+void WallpaperManager::Open() {
+ wallpaper_manager_util::OpenWallpaperManager();
+}
+
void WallpaperManager::Observe(int type,
const content::NotificationSource& source,
const content::NotificationDetails& details) {

Powered by Google App Engine
This is Rietveld 408576698