| 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/panels/panel_layout_manager.h" | 5 #include "ash/wm/panels/panel_layout_manager.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <map> | 8 #include <map> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 views::Widget::InitParams params; | 215 views::Widget::InitParams params; |
| 216 params.type = views::Widget::InitParams::TYPE_POPUP; | 216 params.type = views::Widget::InitParams::TYPE_POPUP; |
| 217 params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW; | 217 params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW; |
| 218 params.keep_on_top = true; | 218 params.keep_on_top = true; |
| 219 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; | 219 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; |
| 220 params.bounds = parent->ConvertRectToScreen(gfx::Rect()); | 220 params.bounds = parent->ConvertRectToScreen(gfx::Rect()); |
| 221 params.bounds.set_width(kArrowWidth); | 221 params.bounds.set_width(kArrowWidth); |
| 222 params.bounds.set_height(kArrowHeight); | 222 params.bounds.set_height(kArrowHeight); |
| 223 params.accept_events = false; | 223 params.accept_events = false; |
| 224 parent->GetRootWindowController()->ConfigureWidgetInitParamsForContainer( | 224 parent->GetRootWindowController()->ConfigureWidgetInitParamsForContainer( |
| 225 this, parent->GetShellWindowId(), ¶ms); | 225 this, parent->aura_window()->id(), ¶ms); |
| 226 set_focus_on_creation(false); | 226 set_focus_on_creation(false); |
| 227 Init(params); | 227 Init(params); |
| 228 WmWindow* widget_window = WmWindow::Get(this->GetNativeWindow()); | 228 WmWindow* widget_window = WmWindow::Get(this->GetNativeWindow()); |
| 229 DCHECK_EQ(widget_window->GetRootWindow(), parent->GetRootWindow()); | 229 DCHECK_EQ(widget_window->GetRootWindow(), parent->GetRootWindow()); |
| 230 views::View* content_view = new views::View; | 230 views::View* content_view = new views::View; |
| 231 background_ = new CalloutWidgetBackground; | 231 background_ = new CalloutWidgetBackground; |
| 232 content_view->set_background(background_); | 232 content_view->set_background(background_); |
| 233 SetContentsView(content_view); | 233 SetContentsView(content_view); |
| 234 widget_window->GetLayer()->SetOpacity(0); | 234 widget_window->GetLayer()->SetOpacity(0); |
| 235 } | 235 } |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 Shutdown(); | 267 Shutdown(); |
| 268 } | 268 } |
| 269 | 269 |
| 270 // static | 270 // static |
| 271 PanelLayoutManager* PanelLayoutManager::Get(WmWindow* window) { | 271 PanelLayoutManager* PanelLayoutManager::Get(WmWindow* window) { |
| 272 if (!window) | 272 if (!window) |
| 273 return nullptr; | 273 return nullptr; |
| 274 | 274 |
| 275 return static_cast<PanelLayoutManager*>( | 275 return static_cast<PanelLayoutManager*>( |
| 276 window->GetRootWindow() | 276 window->GetRootWindow() |
| 277 ->GetChildByShellWindowId(kShellWindowId_PanelContainer) | |
| 278 ->aura_window() | 277 ->aura_window() |
| 278 ->GetChildById(kShellWindowId_PanelContainer) |
| 279 ->layout_manager()); | 279 ->layout_manager()); |
| 280 } | 280 } |
| 281 | 281 |
| 282 void PanelLayoutManager::Shutdown() { | 282 void PanelLayoutManager::Shutdown() { |
| 283 if (shelf_) { | 283 if (shelf_) { |
| 284 shelf_->RemoveObserver(this); | 284 shelf_->RemoveObserver(this); |
| 285 shelf_ = nullptr; | 285 shelf_ = nullptr; |
| 286 } | 286 } |
| 287 for (PanelList::iterator iter = panel_windows_.begin(); | 287 for (PanelList::iterator iter = panel_windows_.begin(); |
| 288 iter != panel_windows_.end(); ++iter) { | 288 iter != panel_windows_.end(); ++iter) { |
| (...skipping 652 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 941 // This bounds change will have caused a change to the Shelf which does not | 941 // This bounds change will have caused a change to the Shelf which does not |
| 942 // propogate automatically to this class, so manually recalculate bounds. | 942 // propogate automatically to this class, so manually recalculate bounds. |
| 943 OnWindowResized(); | 943 OnWindowResized(); |
| 944 } | 944 } |
| 945 | 945 |
| 946 void PanelLayoutManager::OnKeyboardClosed() { | 946 void PanelLayoutManager::OnKeyboardClosed() { |
| 947 keyboard_observer_.RemoveAll(); | 947 keyboard_observer_.RemoveAll(); |
| 948 } | 948 } |
| 949 | 949 |
| 950 } // namespace ash | 950 } // namespace ash |
| OLD | NEW |