| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/overview/scoped_window_copy.h" | 5 #include "ash/wm/overview/scoped_window_copy.h" |
| 6 | 6 |
| 7 #include "ash/screen_util.h" | 7 #include "ash/screen_util.h" |
| 8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
| 9 #include "ui/aura/client/aura_constants.h" | 9 #include "ui/aura/client/aura_constants.h" |
| 10 #include "ui/aura/client/screen_position_client.h" | 10 #include "ui/aura/client/screen_position_client.h" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 views::Widget::InitParams params(views::Widget::InitParams::TYPE_POPUP); | 35 views::Widget::InitParams params(views::Widget::InitParams::TYPE_POPUP); |
| 36 params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW; | 36 params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW; |
| 37 params.parent = src_window->parent(); | 37 params.parent = src_window->parent(); |
| 38 params.can_activate = false; | 38 params.can_activate = false; |
| 39 params.keep_on_top = true; | 39 params.keep_on_top = true; |
| 40 widget->set_focus_on_creation(false); | 40 widget->set_focus_on_creation(false); |
| 41 widget->Init(params); | 41 widget->Init(params); |
| 42 widget->SetVisibilityChangedAnimationsEnabled(false); | 42 widget->SetVisibilityChangedAnimationsEnabled(false); |
| 43 std::string name = src_window->name() + " (Copy)"; | 43 std::string name = src_window->name() + " (Copy)"; |
| 44 widget->GetNativeWindow()->SetName(name); | 44 widget->GetNativeWindow()->SetName(name); |
| 45 views::corewm::SetShadowType(widget->GetNativeWindow(), | 45 ::wm::SetShadowType(widget->GetNativeWindow(), |
| 46 views::corewm::SHADOW_TYPE_RECTANGULAR); | 46 ::wm::SHADOW_TYPE_RECTANGULAR); |
| 47 | 47 |
| 48 // Set the bounds in the target root window. | 48 // Set the bounds in the target root window. |
| 49 gfx::Display target_display = | 49 gfx::Display target_display = |
| 50 Shell::GetScreen()->GetDisplayNearestWindow(target_root); | 50 Shell::GetScreen()->GetDisplayNearestWindow(target_root); |
| 51 aura::client::ScreenPositionClient* screen_position_client = | 51 aura::client::ScreenPositionClient* screen_position_client = |
| 52 aura::client::GetScreenPositionClient(src_window->GetRootWindow()); | 52 aura::client::GetScreenPositionClient(src_window->GetRootWindow()); |
| 53 if (screen_position_client && target_display.is_valid()) { | 53 if (screen_position_client && target_display.is_valid()) { |
| 54 screen_position_client->SetBounds(widget->GetNativeWindow(), | 54 screen_position_client->SetBounds(widget->GetNativeWindow(), |
| 55 src_window->GetBoundsInScreen(), target_display); | 55 src_window->GetBoundsInScreen(), target_display); |
| 56 } else { | 56 } else { |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 | 153 |
| 154 void CleanupWidgetAfterAnimationObserver::MaybeDestruct() { | 154 void CleanupWidgetAfterAnimationObserver::MaybeDestruct() { |
| 155 if (pending_animations_ || !owns_widget_) | 155 if (pending_animations_ || !owns_widget_) |
| 156 return; | 156 return; |
| 157 delete this; | 157 delete this; |
| 158 } | 158 } |
| 159 | 159 |
| 160 ScopedWindowCopy::ScopedWindowCopy(aura::Window* target_root, | 160 ScopedWindowCopy::ScopedWindowCopy(aura::Window* target_root, |
| 161 aura::Window* src_window) { | 161 aura::Window* src_window) { |
| 162 scoped_ptr<ui::LayerTreeOwner> layer_owner = | 162 scoped_ptr<ui::LayerTreeOwner> layer_owner = |
| 163 views::corewm::RecreateLayers(src_window); | 163 ::wm::RecreateLayers(src_window); |
| 164 widget_ = CreateCopyOfWindow(target_root, src_window, layer_owner->root()); | 164 widget_ = CreateCopyOfWindow(target_root, src_window, layer_owner->root()); |
| 165 cleanup_observer_ = | 165 cleanup_observer_ = |
| 166 new CleanupWidgetAfterAnimationObserver(widget_, layer_owner.Pass()); | 166 new CleanupWidgetAfterAnimationObserver(widget_, layer_owner.Pass()); |
| 167 } | 167 } |
| 168 | 168 |
| 169 ScopedWindowCopy::~ScopedWindowCopy() { | 169 ScopedWindowCopy::~ScopedWindowCopy() { |
| 170 // The cleanup observer will delete itself and the window when any pending | 170 // The cleanup observer will delete itself and the window when any pending |
| 171 // animations have completed. | 171 // animations have completed. |
| 172 cleanup_observer_->TakeOwnershipOfWidget(); | 172 cleanup_observer_->TakeOwnershipOfWidget(); |
| 173 } | 173 } |
| 174 | 174 |
| 175 aura::Window* ScopedWindowCopy::GetWindow() { | 175 aura::Window* ScopedWindowCopy::GetWindow() { |
| 176 return widget_->GetNativeWindow(); | 176 return widget_->GetNativeWindow(); |
| 177 } | 177 } |
| 178 | 178 |
| 179 } // namespace ash | 179 } // namespace ash |
| OLD | NEW |