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

Side by Side 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: Fix gyp builds; address Sadrul's comment. 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 unified diff | Download patch
« no previous file with comments | « no previous file | ash/mus/BUILD.gn » ('j') | ash/mus/sysui_application.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "ash/desktop_background/desktop_background_controller.h" 5 #include "ash/desktop_background/desktop_background_controller.h"
6 6
7 #include "ash/ash_switches.h" 7 #include "ash/ash_switches.h"
8 #include "ash/desktop_background/desktop_background_controller_observer.h" 8 #include "ash/desktop_background/desktop_background_controller_observer.h"
9 #include "ash/desktop_background/desktop_background_view.h" 9 #include "ash/desktop_background/desktop_background_view.h"
10 #include "ash/desktop_background/desktop_background_widget_controller.h" 10 #include "ash/desktop_background/desktop_background_widget_controller.h"
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 158
159 InstallDesktopController(root_window); 159 InstallDesktopController(root_window);
160 } 160 }
161 161
162 // static 162 // static
163 gfx::Size DesktopBackgroundController::GetMaxDisplaySizeInNative() { 163 gfx::Size DesktopBackgroundController::GetMaxDisplaySizeInNative() {
164 int width = 0; 164 int width = 0;
165 int height = 0; 165 int height = 0;
166 std::vector<display::Display> displays = 166 std::vector<display::Display> displays =
167 display::Screen::GetScreen()->GetAllDisplays(); 167 display::Screen::GetScreen()->GetAllDisplays();
168 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); 168 DisplayManager* display_manager =
169 Shell::HasInstance() ? Shell::GetInstance()->display_manager() : nullptr;
169 170
170 for (std::vector<display::Display>::iterator iter = displays.begin(); 171 for (std::vector<display::Display>::iterator iter = displays.begin();
171 iter != displays.end(); ++iter) { 172 iter != displays.end(); ++iter) {
172 // Don't use size_in_pixel because we want to use the native pixel size. 173 // Don't use size_in_pixel because we want to use the native pixel size.
173 gfx::Size size_in_pixel = 174 // TODO(msw): Fix this for Mash/Mus.
James Cook 2016/05/19 22:29:59 So this will fail on high DPI, because iter->size(
msw 2016/05/20 19:53:05 Done.
174 display_manager->GetDisplayInfo(iter->id()).bounds_in_native().size(); 175 gfx::Size size_in_pixel = display_manager
176 ? display_manager->GetDisplayInfo(iter->id())
177 .bounds_in_native()
178 .size()
179 : iter->size();
175 if (iter->rotation() == display::Display::ROTATE_90 || 180 if (iter->rotation() == display::Display::ROTATE_90 ||
176 iter->rotation() == display::Display::ROTATE_270) { 181 iter->rotation() == display::Display::ROTATE_270) {
177 size_in_pixel = gfx::Size(size_in_pixel.height(), size_in_pixel.width()); 182 size_in_pixel = gfx::Size(size_in_pixel.height(), size_in_pixel.width());
178 } 183 }
179 width = std::max(size_in_pixel.width(), width); 184 width = std::max(size_in_pixel.width(), width);
180 height = std::max(size_in_pixel.height(), height); 185 height = std::max(size_in_pixel.height(), height);
181 } 186 }
182 return gfx::Size(width, height); 187 return gfx::Size(width, height);
183 } 188 }
184 189
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 : kShellWindowId_DesktopBackgroundContainer; 281 : kShellWindowId_DesktopBackgroundContainer;
277 } 282 }
278 283
279 void DesktopBackgroundController::UpdateWallpaper(bool clear_cache) { 284 void DesktopBackgroundController::UpdateWallpaper(bool clear_cache) {
280 current_wallpaper_.reset(NULL); 285 current_wallpaper_.reset(NULL);
281 ash::Shell::GetInstance()->user_wallpaper_delegate()->UpdateWallpaper( 286 ash::Shell::GetInstance()->user_wallpaper_delegate()->UpdateWallpaper(
282 clear_cache); 287 clear_cache);
283 } 288 }
284 289
285 } // namespace ash 290 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | ash/mus/BUILD.gn » ('j') | ash/mus/sysui_application.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698