| 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 <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "ash/root_window_controller.h" | 9 #include "ash/root_window_controller.h" |
| 10 #include "ash/screen_util.h" | 10 #include "ash/screen_util.h" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 using aura::Window; | 33 using aura::Window; |
| 34 | 34 |
| 35 namespace ash { | 35 namespace ash { |
| 36 | 36 |
| 37 WorkspaceLayoutManager::WorkspaceLayoutManager(aura::Window* window) | 37 WorkspaceLayoutManager::WorkspaceLayoutManager(aura::Window* window) |
| 38 : shelf_(NULL), | 38 : shelf_(NULL), |
| 39 window_(window), | 39 window_(window), |
| 40 root_window_(window->GetRootWindow()), | 40 root_window_(window->GetRootWindow()), |
| 41 work_area_in_parent_(ScreenUtil::ConvertRectFromScreen( | 41 work_area_in_parent_(ScreenUtil::ConvertRectFromScreen( |
| 42 window_, | 42 window_, |
| 43 Shell::GetScreen()->GetDisplayNearestWindow(window_).work_area())), | 43 gfx::Screen::GetScreen() |
| 44 is_fullscreen_(GetRootWindowController( | 44 ->GetDisplayNearestWindow(window_) |
| 45 window->GetRootWindow())->GetWindowForFullscreenMode() != NULL) { | 45 .work_area())), |
| 46 is_fullscreen_(GetRootWindowController(window->GetRootWindow()) |
| 47 ->GetWindowForFullscreenMode() != NULL) { |
| 46 Shell::GetInstance()->activation_client()->AddObserver(this); | 48 Shell::GetInstance()->activation_client()->AddObserver(this); |
| 47 Shell::GetInstance()->AddShellObserver(this); | 49 Shell::GetInstance()->AddShellObserver(this); |
| 48 root_window_->AddObserver(this); | 50 root_window_->AddObserver(this); |
| 49 DCHECK(window->GetProperty(kSnapChildrenToPixelBoundary)); | 51 DCHECK(window->GetProperty(kSnapChildrenToPixelBoundary)); |
| 50 } | 52 } |
| 51 | 53 |
| 52 WorkspaceLayoutManager::~WorkspaceLayoutManager() { | 54 WorkspaceLayoutManager::~WorkspaceLayoutManager() { |
| 53 if (root_window_) | 55 if (root_window_) |
| 54 root_window_->RemoveObserver(this); | 56 root_window_->RemoveObserver(this); |
| 55 for (WindowSet::const_iterator i = windows_.begin(); i != windows_.end(); ++i) | 57 for (WindowSet::const_iterator i = windows_.begin(); i != windows_.end(); ++i) |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 window_state->SetAndClearRestoreBounds(); | 162 window_state->SetAndClearRestoreBounds(); |
| 161 } | 163 } |
| 162 } | 164 } |
| 163 | 165 |
| 164 ////////////////////////////////////////////////////////////////////////////// | 166 ////////////////////////////////////////////////////////////////////////////// |
| 165 // WorkspaceLayoutManager, ash::ShellObserver implementation: | 167 // WorkspaceLayoutManager, ash::ShellObserver implementation: |
| 166 | 168 |
| 167 void WorkspaceLayoutManager::OnDisplayWorkAreaInsetsChanged() { | 169 void WorkspaceLayoutManager::OnDisplayWorkAreaInsetsChanged() { |
| 168 const gfx::Rect work_area(ScreenUtil::ConvertRectFromScreen( | 170 const gfx::Rect work_area(ScreenUtil::ConvertRectFromScreen( |
| 169 window_, | 171 window_, |
| 170 Shell::GetScreen()->GetDisplayNearestWindow(window_).work_area())); | 172 gfx::Screen::GetScreen()->GetDisplayNearestWindow(window_).work_area())); |
| 171 if (work_area != work_area_in_parent_) { | 173 if (work_area != work_area_in_parent_) { |
| 172 const wm::WMEvent event(wm::WM_EVENT_WORKAREA_BOUNDS_CHANGED); | 174 const wm::WMEvent event(wm::WM_EVENT_WORKAREA_BOUNDS_CHANGED); |
| 173 AdjustAllWindowsBoundsForWorkAreaChange(&event); | 175 AdjustAllWindowsBoundsForWorkAreaChange(&event); |
| 174 } | 176 } |
| 175 if (backdrop_delegate_) | 177 if (backdrop_delegate_) |
| 176 backdrop_delegate_->OnDisplayWorkAreaInsetsChanged(); | 178 backdrop_delegate_->OnDisplayWorkAreaInsetsChanged(); |
| 177 } | 179 } |
| 178 | 180 |
| 179 void WorkspaceLayoutManager::OnFullscreenStateChanged( | 181 void WorkspaceLayoutManager::OnFullscreenStateChanged( |
| 180 bool is_fullscreen, | 182 bool is_fullscreen, |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 298 ////////////////////////////////////////////////////////////////////////////// | 300 ////////////////////////////////////////////////////////////////////////////// |
| 299 // WorkspaceLayoutManager, private: | 301 // WorkspaceLayoutManager, private: |
| 300 | 302 |
| 301 void WorkspaceLayoutManager::AdjustAllWindowsBoundsForWorkAreaChange( | 303 void WorkspaceLayoutManager::AdjustAllWindowsBoundsForWorkAreaChange( |
| 302 const wm::WMEvent* event) { | 304 const wm::WMEvent* event) { |
| 303 DCHECK(event->type() == wm::WM_EVENT_DISPLAY_BOUNDS_CHANGED || | 305 DCHECK(event->type() == wm::WM_EVENT_DISPLAY_BOUNDS_CHANGED || |
| 304 event->type() == wm::WM_EVENT_WORKAREA_BOUNDS_CHANGED); | 306 event->type() == wm::WM_EVENT_WORKAREA_BOUNDS_CHANGED); |
| 305 | 307 |
| 306 work_area_in_parent_ = ScreenUtil::ConvertRectFromScreen( | 308 work_area_in_parent_ = ScreenUtil::ConvertRectFromScreen( |
| 307 window_, | 309 window_, |
| 308 Shell::GetScreen()->GetDisplayNearestWindow(window_).work_area()); | 310 gfx::Screen::GetScreen()->GetDisplayNearestWindow(window_).work_area()); |
| 309 | 311 |
| 310 // Don't do any adjustments of the insets while we are in screen locked mode. | 312 // Don't do any adjustments of the insets while we are in screen locked mode. |
| 311 // This would happen if the launcher was auto hidden before the login screen | 313 // This would happen if the launcher was auto hidden before the login screen |
| 312 // was shown and then gets shown when the login screen gets presented. | 314 // was shown and then gets shown when the login screen gets presented. |
| 313 if (event->type() == wm::WM_EVENT_WORKAREA_BOUNDS_CHANGED && | 315 if (event->type() == wm::WM_EVENT_WORKAREA_BOUNDS_CHANGED && |
| 314 Shell::GetInstance()->session_state_delegate()->IsScreenLocked()) | 316 Shell::GetInstance()->session_state_delegate()->IsScreenLocked()) |
| 315 return; | 317 return; |
| 316 | 318 |
| 317 // If a user plugs an external display into a laptop running Aura the | 319 // If a user plugs an external display into a laptop running Aura the |
| 318 // display size will change. Maximized windows need to resize to match. | 320 // display size will change. Maximized windows need to resize to match. |
| (...skipping 23 matching lines...) Expand all Loading... |
| 342 bool is_fullscreen = GetRootWindowController( | 344 bool is_fullscreen = GetRootWindowController( |
| 343 window_->GetRootWindow())->GetWindowForFullscreenMode() != NULL; | 345 window_->GetRootWindow())->GetWindowForFullscreenMode() != NULL; |
| 344 if (is_fullscreen != is_fullscreen_) { | 346 if (is_fullscreen != is_fullscreen_) { |
| 345 ash::Shell::GetInstance()->NotifyFullscreenStateChange( | 347 ash::Shell::GetInstance()->NotifyFullscreenStateChange( |
| 346 is_fullscreen, window_->GetRootWindow()); | 348 is_fullscreen, window_->GetRootWindow()); |
| 347 is_fullscreen_ = is_fullscreen; | 349 is_fullscreen_ = is_fullscreen; |
| 348 } | 350 } |
| 349 } | 351 } |
| 350 | 352 |
| 351 } // namespace ash | 353 } // namespace ash |
| OLD | NEW |