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

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

Issue 11030017: Add context to gfx::Screen calls in support of simultaneous desktop+ash (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix some new gfx::Screen additions Created 8 years, 2 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/system_modal_container_layout_manager.h" 5 #include "ash/wm/system_modal_container_layout_manager.h"
6 6
7 #include "ash/ash_switches.h" 7 #include "ash/ash_switches.h"
8 #include "ash/shell.h" 8 #include "ash/shell.h"
9 #include "ash/shell_window_ids.h" 9 #include "ash/shell_window_ids.h"
10 #include "ash/wm/system_modal_container_event_filter.h" 10 #include "ash/wm/system_modal_container_event_filter.h"
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 SystemModalContainerLayoutManager::~SystemModalContainerLayoutManager() { 67 SystemModalContainerLayoutManager::~SystemModalContainerLayoutManager() {
68 } 68 }
69 69
70 //////////////////////////////////////////////////////////////////////////////// 70 ////////////////////////////////////////////////////////////////////////////////
71 // SystemModalContainerLayoutManager, aura::LayoutManager implementation: 71 // SystemModalContainerLayoutManager, aura::LayoutManager implementation:
72 72
73 void SystemModalContainerLayoutManager::OnWindowResized() { 73 void SystemModalContainerLayoutManager::OnWindowResized() {
74 if (modal_background_) { 74 if (modal_background_) {
75 // Note: we have to set the entire bounds with the screen offset. 75 // Note: we have to set the entire bounds with the screen offset.
76 modal_background_->SetBounds( 76 modal_background_->SetBounds(
77 gfx::Screen::GetDisplayNearestWindow(container_).bounds()); 77 Shell::GetAshScreen()->GetDisplayNearestWindow(
78 container_).bounds());
78 } 79 }
79 if (!modal_windows_.empty()) { 80 if (!modal_windows_.empty()) {
80 aura::Window::Windows::iterator it = modal_windows_.begin(); 81 aura::Window::Windows::iterator it = modal_windows_.begin();
81 for (it = modal_windows_.begin(); it != modal_windows_.end(); ++it) { 82 for (it = modal_windows_.begin(); it != modal_windows_.end(); ++it) {
82 (*it)->SetBounds((*it)->bounds().AdjustToFit(container_->bounds())); 83 (*it)->SetBounds((*it)->bounds().AdjustToFit(container_->bounds()));
83 } 84 }
84 } 85 }
85 } 86 }
86 87
87 void SystemModalContainerLayoutManager::OnWindowAddedToLayout( 88 void SystemModalContainerLayoutManager::OnWindowAddedToLayout(
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 return false; 160 return false;
160 wm::ActivateWindow(modal_window()); 161 wm::ActivateWindow(modal_window());
161 return true; 162 return true;
162 } 163 }
163 164
164 void SystemModalContainerLayoutManager::CreateModalBackground() { 165 void SystemModalContainerLayoutManager::CreateModalBackground() {
165 if (!modal_background_) { 166 if (!modal_background_) {
166 modal_background_ = new views::Widget; 167 modal_background_ = new views::Widget;
167 views::Widget::InitParams params(views::Widget::InitParams::TYPE_CONTROL); 168 views::Widget::InitParams params(views::Widget::InitParams::TYPE_CONTROL);
168 params.parent = container_; 169 params.parent = container_;
169 params.bounds = gfx::Screen::GetDisplayNearestWindow(container_).bounds(); 170 params.bounds = Shell::GetAshScreen()->GetDisplayNearestWindow(
171 container_).bounds();
170 modal_background_->Init(params); 172 modal_background_->Init(params);
171 modal_background_->GetNativeView()->SetName( 173 modal_background_->GetNativeView()->SetName(
172 "SystemModalContainerLayoutManager.ModalBackground"); 174 "SystemModalContainerLayoutManager.ModalBackground");
173 modal_background_->SetContentsView(new ModalBackgroundView); 175 modal_background_->SetContentsView(new ModalBackgroundView);
174 modal_background_->GetNativeView()->layer()->SetOpacity(0.0f); 176 modal_background_->GetNativeView()->layer()->SetOpacity(0.0f);
175 } 177 }
176 178
177 ui::ScopedLayerAnimationSettings settings( 179 ui::ScopedLayerAnimationSettings settings(
178 modal_background_->GetNativeView()->layer()->GetAnimator()); 180 modal_background_->GetNativeView()->layer()->GetAnimator());
179 modal_background_->Show(); 181 modal_background_->Show();
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 aura::Window::Windows::iterator it = 229 aura::Window::Windows::iterator it =
228 std::find(modal_windows_.begin(), modal_windows_.end(), window); 230 std::find(modal_windows_.begin(), modal_windows_.end(), window);
229 if (it != modal_windows_.end()) 231 if (it != modal_windows_.end())
230 modal_windows_.erase(it); 232 modal_windows_.erase(it);
231 233
232 Shell::GetInstance()->OnModalWindowRemoved(window); 234 Shell::GetInstance()->OnModalWindowRemoved(window);
233 } 235 }
234 236
235 } // namespace internal 237 } // namespace internal
236 } // namespace ash 238 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698