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

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

Issue 2739763003: Moves maintaining ShellObservers back to Shell (Closed)
Patch Set: merge 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"
11 #include "ash/common/wallpaper/wallpaper_controller_observer.h" 11 #include "ash/common/wallpaper/wallpaper_controller_observer.h"
12 #include "ash/common/wallpaper/wallpaper_delegate.h" 12 #include "ash/common/wallpaper/wallpaper_delegate.h"
13 #include "ash/common/wallpaper/wallpaper_view.h" 13 #include "ash/common/wallpaper/wallpaper_view.h"
14 #include "ash/common/wallpaper/wallpaper_widget_controller.h" 14 #include "ash/common/wallpaper/wallpaper_widget_controller.h"
15 #include "ash/common/wm_shell.h" 15 #include "ash/common/wm_shell.h"
16 #include "ash/common/wm_window.h" 16 #include "ash/common/wm_window.h"
17 #include "ash/public/cpp/shell_window_ids.h" 17 #include "ash/public/cpp/shell_window_ids.h"
18 #include "ash/root_window_controller.h" 18 #include "ash/root_window_controller.h"
19 #include "ash/shell.h"
19 #include "base/bind.h" 20 #include "base/bind.h"
20 #include "base/command_line.h" 21 #include "base/command_line.h"
21 #include "base/logging.h" 22 #include "base/logging.h"
22 #include "base/task_runner.h" 23 #include "base/task_runner.h"
23 #include "components/wallpaper/wallpaper_color_calculator.h" 24 #include "components/wallpaper/wallpaper_color_calculator.h"
24 #include "components/wallpaper/wallpaper_resizer.h" 25 #include "components/wallpaper/wallpaper_resizer.h"
25 #include "ui/display/manager/managed_display_info.h" 26 #include "ui/display/manager/managed_display_info.h"
26 #include "ui/display/screen.h" 27 #include "ui/display/screen.h"
27 #include "ui/gfx/color_analysis.h" 28 #include "ui/gfx/color_analysis.h"
28 #include "ui/views/widget/widget.h" 29 #include "ui/views/widget/widget.h"
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 } 68 }
68 69
69 WallpaperController::WallpaperController( 70 WallpaperController::WallpaperController(
70 const scoped_refptr<base::TaskRunner>& task_runner) 71 const scoped_refptr<base::TaskRunner>& task_runner)
71 : locked_(false), 72 : locked_(false),
72 wallpaper_mode_(WALLPAPER_NONE), 73 wallpaper_mode_(WALLPAPER_NONE),
73 prominent_color_(SK_ColorTRANSPARENT), 74 prominent_color_(SK_ColorTRANSPARENT),
74 wallpaper_reload_delay_(kWallpaperReloadDelayMs), 75 wallpaper_reload_delay_(kWallpaperReloadDelayMs),
75 task_runner_(task_runner) { 76 task_runner_(task_runner) {
76 WmShell::Get()->AddDisplayObserver(this); 77 WmShell::Get()->AddDisplayObserver(this);
77 WmShell::Get()->AddShellObserver(this); 78 Shell::GetInstance()->AddShellObserver(this);
78 } 79 }
79 80
80 WallpaperController::~WallpaperController() { 81 WallpaperController::~WallpaperController() {
81 if (current_wallpaper_) 82 if (current_wallpaper_)
82 current_wallpaper_->RemoveObserver(this); 83 current_wallpaper_->RemoveObserver(this);
83 if (color_calculator_) 84 if (color_calculator_)
84 color_calculator_->RemoveObserver(this); 85 color_calculator_->RemoveObserver(this);
85 WmShell::Get()->RemoveDisplayObserver(this); 86 WmShell::Get()->RemoveDisplayObserver(this);
86 WmShell::Get()->RemoveShellObserver(this); 87 Shell::GetInstance()->RemoveShellObserver(this);
87 } 88 }
88 89
89 void WallpaperController::BindRequest( 90 void WallpaperController::BindRequest(
90 mojom::WallpaperControllerRequest request) { 91 mojom::WallpaperControllerRequest request) {
91 bindings_.AddBinding(this, std::move(request)); 92 bindings_.AddBinding(this, std::move(request));
92 } 93 }
93 94
94 gfx::ImageSkia WallpaperController::GetWallpaper() const { 95 gfx::ImageSkia WallpaperController::GetWallpaper() const {
95 if (current_wallpaper_) 96 if (current_wallpaper_)
96 return current_wallpaper_->image(); 97 return current_wallpaper_->image();
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
347 color_calculator_->RemoveObserver(this); 348 color_calculator_->RemoveObserver(this);
348 349
349 color_calculator_ = base::MakeUnique<wallpaper::WallpaperColorCalculator>( 350 color_calculator_ = base::MakeUnique<wallpaper::WallpaperColorCalculator>(
350 GetWallpaper(), luma, saturation, task_runner_); 351 GetWallpaper(), luma, saturation, task_runner_);
351 color_calculator_->AddObserver(this); 352 color_calculator_->AddObserver(this);
352 if (!color_calculator_->StartCalculation()) 353 if (!color_calculator_->StartCalculation())
353 SetProminentColor(SK_ColorTRANSPARENT); 354 SetProminentColor(SK_ColorTRANSPARENT);
354 } 355 }
355 356
356 } // namespace ash 357 } // namespace ash
OLDNEW
« no previous file with comments | « ash/common/test/test_shelf_delegate.cc ('k') | ash/common/wm/dock/docked_window_layout_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698