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

Side by Side Diff: ash/wm/shelf_layout_manager.cc

Issue 9960042: Refactor screen/monitor so that gfx::Screen returns monitor object. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sync Created 8 years, 8 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 | « ash/wm/root_window_event_filter_unittest.cc ('k') | ash/wm/shelf_layout_manager_unittest.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 (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/shelf_layout_manager.h" 5 #include "ash/wm/shelf_layout_manager.h"
6 6
7 #include "ash/launcher/launcher.h" 7 #include "ash/launcher/launcher.h"
8 #include "ash/screen_ash.h" 8 #include "ash/screen_ash.h"
9 #include "ash/shell.h" 9 #include "ash/shell.h"
10 #include "ash/shell_delegate.h" 10 #include "ash/shell_delegate.h"
11 #include "ash/shell_window_ids.h" 11 #include "ash/shell_window_ids.h"
12 #include "ash/system/tray/system_tray.h" 12 #include "ash/system/tray/system_tray.h"
13 #include "ash/wm/workspace/workspace_manager.h" 13 #include "ash/wm/workspace/workspace_manager.h"
14 #include "base/auto_reset.h" 14 #include "base/auto_reset.h"
15 #include "base/i18n/rtl.h" 15 #include "base/i18n/rtl.h"
16 #include "ui/aura/client/activation_client.h" 16 #include "ui/aura/client/activation_client.h"
17 #include "ui/aura/event.h" 17 #include "ui/aura/event.h"
18 #include "ui/aura/event_filter.h" 18 #include "ui/aura/event_filter.h"
19 #include "ui/aura/root_window.h" 19 #include "ui/aura/root_window.h"
20 #include "ui/gfx/compositor/layer.h" 20 #include "ui/gfx/compositor/layer.h"
21 #include "ui/gfx/compositor/layer_animation_observer.h" 21 #include "ui/gfx/compositor/layer_animation_observer.h"
22 #include "ui/gfx/compositor/layer_animator.h" 22 #include "ui/gfx/compositor/layer_animator.h"
23 #include "ui/gfx/compositor/scoped_layer_animation_settings.h" 23 #include "ui/gfx/compositor/scoped_layer_animation_settings.h"
24 #include "ui/gfx/screen.h"
24 #include "ui/views/widget/widget.h" 25 #include "ui/views/widget/widget.h"
25 26
26 namespace ash { 27 namespace ash {
27 namespace internal { 28 namespace internal {
28 29
29 namespace { 30 namespace {
30 31
31 // Delay before showing the launcher. This is after the mouse stops moving. 32 // Delay before showing the launcher. This is after the mouse stops moving.
32 const int kAutoHideDelayMS = 200; 33 const int kAutoHideDelayMS = 200;
33 34
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 143
143 bool ShelfLayoutManager::IsVisible() const { 144 bool ShelfLayoutManager::IsVisible() const {
144 return status_->IsVisible() && (state_.visibility_state == VISIBLE || 145 return status_->IsVisible() && (state_.visibility_state == VISIBLE ||
145 (state_.visibility_state == AUTO_HIDE && 146 (state_.visibility_state == AUTO_HIDE &&
146 state_.auto_hide_state == AUTO_HIDE_SHOWN)); 147 state_.auto_hide_state == AUTO_HIDE_SHOWN));
147 } 148 }
148 149
149 gfx::Rect ShelfLayoutManager::GetMaximizedWindowBounds( 150 gfx::Rect ShelfLayoutManager::GetMaximizedWindowBounds(
150 aura::Window* window) const { 151 aura::Window* window) const {
151 // TODO: needs to be multi-mon aware. 152 // TODO: needs to be multi-mon aware.
152 gfx::Rect bounds(gfx::Screen::GetMonitorAreaNearestWindow(window)); 153 gfx::Rect bounds(gfx::Screen::GetMonitorNearestWindow(window).bounds());
153 if (auto_hide_behavior_ == SHELF_AUTO_HIDE_BEHAVIOR_DEFAULT || 154 if (auto_hide_behavior_ == SHELF_AUTO_HIDE_BEHAVIOR_DEFAULT ||
154 auto_hide_behavior_ == SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS) { 155 auto_hide_behavior_ == SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS) {
155 bounds.set_height(bounds.height() - kAutoHideHeight); 156 bounds.set_height(bounds.height() - kAutoHideHeight);
156 return bounds; 157 return bounds;
157 } 158 }
158 // SHELF_AUTO_HIDE_BEHAVIOR_NEVER maximized windows don't get any taller. 159 // SHELF_AUTO_HIDE_BEHAVIOR_NEVER maximized windows don't get any taller.
159 return GetUnmaximizedWorkAreaBounds(window); 160 return GetUnmaximizedWorkAreaBounds(window);
160 } 161 }
161 162
162 gfx::Rect ShelfLayoutManager::GetUnmaximizedWorkAreaBounds( 163 gfx::Rect ShelfLayoutManager::GetUnmaximizedWorkAreaBounds(
163 aura::Window* window) const { 164 aura::Window* window) const {
164 // TODO: needs to be multi-mon aware. 165 // TODO: needs to be multi-mon aware.
165 gfx::Rect bounds(gfx::Screen::GetMonitorAreaNearestWindow(window)); 166 gfx::Rect bounds(gfx::Screen::GetMonitorNearestWindow(window).bounds());
166 if (auto_hide_behavior_ == SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS) 167 if (auto_hide_behavior_ == SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS)
167 bounds.set_height(bounds.height() - kAutoHideHeight); 168 bounds.set_height(bounds.height() - kAutoHideHeight);
168 else 169 else
169 bounds.set_height(bounds.height() - shelf_height_); 170 bounds.set_height(bounds.height() - shelf_height_);
170 return bounds; 171 return bounds;
171 } 172 }
172 173
173 void ShelfLayoutManager::SetLauncher(Launcher* launcher) { 174 void ShelfLayoutManager::SetLauncher(Launcher* launcher) {
174 if (launcher == launcher_) 175 if (launcher == launcher_)
175 return; 176 return;
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
460 bool ShelfLayoutManager::IsShelfWindow(aura::Window* window) { 461 bool ShelfLayoutManager::IsShelfWindow(aura::Window* window) {
461 if (!window) 462 if (!window)
462 return false; 463 return false;
463 return (launcher_widget() && 464 return (launcher_widget() &&
464 launcher_widget()->GetNativeWindow()->Contains(window)) || 465 launcher_widget()->GetNativeWindow()->Contains(window)) ||
465 (status_ && status_->GetNativeWindow()->Contains(window)); 466 (status_ && status_->GetNativeWindow()->Contains(window));
466 } 467 }
467 468
468 } // namespace internal 469 } // namespace internal
469 } // namespace ash 470 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/root_window_event_filter_unittest.cc ('k') | ash/wm/shelf_layout_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698