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

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 new addition 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::GetScreen()->GetDisplayNearestWindow(container_).bounds());
78 } 78 }
79 if (!modal_windows_.empty()) { 79 if (!modal_windows_.empty()) {
80 aura::Window::Windows::iterator it = modal_windows_.begin(); 80 aura::Window::Windows::iterator it = modal_windows_.begin();
81 for (it = modal_windows_.begin(); it != modal_windows_.end(); ++it) { 81 for (it = modal_windows_.begin(); it != modal_windows_.end(); ++it) {
82 (*it)->SetBounds((*it)->bounds().AdjustToFit(container_->bounds())); 82 (*it)->SetBounds((*it)->bounds().AdjustToFit(container_->bounds()));
83 } 83 }
84 } 84 }
85 } 85 }
86 86
87 void SystemModalContainerLayoutManager::OnWindowAddedToLayout( 87 void SystemModalContainerLayoutManager::OnWindowAddedToLayout(
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 return false; 159 return false;
160 wm::ActivateWindow(modal_window()); 160 wm::ActivateWindow(modal_window());
161 return true; 161 return true;
162 } 162 }
163 163
164 void SystemModalContainerLayoutManager::CreateModalBackground() { 164 void SystemModalContainerLayoutManager::CreateModalBackground() {
165 if (!modal_background_) { 165 if (!modal_background_) {
166 modal_background_ = new views::Widget; 166 modal_background_ = new views::Widget;
167 views::Widget::InitParams params(views::Widget::InitParams::TYPE_CONTROL); 167 views::Widget::InitParams params(views::Widget::InitParams::TYPE_CONTROL);
168 params.parent = container_; 168 params.parent = container_;
169 params.bounds = gfx::Screen::GetDisplayNearestWindow(container_).bounds(); 169 params.bounds = Shell::GetScreen()->GetDisplayNearestWindow(
170 container_).bounds();
170 modal_background_->Init(params); 171 modal_background_->Init(params);
171 modal_background_->GetNativeView()->SetName( 172 modal_background_->GetNativeView()->SetName(
172 "SystemModalContainerLayoutManager.ModalBackground"); 173 "SystemModalContainerLayoutManager.ModalBackground");
173 modal_background_->SetContentsView(new ModalBackgroundView); 174 modal_background_->SetContentsView(new ModalBackgroundView);
174 modal_background_->GetNativeView()->layer()->SetOpacity(0.0f); 175 modal_background_->GetNativeView()->layer()->SetOpacity(0.0f);
175 } 176 }
176 177
177 ui::ScopedLayerAnimationSettings settings( 178 ui::ScopedLayerAnimationSettings settings(
178 modal_background_->GetNativeView()->layer()->GetAnimator()); 179 modal_background_->GetNativeView()->layer()->GetAnimator());
179 modal_background_->Show(); 180 modal_background_->Show();
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 aura::Window::Windows::iterator it = 228 aura::Window::Windows::iterator it =
228 std::find(modal_windows_.begin(), modal_windows_.end(), window); 229 std::find(modal_windows_.begin(), modal_windows_.end(), window);
229 if (it != modal_windows_.end()) 230 if (it != modal_windows_.end())
230 modal_windows_.erase(it); 231 modal_windows_.erase(it);
231 232
232 Shell::GetInstance()->OnModalWindowRemoved(window); 233 Shell::GetInstance()->OnModalWindowRemoved(window);
233 } 234 }
234 235
235 } // namespace internal 236 } // namespace internal
236 } // namespace ash 237 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/system_gesture_event_filter_unittest.cc ('k') | ash/wm/toplevel_window_event_handler_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698