OLD | NEW |
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/wm/workspace/workspace_layout_manager.h" | 5 #include "ash/wm/workspace/workspace_layout_manager.h" |
6 | 6 |
7 #include "ash/display/display_controller.h" | 7 #include "ash/display/display_controller.h" |
8 #include "ash/root_window_controller.h" | 8 #include "ash/root_window_controller.h" |
9 #include "ash/screen_util.h" | 9 #include "ash/screen_util.h" |
10 #include "ash/session_state_delegate.h" | 10 #include "ash/session_state_delegate.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 #include "ui/compositor/layer.h" | 25 #include "ui/compositor/layer.h" |
26 #include "ui/events/event.h" | 26 #include "ui/events/event.h" |
27 #include "ui/gfx/screen.h" | 27 #include "ui/gfx/screen.h" |
28 #include "ui/wm/core/window_util.h" | 28 #include "ui/wm/core/window_util.h" |
29 #include "ui/wm/public/activation_client.h" | 29 #include "ui/wm/public/activation_client.h" |
30 | 30 |
31 using aura::Window; | 31 using aura::Window; |
32 | 32 |
33 namespace ash { | 33 namespace ash { |
34 | 34 |
35 namespace internal { | |
36 | |
37 WorkspaceLayoutManager::WorkspaceLayoutManager(aura::Window* window) | 35 WorkspaceLayoutManager::WorkspaceLayoutManager(aura::Window* window) |
38 : shelf_(NULL), | 36 : shelf_(NULL), |
39 window_(window), | 37 window_(window), |
40 root_window_(window->GetRootWindow()), | 38 root_window_(window->GetRootWindow()), |
41 work_area_in_parent_(ScreenUtil::ConvertRectFromScreen( | 39 work_area_in_parent_(ScreenUtil::ConvertRectFromScreen( |
42 window_, | 40 window_, |
43 Shell::GetScreen()->GetDisplayNearestWindow(window_).work_area())), | 41 Shell::GetScreen()->GetDisplayNearestWindow(window_).work_area())), |
44 is_fullscreen_(GetRootWindowController( | 42 is_fullscreen_(GetRootWindowController( |
45 window->GetRootWindow())->GetWindowForFullscreenMode() != NULL) { | 43 window->GetRootWindow())->GetWindowForFullscreenMode() != NULL) { |
46 Shell::GetInstance()->activation_client()->AddObserver(this); | 44 Shell::GetInstance()->activation_client()->AddObserver(this); |
47 Shell::GetInstance()->AddShellObserver(this); | 45 Shell::GetInstance()->AddShellObserver(this); |
48 root_window_->AddObserver(this); | 46 root_window_->AddObserver(this); |
49 } | 47 } |
50 | 48 |
51 WorkspaceLayoutManager::~WorkspaceLayoutManager() { | 49 WorkspaceLayoutManager::~WorkspaceLayoutManager() { |
52 if (root_window_) | 50 if (root_window_) |
53 root_window_->RemoveObserver(this); | 51 root_window_->RemoveObserver(this); |
54 for (WindowSet::const_iterator i = windows_.begin(); i != windows_.end(); ++i) | 52 for (WindowSet::const_iterator i = windows_.begin(); i != windows_.end(); ++i) |
55 (*i)->RemoveObserver(this); | 53 (*i)->RemoveObserver(this); |
56 Shell::GetInstance()->RemoveShellObserver(this); | 54 Shell::GetInstance()->RemoveShellObserver(this); |
57 Shell::GetInstance()->activation_client()->RemoveObserver(this); | 55 Shell::GetInstance()->activation_client()->RemoveObserver(this); |
58 } | 56 } |
59 | 57 |
60 void WorkspaceLayoutManager::SetShelf(internal::ShelfLayoutManager* shelf) { | 58 void WorkspaceLayoutManager::SetShelf(ShelfLayoutManager* shelf) { |
61 shelf_ = shelf; | 59 shelf_ = shelf; |
62 } | 60 } |
63 | 61 |
64 void WorkspaceLayoutManager::SetMaximizeBackdropDelegate( | 62 void WorkspaceLayoutManager::SetMaximizeBackdropDelegate( |
65 scoped_ptr<WorkspaceLayoutManagerDelegate> delegate) { | 63 scoped_ptr<WorkspaceLayoutManagerDelegate> delegate) { |
66 backdrop_delegate_.reset(delegate.release()); | 64 backdrop_delegate_.reset(delegate.release()); |
67 } | 65 } |
68 | 66 |
69 ////////////////////////////////////////////////////////////////////////////// | 67 ////////////////////////////////////////////////////////////////////////////// |
70 // WorkspaceLayoutManager, aura::LayoutManager implementation: | 68 // WorkspaceLayoutManager, aura::LayoutManager implementation: |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 return; | 272 return; |
275 bool is_fullscreen = GetRootWindowController( | 273 bool is_fullscreen = GetRootWindowController( |
276 window_->GetRootWindow())->GetWindowForFullscreenMode() != NULL; | 274 window_->GetRootWindow())->GetWindowForFullscreenMode() != NULL; |
277 if (is_fullscreen != is_fullscreen_) { | 275 if (is_fullscreen != is_fullscreen_) { |
278 ash::Shell::GetInstance()->NotifyFullscreenStateChange( | 276 ash::Shell::GetInstance()->NotifyFullscreenStateChange( |
279 is_fullscreen, window_->GetRootWindow()); | 277 is_fullscreen, window_->GetRootWindow()); |
280 is_fullscreen_ = is_fullscreen; | 278 is_fullscreen_ = is_fullscreen; |
281 } | 279 } |
282 } | 280 } |
283 | 281 |
284 } // namespace internal | |
285 } // namespace ash | 282 } // namespace ash |
OLD | NEW |