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

Side by Side Diff: athena/wm/window_manager_impl.cc

Issue 455543004: Use ShadowController instead of creating its own. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « athena/home/home_card_impl.cc ('k') | athena/wm/window_overview_mode.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "athena/wm/public/window_manager.h" 5 #include "athena/wm/public/window_manager.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "athena/common/container_priorities.h" 9 #include "athena/common/container_priorities.h"
10 #include "athena/input/public/accelerator_manager.h" 10 #include "athena/input/public/accelerator_manager.h"
11 #include "athena/screen/public/screen_manager.h" 11 #include "athena/screen/public/screen_manager.h"
12 #include "athena/wm/bezel_controller.h" 12 #include "athena/wm/bezel_controller.h"
13 #include "athena/wm/mru_window_tracker.h" 13 #include "athena/wm/mru_window_tracker.h"
14 #include "athena/wm/public/window_manager_observer.h" 14 #include "athena/wm/public/window_manager_observer.h"
15 #include "athena/wm/split_view_controller.h" 15 #include "athena/wm/split_view_controller.h"
16 #include "athena/wm/title_drag_controller.h" 16 #include "athena/wm/title_drag_controller.h"
17 #include "athena/wm/window_overview_mode.h" 17 #include "athena/wm/window_overview_mode.h"
18 #include "base/logging.h" 18 #include "base/logging.h"
19 #include "base/observer_list.h" 19 #include "base/observer_list.h"
20 #include "ui/aura/layout_manager.h" 20 #include "ui/aura/layout_manager.h"
21 #include "ui/aura/window.h" 21 #include "ui/aura/window.h"
22 #include "ui/wm/core/shadow_controller.h"
22 #include "ui/wm/core/window_util.h" 23 #include "ui/wm/core/window_util.h"
23 #include "ui/wm/core/wm_state.h" 24 #include "ui/wm/core/wm_state.h"
25 #include "ui/wm/public/activation_client.h"
24 #include "ui/wm/public/window_types.h" 26 #include "ui/wm/public/window_types.h"
25 27
26 namespace athena { 28 namespace athena {
27 namespace { 29 namespace {
28 30
29 class WindowManagerImpl : public WindowManager, 31 class WindowManagerImpl : public WindowManager,
30 public WindowOverviewModeDelegate, 32 public WindowOverviewModeDelegate,
31 public aura::WindowObserver, 33 public aura::WindowObserver,
32 public AcceleratorHandler, 34 public AcceleratorHandler,
33 public TitleDragControllerDelegate { 35 public TitleDragControllerDelegate {
34 public: 36 public:
35 WindowManagerImpl(); 37 WindowManagerImpl();
36 virtual ~WindowManagerImpl(); 38 virtual ~WindowManagerImpl();
37 39
38 void Layout(); 40 void Layout();
39 41
40 // WindowManager: 42 // WindowManager:
41 virtual void ToggleOverview() OVERRIDE; 43 virtual void ToggleOverview() OVERRIDE;
42 44
43 virtual bool IsOverviewModeActive() OVERRIDE; 45 virtual bool IsOverviewModeActive() OVERRIDE;
44 46
45 private: 47 private:
46 enum Command { 48 enum Command {
47 COMMAND_TOGGLE_OVERVIEW, 49 CMD_TOGGLE_OVERVIEW,
48 }; 50 };
49 51
50 // Sets whether overview mode is active. 52 // Sets whether overview mode is active.
51 void SetInOverview(bool active); 53 void SetInOverview(bool active);
52 54
53 void InstallAccelerators(); 55 void InstallAccelerators();
54 56
55 // WindowManager: 57 // WindowManager:
56 virtual void AddObserver(WindowManagerObserver* observer) OVERRIDE; 58 virtual void AddObserver(WindowManagerObserver* observer) OVERRIDE;
57 virtual void RemoveObserver(WindowManagerObserver* observer) OVERRIDE; 59 virtual void RemoveObserver(WindowManagerObserver* observer) OVERRIDE;
(...skipping 19 matching lines...) Expand all
77 // Should be declared first so that it is destoyed last. 79 // Should be declared first so that it is destoyed last.
78 ObserverList<WindowManagerObserver> observers_; 80 ObserverList<WindowManagerObserver> observers_;
79 81
80 scoped_ptr<aura::Window> container_; 82 scoped_ptr<aura::Window> container_;
81 scoped_ptr<MruWindowTracker> mru_window_tracker_; 83 scoped_ptr<MruWindowTracker> mru_window_tracker_;
82 scoped_ptr<WindowOverviewMode> overview_; 84 scoped_ptr<WindowOverviewMode> overview_;
83 scoped_ptr<BezelController> bezel_controller_; 85 scoped_ptr<BezelController> bezel_controller_;
84 scoped_ptr<SplitViewController> split_view_controller_; 86 scoped_ptr<SplitViewController> split_view_controller_;
85 scoped_ptr<wm::WMState> wm_state_; 87 scoped_ptr<wm::WMState> wm_state_;
86 scoped_ptr<TitleDragController> title_drag_controller_; 88 scoped_ptr<TitleDragController> title_drag_controller_;
89 scoped_ptr<wm::ShadowController> shadow_controller_;
87 90
88 DISALLOW_COPY_AND_ASSIGN(WindowManagerImpl); 91 DISALLOW_COPY_AND_ASSIGN(WindowManagerImpl);
89 }; 92 };
90 93
91 class AthenaContainerLayoutManager : public aura::LayoutManager { 94 class AthenaContainerLayoutManager : public aura::LayoutManager {
92 public: 95 public:
93 AthenaContainerLayoutManager(); 96 AthenaContainerLayoutManager();
94 virtual ~AthenaContainerLayoutManager(); 97 virtual ~AthenaContainerLayoutManager();
95 98
96 private: 99 private:
(...skipping 19 matching lines...) Expand all
116 container_->SetLayoutManager(new AthenaContainerLayoutManager); 119 container_->SetLayoutManager(new AthenaContainerLayoutManager);
117 container_->AddObserver(this); 120 container_->AddObserver(this);
118 mru_window_tracker_.reset(new MruWindowTracker(container_.get())); 121 mru_window_tracker_.reset(new MruWindowTracker(container_.get()));
119 bezel_controller_.reset(new BezelController(container_.get())); 122 bezel_controller_.reset(new BezelController(container_.get()));
120 split_view_controller_.reset(new SplitViewController( 123 split_view_controller_.reset(new SplitViewController(
121 container_.get(), mru_window_tracker_.get(), this)); 124 container_.get(), mru_window_tracker_.get(), this));
122 bezel_controller_->set_left_right_delegate(split_view_controller_.get()); 125 bezel_controller_->set_left_right_delegate(split_view_controller_.get());
123 container_->AddPreTargetHandler(bezel_controller_.get()); 126 container_->AddPreTargetHandler(bezel_controller_.get());
124 title_drag_controller_.reset(new TitleDragController(container_.get(), this)); 127 title_drag_controller_.reset(new TitleDragController(container_.get(), this));
125 wm_state_.reset(new wm::WMState()); 128 wm_state_.reset(new wm::WMState());
129 aura::client::ActivationClient* activation_client =
130 aura::client::GetActivationClient(container_->GetRootWindow());
131 shadow_controller_.reset(new wm::ShadowController(activation_client));
126 instance = this; 132 instance = this;
127 InstallAccelerators(); 133 InstallAccelerators();
128 } 134 }
129 135
130 WindowManagerImpl::~WindowManagerImpl() { 136 WindowManagerImpl::~WindowManagerImpl() {
131 overview_.reset(); 137 overview_.reset();
132 if (container_) { 138 if (container_) {
133 container_->RemoveObserver(this); 139 container_->RemoveObserver(this);
134 container_->RemovePreTargetHandler(bezel_controller_.get()); 140 container_->RemovePreTargetHandler(bezel_controller_.get());
135 } 141 }
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 this); 184 this);
179 } else { 185 } else {
180 overview_.reset(); 186 overview_.reset();
181 FOR_EACH_OBSERVER(WindowManagerObserver, observers_, 187 FOR_EACH_OBSERVER(WindowManagerObserver, observers_,
182 OnOverviewModeExit()); 188 OnOverviewModeExit());
183 } 189 }
184 } 190 }
185 191
186 void WindowManagerImpl::InstallAccelerators() { 192 void WindowManagerImpl::InstallAccelerators() {
187 const AcceleratorData accelerator_data[] = { 193 const AcceleratorData accelerator_data[] = {
188 {TRIGGER_ON_PRESS, ui::VKEY_F6, ui::EF_NONE, COMMAND_TOGGLE_OVERVIEW, 194 {TRIGGER_ON_PRESS, ui::VKEY_F6, ui::EF_NONE, CMD_TOGGLE_OVERVIEW,
189 AF_NONE}, 195 AF_NONE},
190 }; 196 };
191 AcceleratorManager::Get()->RegisterAccelerators( 197 AcceleratorManager::Get()->RegisterAccelerators(
192 accelerator_data, arraysize(accelerator_data), this); 198 accelerator_data, arraysize(accelerator_data), this);
193 } 199 }
194 200
195 void WindowManagerImpl::AddObserver(WindowManagerObserver* observer) { 201 void WindowManagerImpl::AddObserver(WindowManagerObserver* observer) {
196 observers_.AddObserver(observer); 202 observers_.AddObserver(observer);
197 } 203 }
198 204
(...skipping 17 matching lines...) Expand all
216 container_.reset(); 222 container_.reset();
217 } 223 }
218 224
219 bool WindowManagerImpl::IsCommandEnabled(int command_id) const { 225 bool WindowManagerImpl::IsCommandEnabled(int command_id) const {
220 return true; 226 return true;
221 } 227 }
222 228
223 bool WindowManagerImpl::OnAcceleratorFired(int command_id, 229 bool WindowManagerImpl::OnAcceleratorFired(int command_id,
224 const ui::Accelerator& accelerator) { 230 const ui::Accelerator& accelerator) {
225 switch (command_id) { 231 switch (command_id) {
226 case COMMAND_TOGGLE_OVERVIEW: 232 case CMD_TOGGLE_OVERVIEW:
227 ToggleOverview(); 233 ToggleOverview();
228 break; 234 break;
229 } 235 }
230 return true; 236 return true;
231 } 237 }
232 238
233 aura::Window* WindowManagerImpl::GetWindowBehind(aura::Window* window) { 239 aura::Window* WindowManagerImpl::GetWindowBehind(aura::Window* window) {
234 const aura::Window::Windows& windows = container_->children(); 240 const aura::Window::Windows& windows = container_->children();
235 aura::Window::Windows::const_iterator iter = 241 aura::Window::Windows::const_iterator iter =
236 std::find(windows.begin(), windows.end(), window); 242 std::find(windows.begin(), windows.end(), window);
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 DCHECK(!instance); 309 DCHECK(!instance);
304 } 310 }
305 311
306 // static 312 // static
307 WindowManager* WindowManager::GetInstance() { 313 WindowManager* WindowManager::GetInstance() {
308 DCHECK(instance); 314 DCHECK(instance);
309 return instance; 315 return instance;
310 } 316 }
311 317
312 } // namespace athena 318 } // namespace athena
OLDNEW
« no previous file with comments | « athena/home/home_card_impl.cc ('k') | athena/wm/window_overview_mode.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698