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

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

Issue 9699013: MonitorManager to manage multiple monitors. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . 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
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 29 matching lines...) Expand all
40 launcher_(launcher), 40 launcher_(launcher),
41 status_(status) { 41 status_(status) {
42 gfx::Rect launcher_bounds = launcher->GetWindowScreenBounds(); 42 gfx::Rect launcher_bounds = launcher->GetWindowScreenBounds();
43 gfx::Rect status_bounds = status->GetWindowScreenBounds(); 43 gfx::Rect status_bounds = status->GetWindowScreenBounds();
44 max_height_ = std::max(launcher_bounds.height(), status_bounds.height()); 44 max_height_ = std::max(launcher_bounds.height(), status_bounds.height());
45 root_window_ = launcher->GetNativeView()->GetRootWindow(); 45 root_window_ = launcher->GetNativeView()->GetRootWindow();
46 } 46 }
47 47
48 ShelfLayoutManager::~ShelfLayoutManager() { 48 ShelfLayoutManager::~ShelfLayoutManager() {
49 // Without a shelf we don't need special insets anymore. 49 // Without a shelf we don't need special insets anymore.
50 Shell::GetInstance()->SetScreenWorkAreaInsets(gfx::Insets()); 50 Shell::GetInstance()->SetMonitorWorkAreaInsets(
51 Shell::GetRootWindow(), gfx::Insets());
51 } 52 }
52 53
53 void ShelfLayoutManager::LayoutShelf() { 54 void ShelfLayoutManager::LayoutShelf() {
54 AutoReset<bool> auto_reset_in_layout(&in_layout_, true); 55 AutoReset<bool> auto_reset_in_layout(&in_layout_, true);
55 StopAnimating(); 56 StopAnimating();
56 TargetBounds target_bounds; 57 TargetBounds target_bounds;
57 float target_opacity = visible_ ? 1.0f : 0.0f; 58 float target_opacity = visible_ ? 1.0f : 0.0f;
58 CalculateTargetBounds(visible_, &target_bounds); 59 CalculateTargetBounds(visible_, &target_bounds);
59 GetLayer(launcher_)->SetOpacity(target_opacity); 60 GetLayer(launcher_)->SetOpacity(target_opacity);
60 GetLayer(status_)->SetOpacity(target_opacity); 61 GetLayer(status_)->SetOpacity(target_opacity);
61 launcher_->SetBounds(target_bounds.launcher_bounds); 62 launcher_->SetBounds(target_bounds.launcher_bounds);
62 status_->SetBounds(target_bounds.status_bounds); 63 status_->SetBounds(target_bounds.status_bounds);
63 Shell::GetInstance()->launcher()->SetStatusWidth( 64 Shell::GetInstance()->launcher()->SetStatusWidth(
64 target_bounds.status_bounds.width()); 65 target_bounds.status_bounds.width());
65 Shell::GetInstance()->SetScreenWorkAreaInsets( 66 Shell::GetInstance()->SetMonitorWorkAreaInsets(
67 Shell::GetRootWindow(),
66 target_bounds.work_area_insets); 68 target_bounds.work_area_insets);
67 } 69 }
68 70
69 void ShelfLayoutManager::SetVisible(bool visible) { 71 void ShelfLayoutManager::SetVisible(bool visible) {
70 ui::Layer* launcher_layer = GetLayer(launcher_); 72 ui::Layer* launcher_layer = GetLayer(launcher_);
71 ui::Layer* status_layer = GetLayer(status_); 73 ui::Layer* status_layer = GetLayer(status_);
72 74
73 // TODO(vollick): once visibility is animatable, use GetTargetVisibility. 75 // TODO(vollick): once visibility is animatable, use GetTargetVisibility.
74 bool current_visibility = visible_ && 76 bool current_visibility = visible_ &&
75 launcher_layer->GetTargetOpacity() > 0.0f && 77 launcher_layer->GetTargetOpacity() > 0.0f &&
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 available_bounds.width(), 150 available_bounds.width(),
149 launcher_bounds.height()); 151 launcher_bounds.height());
150 if (visible) 152 if (visible)
151 target_bounds->work_area_insets = gfx::Insets( 153 target_bounds->work_area_insets = gfx::Insets(
152 0, 0, max_height_ + kWorkspaceAreaBottomInset, 0); 154 0, 0, max_height_ + kWorkspaceAreaBottomInset, 0);
153 } 155 }
154 156
155 void ShelfLayoutManager::OnImplicitAnimationsCompleted() { 157 void ShelfLayoutManager::OnImplicitAnimationsCompleted() {
156 TargetBounds target_bounds; 158 TargetBounds target_bounds;
157 CalculateTargetBounds(visible_, &target_bounds); 159 CalculateTargetBounds(visible_, &target_bounds);
158 Shell::GetInstance()->SetScreenWorkAreaInsets( 160 Shell::GetInstance()->SetMonitorWorkAreaInsets(
161 Shell::GetRootWindow(),
159 target_bounds.work_area_insets); 162 target_bounds.work_area_insets);
160 } 163 }
161 164
162 } // namespace internal 165 } // namespace internal
163 } // namespace ash 166 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698