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

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

Issue 9689027: MonitorManager to manage multiple monitors. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sync Created 8 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 | Annotate | Revision Log
« no previous file with comments | « ash/wm/base_layout_manager_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 "base/auto_reset.h" 10 #include "base/auto_reset.h"
(...skipping 25 matching lines...) Expand all
36 max_height_(-1), 36 max_height_(-1),
37 launcher_(launcher), 37 launcher_(launcher),
38 status_(status) { 38 status_(status) {
39 gfx::Rect launcher_bounds = launcher->GetWindowScreenBounds(); 39 gfx::Rect launcher_bounds = launcher->GetWindowScreenBounds();
40 gfx::Rect status_bounds = status->GetWindowScreenBounds(); 40 gfx::Rect status_bounds = status->GetWindowScreenBounds();
41 max_height_ = std::max(launcher_bounds.height(), status_bounds.height()); 41 max_height_ = std::max(launcher_bounds.height(), status_bounds.height());
42 } 42 }
43 43
44 ShelfLayoutManager::~ShelfLayoutManager() { 44 ShelfLayoutManager::~ShelfLayoutManager() {
45 // Without a shelf we don't need special insets anymore. 45 // Without a shelf we don't need special insets anymore.
46 Shell::GetInstance()->SetScreenWorkAreaInsets(gfx::Insets()); 46 Shell::GetInstance()->SetMonitorWorkAreaInsets(
47 Shell::GetRootWindow(), gfx::Insets());
47 } 48 }
48 49
49 void ShelfLayoutManager::LayoutShelf() { 50 void ShelfLayoutManager::LayoutShelf() {
50 AutoReset<bool> auto_reset_in_layout(&in_layout_, true); 51 AutoReset<bool> auto_reset_in_layout(&in_layout_, true);
51 StopAnimating(); 52 StopAnimating();
52 TargetBounds target_bounds; 53 TargetBounds target_bounds;
53 float target_opacity = visible_ ? 1.0f : 0.0f; 54 float target_opacity = visible_ ? 1.0f : 0.0f;
54 CalculateTargetBounds(visible_, &target_bounds); 55 CalculateTargetBounds(visible_, &target_bounds);
55 GetLayer(launcher_)->SetOpacity(target_opacity); 56 GetLayer(launcher_)->SetOpacity(target_opacity);
56 GetLayer(status_)->SetOpacity(target_opacity); 57 GetLayer(status_)->SetOpacity(target_opacity);
57 launcher_->SetBounds(target_bounds.launcher_bounds); 58 launcher_->SetBounds(target_bounds.launcher_bounds);
58 status_->SetBounds(target_bounds.status_bounds); 59 status_->SetBounds(target_bounds.status_bounds);
59 Shell::GetInstance()->launcher()->SetStatusWidth( 60 Shell::GetInstance()->launcher()->SetStatusWidth(
60 target_bounds.status_bounds.width()); 61 target_bounds.status_bounds.width());
61 Shell::GetInstance()->SetScreenWorkAreaInsets( 62 Shell::GetInstance()->SetMonitorWorkAreaInsets(
63 Shell::GetRootWindow(),
62 target_bounds.work_area_insets); 64 target_bounds.work_area_insets);
63 } 65 }
64 66
65 void ShelfLayoutManager::SetVisible(bool visible) { 67 void ShelfLayoutManager::SetVisible(bool visible) {
66 ui::Layer* launcher_layer = GetLayer(launcher_); 68 ui::Layer* launcher_layer = GetLayer(launcher_);
67 ui::Layer* status_layer = GetLayer(status_); 69 ui::Layer* status_layer = GetLayer(status_);
68 70
69 // TODO(vollick): once visibility is animatable, use GetTargetVisibility. 71 // TODO(vollick): once visibility is animatable, use GetTargetVisibility.
70 bool current_visibility = visible_ && 72 bool current_visibility = visible_ &&
71 launcher_layer->GetTargetOpacity() > 0.0f && 73 launcher_layer->GetTargetOpacity() > 0.0f &&
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 available_bounds.x(), y + (max_height_ - launcher_bounds.height()) / 2, 145 available_bounds.x(), y + (max_height_ - launcher_bounds.height()) / 2,
144 available_bounds.width(), 146 available_bounds.width(),
145 launcher_bounds.height()); 147 launcher_bounds.height());
146 if (visible) 148 if (visible)
147 target_bounds->work_area_insets = gfx::Insets(0, 0, max_height_, 0); 149 target_bounds->work_area_insets = gfx::Insets(0, 0, max_height_, 0);
148 } 150 }
149 151
150 void ShelfLayoutManager::OnImplicitAnimationsCompleted() { 152 void ShelfLayoutManager::OnImplicitAnimationsCompleted() {
151 TargetBounds target_bounds; 153 TargetBounds target_bounds;
152 CalculateTargetBounds(visible_, &target_bounds); 154 CalculateTargetBounds(visible_, &target_bounds);
153 Shell::GetInstance()->SetScreenWorkAreaInsets( 155 Shell::GetInstance()->SetMonitorWorkAreaInsets(
156 Shell::GetRootWindow(),
154 target_bounds.work_area_insets); 157 target_bounds.work_area_insets);
155 } 158 }
156 159
157 } // namespace internal 160 } // namespace internal
158 } // namespace ash 161 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/base_layout_manager_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