| 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/common/workspace/phantom_window_controller.h" | 5 #include "ash/wm/common/workspace/phantom_window_controller.h" |
| 6 | 6 |
| 7 #include <math.h> | 7 #include <math.h> |
| 8 | 8 |
| 9 #include "ash/wm/common/root_window_finder.h" | 9 #include "ash/wm/common/root_window_finder.h" |
| 10 #include "ash/wm/common/wm_root_window_controller.h" | 10 #include "ash/wm/common/wm_root_window_controller.h" |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 wm::WmWindow* root_window, | 105 wm::WmWindow* root_window, |
| 106 const gfx::Rect& bounds_in_screen) { | 106 const gfx::Rect& bounds_in_screen) { |
| 107 std::unique_ptr<views::Widget> phantom_widget(new views::Widget); | 107 std::unique_ptr<views::Widget> phantom_widget(new views::Widget); |
| 108 views::Widget::InitParams params(views::Widget::InitParams::TYPE_POPUP); | 108 views::Widget::InitParams params(views::Widget::InitParams::TYPE_POPUP); |
| 109 params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW; | 109 params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW; |
| 110 // PhantomWindowController is used by FrameMaximizeButton to highlight the | 110 // PhantomWindowController is used by FrameMaximizeButton to highlight the |
| 111 // launcher button. Put the phantom in the same window as the launcher so that | 111 // launcher button. Put the phantom in the same window as the launcher so that |
| 112 // the phantom is visible. | 112 // the phantom is visible. |
| 113 params.keep_on_top = true; | 113 params.keep_on_top = true; |
| 114 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; | 114 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; |
| 115 params.name = "PhantomWindow"; |
| 115 root_window->GetRootWindowController()->ConfigureWidgetInitParamsForContainer( | 116 root_window->GetRootWindowController()->ConfigureWidgetInitParamsForContainer( |
| 116 phantom_widget.get(), kShellWindowId_ShelfContainer, ¶ms); | 117 phantom_widget.get(), kShellWindowId_ShelfContainer, ¶ms); |
| 117 phantom_widget->set_focus_on_creation(false); | 118 phantom_widget->set_focus_on_creation(false); |
| 118 phantom_widget->Init(params); | 119 phantom_widget->Init(params); |
| 119 phantom_widget->SetVisibilityChangedAnimationsEnabled(false); | 120 phantom_widget->SetVisibilityChangedAnimationsEnabled(false); |
| 120 wm::WmWindow* phantom_widget_window = wm::WmWindow::Get(phantom_widget.get()); | 121 wm::WmWindow* phantom_widget_window = wm::WmWindow::Get(phantom_widget.get()); |
| 121 phantom_widget_window->SetName("PhantomWindow"); | |
| 122 phantom_widget_window->SetShellWindowId(kShellWindowId_PhantomWindow); | 122 phantom_widget_window->SetShellWindowId(kShellWindowId_PhantomWindow); |
| 123 phantom_widget->SetBounds(bounds_in_screen); | 123 phantom_widget->SetBounds(bounds_in_screen); |
| 124 // TODO(sky): I suspect this is never true, verify that. | 124 // TODO(sky): I suspect this is never true, verify that. |
| 125 if (phantom_widget_window->GetParent() == window_->GetParent()) { | 125 if (phantom_widget_window->GetParent() == window_->GetParent()) { |
| 126 phantom_widget_window->GetParent()->StackChildAbove(phantom_widget_window, | 126 phantom_widget_window->GetParent()->StackChildAbove(phantom_widget_window, |
| 127 window_); | 127 window_); |
| 128 } | 128 } |
| 129 | 129 |
| 130 const int kImages[] = IMAGE_GRID(IDR_AURA_PHANTOM_WINDOW); | 130 const int kImages[] = IMAGE_GRID(IDR_AURA_PHANTOM_WINDOW); |
| 131 views::Painter* background_painter = | 131 views::Painter* background_painter = |
| (...skipping 11 matching lines...) Expand all Loading... |
| 143 widget_layer->SetOpacity(0); | 143 widget_layer->SetOpacity(0); |
| 144 ui::ScopedLayerAnimationSettings scoped_setter(widget_layer->GetAnimator()); | 144 ui::ScopedLayerAnimationSettings scoped_setter(widget_layer->GetAnimator()); |
| 145 scoped_setter.SetTransitionDuration( | 145 scoped_setter.SetTransitionDuration( |
| 146 base::TimeDelta::FromMilliseconds(kAnimationDurationMs)); | 146 base::TimeDelta::FromMilliseconds(kAnimationDurationMs)); |
| 147 widget_layer->SetOpacity(1); | 147 widget_layer->SetOpacity(1); |
| 148 | 148 |
| 149 return phantom_widget; | 149 return phantom_widget; |
| 150 } | 150 } |
| 151 | 151 |
| 152 } // namespace ash | 152 } // namespace ash |
| OLD | NEW |