Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(907)

Unified Diff: ash/wm/workspace/phantom_window_controller.cc

Issue 1909273003: Makes PhantonWindowController use ash/wm/common types (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@workspace_window_resizer
Patch Set: merge 2 trunk Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ash/wm/workspace/phantom_window_controller.h ('k') | ash/wm/workspace/workspace_window_resizer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/wm/workspace/phantom_window_controller.cc
diff --git a/ash/wm/workspace/phantom_window_controller.cc b/ash/wm/workspace/phantom_window_controller.cc
index d300137df1faeb689e7f265aace1c129e500e2e0..f39dc653e340f0336827ace25bd697ece140c68f 100644
--- a/ash/wm/workspace/phantom_window_controller.cc
+++ b/ash/wm/workspace/phantom_window_controller.cc
@@ -6,12 +6,11 @@
#include <math.h>
-#include "ash/shell.h"
#include "ash/shell_window_ids.h"
-#include "ash/wm/aura/wm_window_aura.h"
#include "ash/wm/common/root_window_finder.h"
+#include "ash/wm/common/wm_root_window_controller.h"
+#include "ash/wm/common/wm_window.h"
#include "grit/ash_resources.h"
-#include "ui/aura/window.h"
#include "ui/compositor/layer.h"
#include "ui/compositor/scoped_layer_animation_settings.h"
#include "ui/views/background.h"
@@ -61,7 +60,7 @@ void AnimateToBounds(views::Widget* widget,
return;
ui::ScopedLayerAnimationSettings scoped_setter(
- widget->GetNativeWindow()->layer()->GetAnimator());
+ wm::WmWindow::Get(widget)->GetLayer()->GetAnimator());
scoped_setter.SetTweenType(gfx::Tween::EASE_IN);
scoped_setter.SetPreemptionStrategy(
ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET);
@@ -74,9 +73,8 @@ void AnimateToBounds(views::Widget* widget,
// PhantomWindowController ----------------------------------------------------
-PhantomWindowController::PhantomWindowController(aura::Window* window)
- : window_(window) {
-}
+PhantomWindowController::PhantomWindowController(wm::WmWindow* window)
+ : window_(window) {}
PhantomWindowController::~PhantomWindowController() {
}
@@ -97,16 +95,15 @@ void PhantomWindowController::Show(const gfx::Rect& bounds_in_screen) {
start_bounds_in_screen.Inset(
floor((start_bounds_in_screen.width() - start_width) / 2.0f),
floor((start_bounds_in_screen.height() - start_height) / 2.0f));
- phantom_widget_ = CreatePhantomWidget(
- wm::WmWindowAura::GetAuraWindow(
- wm::GetRootWindowMatching(target_bounds_in_screen_)),
- start_bounds_in_screen);
+ phantom_widget_ =
+ CreatePhantomWidget(wm::GetRootWindowMatching(target_bounds_in_screen_),
+ start_bounds_in_screen);
AnimateToBounds(phantom_widget_.get(), target_bounds_in_screen_);
}
std::unique_ptr<views::Widget> PhantomWindowController::CreatePhantomWidget(
- aura::Window* root_window,
+ wm::WmWindow* root_window,
const gfx::Rect& bounds_in_screen) {
std::unique_ptr<views::Widget> phantom_widget(new views::Widget);
views::Widget::InitParams params(views::Widget::InitParams::TYPE_POPUP);
@@ -114,17 +111,22 @@ std::unique_ptr<views::Widget> PhantomWindowController::CreatePhantomWidget(
// PhantomWindowController is used by FrameMaximizeButton to highlight the
// launcher button. Put the phantom in the same window as the launcher so that
// the phantom is visible.
- params.parent = Shell::GetContainer(root_window,
- kShellWindowId_ShelfContainer);
params.keep_on_top = true;
params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET;
+ root_window->GetRootWindowController()->ConfigureWidgetInitParamsForContainer(
+ phantom_widget.get(), kShellWindowId_ShelfContainer, &params);
phantom_widget->set_focus_on_creation(false);
phantom_widget->Init(params);
phantom_widget->SetVisibilityChangedAnimationsEnabled(false);
- phantom_widget->GetNativeWindow()->SetName("PhantomWindow");
- phantom_widget->GetNativeWindow()->set_id(kShellWindowId_PhantomWindow);
+ wm::WmWindow* phantom_widget_window = wm::WmWindow::Get(phantom_widget.get());
+ phantom_widget_window->SetName("PhantomWindow");
+ phantom_widget_window->SetShellWindowId(kShellWindowId_PhantomWindow);
phantom_widget->SetBounds(bounds_in_screen);
- phantom_widget->StackAbove(window_);
+ // TODO(sky): I suspect this is never true, verify that.
+ if (phantom_widget_window->GetParent() == window_->GetParent()) {
+ phantom_widget_window->GetParent()->StackChildAbove(phantom_widget_window,
+ window_);
+ }
const int kImages[] = IMAGE_GRID(IDR_AURA_PHANTOM_WINDOW);
views::Painter* background_painter =
@@ -138,7 +140,7 @@ std::unique_ptr<views::Widget> PhantomWindowController::CreatePhantomWidget(
phantom_widget->Show();
// Fade the window in.
- ui::Layer* widget_layer = phantom_widget->GetNativeWindow()->layer();
+ ui::Layer* widget_layer = phantom_widget_window->GetLayer();
widget_layer->SetOpacity(0);
ui::ScopedLayerAnimationSettings scoped_setter(widget_layer->GetAnimator());
scoped_setter.SetTransitionDuration(
« no previous file with comments | « ash/wm/workspace/phantom_window_controller.h ('k') | ash/wm/workspace/workspace_window_resizer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698