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

Side by Side Diff: ash/wm/workspace/phantom_window_controller.cc

Issue 10835047: Allow the cursor to warp even when a window is dragged (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: address comments Created 8 years, 4 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "ash/shell.h" 7 #include "ash/shell.h"
8 #include "ash/shell_window_ids.h" 8 #include "ash/shell_window_ids.h"
9 #include "ash/wm/coordinate_conversion.h"
9 #include "third_party/skia/include/core/SkCanvas.h" 10 #include "third_party/skia/include/core/SkCanvas.h"
10 #include "ui/aura/window.h" 11 #include "ui/aura/window.h"
11 #include "ui/aura/window_observer.h" 12 #include "ui/aura/window_observer.h"
12 #include "ui/base/animation/slide_animation.h" 13 #include "ui/base/animation/slide_animation.h"
13 #include "ui/compositor/layer.h" 14 #include "ui/compositor/layer.h"
14 #include "ui/compositor/scoped_layer_animation_settings.h" 15 #include "ui/compositor/scoped_layer_animation_settings.h"
15 #include "ui/gfx/canvas.h" 16 #include "ui/gfx/canvas.h"
16 #include "ui/gfx/skia_util.h" 17 #include "ui/gfx/skia_util.h"
17 #include "ui/views/painter.h" 18 #include "ui/views/painter.h"
18 #include "ui/views/view.h" 19 #include "ui/views/view.h"
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 119
119 void PhantomWindowController::CreatePhantomWidget(const gfx::Rect& bounds) { 120 void PhantomWindowController::CreatePhantomWidget(const gfx::Rect& bounds) {
120 DCHECK(!phantom_widget_.get()); 121 DCHECK(!phantom_widget_.get());
121 phantom_widget_.reset(new views::Widget); 122 phantom_widget_.reset(new views::Widget);
122 views::Widget::InitParams params(views::Widget::InitParams::TYPE_POPUP); 123 views::Widget::InitParams params(views::Widget::InitParams::TYPE_POPUP);
123 params.transparent = true; 124 params.transparent = true;
124 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; 125 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET;
125 // PhantomWindowController is used by FrameMaximizeButton to highlight the 126 // PhantomWindowController is used by FrameMaximizeButton to highlight the
126 // launcher button. Put the phantom in the same window as the launcher so that 127 // launcher button. Put the phantom in the same window as the launcher so that
127 // the phantom is visible. 128 // the phantom is visible.
128 params.parent = Shell::GetContainer( 129 params.parent = Shell::GetContainer(wm::GetRootWindowMatching(bounds),
129 Shell::GetInstance()->GetRootWindowMatching(bounds), 130 kShellWindowId_LauncherContainer);
130 kShellWindowId_LauncherContainer);
131 params.can_activate = false; 131 params.can_activate = false;
132 params.keep_on_top = true; 132 params.keep_on_top = true;
133 phantom_widget_->set_focus_on_creation(false); 133 phantom_widget_->set_focus_on_creation(false);
134 phantom_widget_->Init(params); 134 phantom_widget_->Init(params);
135 phantom_widget_->SetVisibilityChangedAnimationsEnabled(false); 135 phantom_widget_->SetVisibilityChangedAnimationsEnabled(false);
136 phantom_widget_->GetNativeWindow()->SetName("PhantomWindow"); 136 phantom_widget_->GetNativeWindow()->SetName("PhantomWindow");
137 views::View* content_view = new views::View; 137 views::View* content_view = new views::View;
138 content_view->set_background( 138 content_view->set_background(
139 views::Background::CreateBackgroundPainter(true, new EdgePainter)); 139 views::Background::CreateBackgroundPainter(true, new EdgePainter));
140 phantom_widget_->SetContentsView(content_view); 140 phantom_widget_->SetContentsView(content_view);
141 phantom_widget_->SetBounds(bounds); 141 phantom_widget_->SetBounds(bounds);
142 phantom_widget_->StackAbove(window_); 142 phantom_widget_->StackAbove(window_);
143 phantom_widget_->Show(); 143 phantom_widget_->Show();
144 // Fade the window in. 144 // Fade the window in.
145 ui::Layer* layer = phantom_widget_->GetNativeWindow()->layer(); 145 ui::Layer* layer = phantom_widget_->GetNativeWindow()->layer();
146 layer->SetOpacity(0); 146 layer->SetOpacity(0);
147 ui::ScopedLayerAnimationSettings scoped_setter(layer->GetAnimator()); 147 ui::ScopedLayerAnimationSettings scoped_setter(layer->GetAnimator());
148 layer->SetOpacity(1); 148 layer->SetOpacity(1);
149 } 149 }
150 150
151 } // namespace internal 151 } // namespace internal
152 } // namespace ash 152 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698