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

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

Issue 2741273002: chromeos: Promotes more from WmShell to Shell (Closed)
Patch Set: feedback Created 3 years, 9 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 (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 <string> 7 #include <string>
8 #include <utility> 8 #include <utility>
9 9
10 #include "ash/common/ash_switches.h" 10 #include "ash/common/ash_switches.h"
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 // Compare layouts only if necessary. 227 // Compare layouts only if necessary.
228 if (compare_layouts && layout != current_wallpaper_->layout()) 228 if (compare_layouts && layout != current_wallpaper_->layout())
229 return false; 229 return false;
230 230
231 return wallpaper::WallpaperResizer::GetImageId(image) == 231 return wallpaper::WallpaperResizer::GetImageId(image) ==
232 current_wallpaper_->original_image_id(); 232 current_wallpaper_->original_image_id();
233 } 233 }
234 234
235 void WallpaperController::OpenSetWallpaperPage() { 235 void WallpaperController::OpenSetWallpaperPage() {
236 if (wallpaper_picker_ && 236 if (wallpaper_picker_ &&
237 WmShell::Get()->wallpaper_delegate()->CanOpenSetWallpaperPage()) { 237 Shell::Get()->wallpaper_delegate()->CanOpenSetWallpaperPage()) {
238 wallpaper_picker_->Open(); 238 wallpaper_picker_->Open();
239 } 239 }
240 } 240 }
241 241
242 void WallpaperController::SetWallpaperPicker(mojom::WallpaperPickerPtr picker) { 242 void WallpaperController::SetWallpaperPicker(mojom::WallpaperPickerPtr picker) {
243 wallpaper_picker_ = std::move(picker); 243 wallpaper_picker_ = std::move(picker);
244 } 244 }
245 245
246 void WallpaperController::SetWallpaper(const SkBitmap& wallpaper, 246 void WallpaperController::SetWallpaper(const SkBitmap& wallpaper,
247 wallpaper::WallpaperLayout layout) { 247 wallpaper::WallpaperLayout layout) {
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 return moved; 319 return moved;
320 } 320 }
321 321
322 int WallpaperController::GetWallpaperContainerId(bool locked) { 322 int WallpaperController::GetWallpaperContainerId(bool locked) {
323 return locked ? kShellWindowId_LockScreenWallpaperContainer 323 return locked ? kShellWindowId_LockScreenWallpaperContainer
324 : kShellWindowId_WallpaperContainer; 324 : kShellWindowId_WallpaperContainer;
325 } 325 }
326 326
327 void WallpaperController::UpdateWallpaper(bool clear_cache) { 327 void WallpaperController::UpdateWallpaper(bool clear_cache) {
328 current_wallpaper_.reset(); 328 current_wallpaper_.reset();
329 WmShell::Get()->wallpaper_delegate()->UpdateWallpaper(clear_cache); 329 Shell::Get()->wallpaper_delegate()->UpdateWallpaper(clear_cache);
330 } 330 }
331 331
332 void WallpaperController::SetProminentColor(SkColor color) { 332 void WallpaperController::SetProminentColor(SkColor color) {
333 if (prominent_color_ == color) 333 if (prominent_color_ == color)
334 return; 334 return;
335 335
336 prominent_color_ = color; 336 prominent_color_ = color;
337 for (auto& observer : observers_) 337 for (auto& observer : observers_)
338 observer.OnWallpaperColorsChanged(); 338 observer.OnWallpaperColorsChanged();
339 } 339 }
340 340
341 void WallpaperController::CalculateWallpaperColors() { 341 void WallpaperController::CalculateWallpaperColors() {
342 color_utils::LumaRange luma; 342 color_utils::LumaRange luma;
343 color_utils::SaturationRange saturation; 343 color_utils::SaturationRange saturation;
344 if (!GetProminentColorProfile(&luma, &saturation)) 344 if (!GetProminentColorProfile(&luma, &saturation))
345 return; 345 return;
346 346
347 if (color_calculator_) 347 if (color_calculator_)
348 color_calculator_->RemoveObserver(this); 348 color_calculator_->RemoveObserver(this);
349 349
350 color_calculator_ = base::MakeUnique<wallpaper::WallpaperColorCalculator>( 350 color_calculator_ = base::MakeUnique<wallpaper::WallpaperColorCalculator>(
351 GetWallpaper(), luma, saturation, task_runner_); 351 GetWallpaper(), luma, saturation, task_runner_);
352 color_calculator_->AddObserver(this); 352 color_calculator_->AddObserver(this);
353 if (!color_calculator_->StartCalculation()) 353 if (!color_calculator_->StartCalculation())
354 SetProminentColor(SK_ColorTRANSPARENT); 354 SetProminentColor(SK_ColorTRANSPARENT);
355 } 355 }
356 356
357 } // namespace ash 357 } // namespace ash
OLDNEW
« no previous file with comments | « ash/common/system/user/user_view.cc ('k') | ash/common/wallpaper/wallpaper_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698