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 <math.h> | 7 #include <math.h> |
8 | 8 |
9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
10 #include "ash/shell_window_ids.h" | 10 #include "ash/shell_window_ids.h" |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 start_bounds_in_screen.Inset( | 96 start_bounds_in_screen.Inset( |
97 floor((start_bounds_in_screen.width() - start_width) / 2.0f), | 97 floor((start_bounds_in_screen.width() - start_width) / 2.0f), |
98 floor((start_bounds_in_screen.height() - start_height) / 2.0f)); | 98 floor((start_bounds_in_screen.height() - start_height) / 2.0f)); |
99 phantom_widget_ = CreatePhantomWidget( | 99 phantom_widget_ = CreatePhantomWidget( |
100 wm::GetRootWindowMatching(target_bounds_in_screen_), | 100 wm::GetRootWindowMatching(target_bounds_in_screen_), |
101 start_bounds_in_screen); | 101 start_bounds_in_screen); |
102 | 102 |
103 AnimateToBounds(phantom_widget_.get(), target_bounds_in_screen_); | 103 AnimateToBounds(phantom_widget_.get(), target_bounds_in_screen_); |
104 } | 104 } |
105 | 105 |
106 scoped_ptr<views::Widget> PhantomWindowController::CreatePhantomWidget( | 106 std::unique_ptr<views::Widget> PhantomWindowController::CreatePhantomWidget( |
107 aura::Window* root_window, | 107 aura::Window* root_window, |
108 const gfx::Rect& bounds_in_screen) { | 108 const gfx::Rect& bounds_in_screen) { |
109 scoped_ptr<views::Widget> phantom_widget(new views::Widget); | 109 std::unique_ptr<views::Widget> phantom_widget(new views::Widget); |
110 views::Widget::InitParams params(views::Widget::InitParams::TYPE_POPUP); | 110 views::Widget::InitParams params(views::Widget::InitParams::TYPE_POPUP); |
111 params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW; | 111 params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW; |
112 // PhantomWindowController is used by FrameMaximizeButton to highlight the | 112 // PhantomWindowController is used by FrameMaximizeButton to highlight the |
113 // launcher button. Put the phantom in the same window as the launcher so that | 113 // launcher button. Put the phantom in the same window as the launcher so that |
114 // the phantom is visible. | 114 // the phantom is visible. |
115 params.parent = Shell::GetContainer(root_window, | 115 params.parent = Shell::GetContainer(root_window, |
116 kShellWindowId_ShelfContainer); | 116 kShellWindowId_ShelfContainer); |
117 params.keep_on_top = true; | 117 params.keep_on_top = true; |
118 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; | 118 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; |
119 phantom_widget->set_focus_on_creation(false); | 119 phantom_widget->set_focus_on_creation(false); |
(...skipping 20 matching lines...) Expand all Loading... |
140 widget_layer->SetOpacity(0); | 140 widget_layer->SetOpacity(0); |
141 ui::ScopedLayerAnimationSettings scoped_setter(widget_layer->GetAnimator()); | 141 ui::ScopedLayerAnimationSettings scoped_setter(widget_layer->GetAnimator()); |
142 scoped_setter.SetTransitionDuration( | 142 scoped_setter.SetTransitionDuration( |
143 base::TimeDelta::FromMilliseconds(kAnimationDurationMs)); | 143 base::TimeDelta::FromMilliseconds(kAnimationDurationMs)); |
144 widget_layer->SetOpacity(1); | 144 widget_layer->SetOpacity(1); |
145 | 145 |
146 return phantom_widget; | 146 return phantom_widget; |
147 } | 147 } |
148 | 148 |
149 } // namespace ash | 149 } // namespace ash |
OLD | NEW |