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

Side by Side Diff: ash/common/wallpaper/wallpaper_controller.cc

Issue 2323063003: mash: Port sysui's WallpaperDelegateMus to mojo:ash. (Closed)
Patch Set: Alternative display info workaround. Created 4 years, 3 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/common/wallpaper/wallpaper_view.cc » ('j') | no next file with comments »
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/common/wallpaper/wallpaper_controller.h" 5 #include "ash/common/wallpaper/wallpaper_controller.h"
6 6
7 #include "ash/common/shell_window_ids.h" 7 #include "ash/common/shell_window_ids.h"
8 #include "ash/common/wallpaper/wallpaper_controller_observer.h" 8 #include "ash/common/wallpaper/wallpaper_controller_observer.h"
9 #include "ash/common/wallpaper/wallpaper_delegate.h" 9 #include "ash/common/wallpaper/wallpaper_delegate.h"
10 #include "ash/common/wallpaper/wallpaper_view.h" 10 #include "ash/common/wallpaper/wallpaper_view.h"
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 144
145 // Note that |shell| is null when this is called from Chrome running in Mash. 145 // Note that |shell| is null when this is called from Chrome running in Mash.
146 WmShell* shell = WmShell::Get(); 146 WmShell* shell = WmShell::Get();
147 147
148 gfx::Size max; 148 gfx::Size max;
149 for (const auto& display : display::Screen::GetScreen()->GetAllDisplays()) { 149 for (const auto& display : display::Screen::GetScreen()->GetAllDisplays()) {
150 // Use the native size, not ManagedDisplayInfo::size_in_pixel or 150 // Use the native size, not ManagedDisplayInfo::size_in_pixel or
151 // Display::size. 151 // Display::size.
152 // TODO(msw): Avoid using Display::size here; see http://crbug.com/613657. 152 // TODO(msw): Avoid using Display::size here; see http://crbug.com/613657.
153 gfx::Size size = display.size(); 153 gfx::Size size = display.size();
154 if (shell) 154 if (shell) {
155 size = shell->GetDisplayInfo(display.id()).bounds_in_native().size(); 155 display::ManagedDisplayInfo info = shell->GetDisplayInfo(display.id());
156 // TODO(mash): Mash returns a fake ManagedDisplayInfo. crbug.com/622480
sky 2016/09/09 22:17:01 Is wallpaper the only place that needs ManagedDisp
msw 2016/09/09 23:09:51 No, many places currently use ManagedDisplayInfo.
sky 2016/09/09 23:36:35 Ok, sounds reasonable to me to address fetching th
157 if (info.id() == display.id())
158 size = info.bounds_in_native().size();
159 }
156 if (display.rotation() == display::Display::ROTATE_90 || 160 if (display.rotation() == display::Display::ROTATE_90 ||
157 display.rotation() == display::Display::ROTATE_270) { 161 display.rotation() == display::Display::ROTATE_270) {
158 size = gfx::Size(size.height(), size.width()); 162 size = gfx::Size(size.height(), size.width());
159 } 163 }
160 max.SetToMax(size); 164 max.SetToMax(size);
161 } 165 }
162 166
163 return max; 167 return max;
164 } 168 }
165 169
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 return locked ? kShellWindowId_LockScreenWallpaperContainer 244 return locked ? kShellWindowId_LockScreenWallpaperContainer
241 : kShellWindowId_WallpaperContainer; 245 : kShellWindowId_WallpaperContainer;
242 } 246 }
243 247
244 void WallpaperController::UpdateWallpaper(bool clear_cache) { 248 void WallpaperController::UpdateWallpaper(bool clear_cache) {
245 current_wallpaper_.reset(); 249 current_wallpaper_.reset();
246 WmShell::Get()->wallpaper_delegate()->UpdateWallpaper(clear_cache); 250 WmShell::Get()->wallpaper_delegate()->UpdateWallpaper(clear_cache);
247 } 251 }
248 252
249 } // namespace ash 253 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | ash/common/wallpaper/wallpaper_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698