OLD | NEW |
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/session_state_delegate.h" | 7 #include "ash/session_state_delegate.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 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 if (!modal_background_) { | 148 if (!modal_background_) { |
149 modal_background_ = new views::Widget; | 149 modal_background_ = new views::Widget; |
150 views::Widget::InitParams params(views::Widget::InitParams::TYPE_CONTROL); | 150 views::Widget::InitParams params(views::Widget::InitParams::TYPE_CONTROL); |
151 params.parent = container_; | 151 params.parent = container_; |
152 params.bounds = Shell::GetScreen()->GetDisplayNearestWindow( | 152 params.bounds = Shell::GetScreen()->GetDisplayNearestWindow( |
153 container_).bounds(); | 153 container_).bounds(); |
154 modal_background_->Init(params); | 154 modal_background_->Init(params); |
155 modal_background_->GetNativeView()->SetName( | 155 modal_background_->GetNativeView()->SetName( |
156 "SystemModalContainerLayoutManager.ModalBackground"); | 156 "SystemModalContainerLayoutManager.ModalBackground"); |
157 views::View* contents_view = new views::View(); | 157 views::View* contents_view = new views::View(); |
158 // TODO(jamescook): This could also be SK_ColorWHITE if using the new | 158 // TODO(jamescook): This could be SK_ColorWHITE for the new dialog style. |
159 // dialog style via switches::IsNewDialogStyleEnabled(). | |
160 contents_view->set_background( | 159 contents_view->set_background( |
161 views::Background::CreateSolidBackground(SK_ColorBLACK)); | 160 views::Background::CreateSolidBackground(SK_ColorBLACK)); |
162 modal_background_->SetContentsView(contents_view); | 161 modal_background_->SetContentsView(contents_view); |
163 modal_background_->GetNativeView()->layer()->SetOpacity(0.0f); | 162 modal_background_->GetNativeView()->layer()->SetOpacity(0.0f); |
164 } | 163 } |
165 | 164 |
166 ui::ScopedLayerAnimationSettings settings( | 165 ui::ScopedLayerAnimationSettings settings( |
167 modal_background_->GetNativeView()->layer()->GetAnimator()); | 166 modal_background_->GetNativeView()->layer()->GetAnimator()); |
168 modal_background_->Show(); | 167 modal_background_->Show(); |
169 modal_background_->GetNativeView()->layer()->SetOpacity(0.5f); | 168 modal_background_->GetNativeView()->layer()->SetOpacity(0.5f); |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 void SystemModalContainerLayoutManager::RemoveModalWindow( | 214 void SystemModalContainerLayoutManager::RemoveModalWindow( |
216 aura::Window* window) { | 215 aura::Window* window) { |
217 aura::Window::Windows::iterator it = | 216 aura::Window::Windows::iterator it = |
218 std::find(modal_windows_.begin(), modal_windows_.end(), window); | 217 std::find(modal_windows_.begin(), modal_windows_.end(), window); |
219 if (it != modal_windows_.end()) | 218 if (it != modal_windows_.end()) |
220 modal_windows_.erase(it); | 219 modal_windows_.erase(it); |
221 } | 220 } |
222 | 221 |
223 } // namespace internal | 222 } // namespace internal |
224 } // namespace ash | 223 } // namespace ash |
OLD | NEW |