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/public/cpp/shell_window_ids.h" | 9 #include "ash/public/cpp/shell_window_ids.h" |
10 #include "ash/resources/grit/ash_resources.h" | 10 #include "ash/resources/grit/ash_resources.h" |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 params.name = "PhantomWindow"; |
116 root_window->GetRootWindowController()->ConfigureWidgetInitParamsForContainer( | 116 root_window->GetRootWindowController()->ConfigureWidgetInitParamsForContainer( |
117 phantom_widget.get(), kShellWindowId_ShelfContainer, ¶ms); | 117 phantom_widget.get(), kShellWindowId_ShelfContainer, ¶ms); |
118 phantom_widget->set_focus_on_creation(false); | 118 phantom_widget->set_focus_on_creation(false); |
119 phantom_widget->Init(params); | 119 phantom_widget->Init(params); |
120 phantom_widget->SetVisibilityChangedAnimationsEnabled(false); | 120 phantom_widget->SetVisibilityChangedAnimationsEnabled(false); |
121 WmWindow* phantom_widget_window = | 121 WmWindow* phantom_widget_window = |
122 WmWindow::Get(phantom_widget->GetNativeWindow()); | 122 WmWindow::Get(phantom_widget->GetNativeWindow()); |
123 phantom_widget_window->SetShellWindowId(kShellWindowId_PhantomWindow); | 123 phantom_widget_window->aura_window()->set_id(kShellWindowId_PhantomWindow); |
124 phantom_widget->SetBounds(bounds_in_screen); | 124 phantom_widget->SetBounds(bounds_in_screen); |
125 // TODO(sky): I suspect this is never true, verify that. | 125 // TODO(sky): I suspect this is never true, verify that. |
126 if (phantom_widget_window->GetParent() == window_->GetParent()) { | 126 if (phantom_widget_window->GetParent() == window_->GetParent()) { |
127 phantom_widget_window->GetParent()->StackChildAbove(phantom_widget_window, | 127 phantom_widget_window->GetParent()->StackChildAbove(phantom_widget_window, |
128 window_); | 128 window_); |
129 } | 129 } |
130 | 130 |
131 const int kImages[] = IMAGE_GRID(IDR_AURA_PHANTOM_WINDOW); | 131 const int kImages[] = IMAGE_GRID(IDR_AURA_PHANTOM_WINDOW); |
132 views::View* content_view = new views::View; | 132 views::View* content_view = new views::View; |
133 content_view->set_background(views::Background::CreateBackgroundPainter( | 133 content_view->set_background(views::Background::CreateBackgroundPainter( |
134 views::Painter::CreateImageGridPainter(kImages))); | 134 views::Painter::CreateImageGridPainter(kImages))); |
135 phantom_widget->SetContentsView(content_view); | 135 phantom_widget->SetContentsView(content_view); |
136 | 136 |
137 // Show the widget after all the setups. | 137 // Show the widget after all the setups. |
138 phantom_widget->Show(); | 138 phantom_widget->Show(); |
139 | 139 |
140 // Fade the window in. | 140 // Fade the window in. |
141 ui::Layer* widget_layer = phantom_widget_window->GetLayer(); | 141 ui::Layer* widget_layer = phantom_widget_window->GetLayer(); |
142 widget_layer->SetOpacity(0); | 142 widget_layer->SetOpacity(0); |
143 ui::ScopedLayerAnimationSettings scoped_setter(widget_layer->GetAnimator()); | 143 ui::ScopedLayerAnimationSettings scoped_setter(widget_layer->GetAnimator()); |
144 scoped_setter.SetTransitionDuration( | 144 scoped_setter.SetTransitionDuration( |
145 base::TimeDelta::FromMilliseconds(kAnimationDurationMs)); | 145 base::TimeDelta::FromMilliseconds(kAnimationDurationMs)); |
146 widget_layer->SetOpacity(1); | 146 widget_layer->SetOpacity(1); |
147 | 147 |
148 return phantom_widget; | 148 return phantom_widget; |
149 } | 149 } |
150 | 150 |
151 } // namespace ash | 151 } // namespace ash |
OLD | NEW |