| 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/common/wm/workspace/phantom_window_controller.h" | 5 #include "ash/common/wm/workspace/phantom_window_controller.h" |
| 6 | 6 |
| 7 #include <math.h> | 7 #include <math.h> |
| 8 | 8 |
| 9 #include "ash/common/wm/root_window_finder.h" | 9 #include "ash/common/wm/root_window_finder.h" |
| 10 #include "ash/common/wm_lookup.h" | 10 #include "ash/common/wm_lookup.h" |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 WmLookup::Get()->GetWindowForWidget(phantom_widget.get()); | 123 WmLookup::Get()->GetWindowForWidget(phantom_widget.get()); |
| 124 phantom_widget_window->SetShellWindowId(kShellWindowId_PhantomWindow); | 124 phantom_widget_window->SetShellWindowId(kShellWindowId_PhantomWindow); |
| 125 phantom_widget->SetBounds(bounds_in_screen); | 125 phantom_widget->SetBounds(bounds_in_screen); |
| 126 // TODO(sky): I suspect this is never true, verify that. | 126 // TODO(sky): I suspect this is never true, verify that. |
| 127 if (phantom_widget_window->GetParent() == window_->GetParent()) { | 127 if (phantom_widget_window->GetParent() == window_->GetParent()) { |
| 128 phantom_widget_window->GetParent()->StackChildAbove(phantom_widget_window, | 128 phantom_widget_window->GetParent()->StackChildAbove(phantom_widget_window, |
| 129 window_); | 129 window_); |
| 130 } | 130 } |
| 131 | 131 |
| 132 const int kImages[] = IMAGE_GRID(IDR_AURA_PHANTOM_WINDOW); | 132 const int kImages[] = IMAGE_GRID(IDR_AURA_PHANTOM_WINDOW); |
| 133 views::Painter* background_painter = | |
| 134 views::Painter::CreateImageGridPainter(kImages); | |
| 135 views::View* content_view = new views::View; | 133 views::View* content_view = new views::View; |
| 136 content_view->set_background( | 134 content_view->set_background(views::Background::CreateBackgroundPainter( |
| 137 views::Background::CreateBackgroundPainter(true, background_painter)); | 135 views::Painter::CreateImageGridPainter(kImages))); |
| 138 phantom_widget->SetContentsView(content_view); | 136 phantom_widget->SetContentsView(content_view); |
| 139 | 137 |
| 140 // Show the widget after all the setups. | 138 // Show the widget after all the setups. |
| 141 phantom_widget->Show(); | 139 phantom_widget->Show(); |
| 142 | 140 |
| 143 // Fade the window in. | 141 // Fade the window in. |
| 144 ui::Layer* widget_layer = phantom_widget_window->GetLayer(); | 142 ui::Layer* widget_layer = phantom_widget_window->GetLayer(); |
| 145 widget_layer->SetOpacity(0); | 143 widget_layer->SetOpacity(0); |
| 146 ui::ScopedLayerAnimationSettings scoped_setter(widget_layer->GetAnimator()); | 144 ui::ScopedLayerAnimationSettings scoped_setter(widget_layer->GetAnimator()); |
| 147 scoped_setter.SetTransitionDuration( | 145 scoped_setter.SetTransitionDuration( |
| 148 base::TimeDelta::FromMilliseconds(kAnimationDurationMs)); | 146 base::TimeDelta::FromMilliseconds(kAnimationDurationMs)); |
| 149 widget_layer->SetOpacity(1); | 147 widget_layer->SetOpacity(1); |
| 150 | 148 |
| 151 return phantom_widget; | 149 return phantom_widget; |
| 152 } | 150 } |
| 153 | 151 |
| 154 } // namespace ash | 152 } // namespace ash |
| OLD | NEW |