| 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/workspace/phantom_window_controller.h" | 5 #include "ash/wm/workspace/phantom_window_controller.h" |
| 6 | 6 |
| 7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
| 8 #include "ash/shell_window_ids.h" | 8 #include "ash/shell_window_ids.h" |
| 9 #include "ash/wm/coordinate_conversion.h" | 9 #include "ash/wm/coordinate_conversion.h" |
| 10 #include "third_party/skia/include/core/SkCanvas.h" | 10 #include "third_party/skia/include/core/SkCanvas.h" |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 | 120 |
| 121 void PhantomWindowController::CreatePhantomWidget(const gfx::Rect& bounds) { | 121 void PhantomWindowController::CreatePhantomWidget(const gfx::Rect& bounds) { |
| 122 DCHECK(!phantom_widget_); | 122 DCHECK(!phantom_widget_); |
| 123 phantom_widget_ = new views::Widget; | 123 phantom_widget_ = new views::Widget; |
| 124 views::Widget::InitParams params(views::Widget::InitParams::TYPE_POPUP); | 124 views::Widget::InitParams params(views::Widget::InitParams::TYPE_POPUP); |
| 125 params.transparent = true; | 125 params.transparent = true; |
| 126 // PhantomWindowController is used by FrameMaximizeButton to highlight the | 126 // PhantomWindowController is used by FrameMaximizeButton to highlight the |
| 127 // launcher button. Put the phantom in the same window as the launcher so that | 127 // launcher button. Put the phantom in the same window as the launcher so that |
| 128 // the phantom is visible. | 128 // the phantom is visible. |
| 129 params.parent = Shell::GetContainer(wm::GetRootWindowMatching(bounds), | 129 params.parent = Shell::GetContainer(wm::GetRootWindowMatching(bounds), |
| 130 kShellWindowId_LauncherContainer); | 130 kShellWindowId_ShelfContainer); |
| 131 params.can_activate = false; | 131 params.can_activate = false; |
| 132 params.keep_on_top = true; | 132 params.keep_on_top = true; |
| 133 phantom_widget_->set_focus_on_creation(false); | 133 phantom_widget_->set_focus_on_creation(false); |
| 134 phantom_widget_->Init(params); | 134 phantom_widget_->Init(params); |
| 135 phantom_widget_->SetVisibilityChangedAnimationsEnabled(false); | 135 phantom_widget_->SetVisibilityChangedAnimationsEnabled(false); |
| 136 phantom_widget_->GetNativeWindow()->SetName("PhantomWindow"); | 136 phantom_widget_->GetNativeWindow()->SetName("PhantomWindow"); |
| 137 phantom_widget_->GetNativeWindow()->set_id(kShellWindowId_PhantomWindow); | 137 phantom_widget_->GetNativeWindow()->set_id(kShellWindowId_PhantomWindow); |
| 138 views::View* content_view = new views::View; | 138 views::View* content_view = new views::View; |
| 139 content_view->set_background( | 139 content_view->set_background( |
| 140 views::Background::CreateBackgroundPainter(true, new EdgePainter)); | 140 views::Background::CreateBackgroundPainter(true, new EdgePainter)); |
| 141 phantom_widget_->SetContentsView(content_view); | 141 phantom_widget_->SetContentsView(content_view); |
| 142 phantom_widget_->SetBounds(bounds); | 142 phantom_widget_->SetBounds(bounds); |
| 143 if (phantom_below_window_) | 143 if (phantom_below_window_) |
| 144 phantom_widget_->StackBelow(phantom_below_window_); | 144 phantom_widget_->StackBelow(phantom_below_window_); |
| 145 else | 145 else |
| 146 phantom_widget_->StackAbove(window_); | 146 phantom_widget_->StackAbove(window_); |
| 147 | 147 |
| 148 // Show the widget after all the setups. | 148 // Show the widget after all the setups. |
| 149 phantom_widget_->Show(); | 149 phantom_widget_->Show(); |
| 150 | 150 |
| 151 // Fade the window in. | 151 // Fade the window in. |
| 152 ui::Layer* widget_layer = phantom_widget_->GetNativeWindow()->layer(); | 152 ui::Layer* widget_layer = phantom_widget_->GetNativeWindow()->layer(); |
| 153 widget_layer->SetOpacity(0); | 153 widget_layer->SetOpacity(0); |
| 154 ui::ScopedLayerAnimationSettings scoped_setter(widget_layer->GetAnimator()); | 154 ui::ScopedLayerAnimationSettings scoped_setter(widget_layer->GetAnimator()); |
| 155 widget_layer->SetOpacity(1); | 155 widget_layer->SetOpacity(1); |
| 156 } | 156 } |
| 157 | 157 |
| 158 } // namespace internal | 158 } // namespace internal |
| 159 } // namespace ash | 159 } // namespace ash |
| OLD | NEW |