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

Unified Diff: ash/desktop_background/desktop_background_controller.cc

Issue 1984433002: Hook up Chrome's wallpaper picker for mash. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments Created 4 years, 7 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
« no previous file with comments | « no previous file | ash/mus/BUILD.gn » ('j') | chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/desktop_background/desktop_background_controller.cc
diff --git a/ash/desktop_background/desktop_background_controller.cc b/ash/desktop_background/desktop_background_controller.cc
index a40974dcaf8174b084f175d032da0f561aa01099..15d18374548684a03ec22325f11dfcee20f926ed 100644
--- a/ash/desktop_background/desktop_background_controller.cc
+++ b/ash/desktop_background/desktop_background_controller.cc
@@ -161,19 +161,25 @@ void DesktopBackgroundController::OnRootWindowAdded(aura::Window* root_window) {
// static
gfx::Size DesktopBackgroundController::GetMaxDisplaySizeInNative() {
+ // Return an empty size for test environments where the screen is null.
+ if (!display::Screen::GetScreen())
+ return gfx::Size();
+
int width = 0;
int height = 0;
- std::vector<display::Display> displays =
- display::Screen::GetScreen()->GetAllDisplays();
- DisplayManager* display_manager = Shell::GetInstance()->display_manager();
-
- for (std::vector<display::Display>::iterator iter = displays.begin();
- iter != displays.end(); ++iter) {
+ DisplayManager* display_manager =
+ Shell::HasInstance() ? Shell::GetInstance()->display_manager() : nullptr;
+ for (auto& display : display::Screen::GetScreen()->GetAllDisplays()) {
dcheng 2016/05/24 18:53:37 Nit: const auto&?
msw 2016/05/24 22:06:37 Done.
// Don't use size_in_pixel because we want to use the native pixel size.
+ // TODO(msw): Fix this for Mash/Mus; see http://crbug.com/613657.
gfx::Size size_in_pixel =
- display_manager->GetDisplayInfo(iter->id()).bounds_in_native().size();
- if (iter->rotation() == display::Display::ROTATE_90 ||
- iter->rotation() == display::Display::ROTATE_270) {
+ display_manager
+ ? display_manager->GetDisplayInfo(display.id())
+ .bounds_in_native()
+ .size()
+ : display.size();
+ if (display.rotation() == display::Display::ROTATE_90 ||
+ display.rotation() == display::Display::ROTATE_270) {
size_in_pixel = gfx::Size(size_in_pixel.height(), size_in_pixel.width());
}
width = std::max(size_in_pixel.width(), width);
« no previous file with comments | « no previous file | ash/mus/BUILD.gn » ('j') | chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698