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

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

Issue 10837211: Draw web content area correctly on a phantom window for window dragging (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review 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 #ifndef ASH_WM_WORKSPACE_PHANTOM_WINDOW_CONTROLLER_H_ 5 #ifndef ASH_WM_WORKSPACE_PHANTOM_WINDOW_CONTROLLER_H_
6 #define ASH_WM_WORKSPACE_PHANTOM_WINDOW_CONTROLLER_H_ 6 #define ASH_WM_WORKSPACE_PHANTOM_WINDOW_CONTROLLER_H_
7 7
8 #include "ash/ash_export.h" 8 #include "ash/ash_export.h"
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
11 #include "ui/base/animation/animation_delegate.h" 11 #include "ui/base/animation/animation_delegate.h"
12 #include "ui/gfx/display.h" 12 #include "ui/gfx/display.h"
13 #include "ui/gfx/rect.h" 13 #include "ui/gfx/rect.h"
14 14
15 namespace aura { 15 namespace aura {
16 class RootWindow;
16 class Window; 17 class Window;
17 class RootWindow;
18 } 18 }
19 19
20 namespace ui { 20 namespace ui {
21 class Layer;
21 class SlideAnimation; 22 class SlideAnimation;
22 } 23 }
23 24
24 namespace views { 25 namespace views {
25 class Widget; 26 class Widget;
26 } 27 }
27 28
28 namespace ash { 29 namespace ash {
29 namespace internal { 30 namespace internal {
30 31
31 // PhantomWindowController is responsible for showing a phantom representation 32 // PhantomWindowController is responsible for showing a phantom representation
32 // of a window. It's used used during dragging a window to show a snap location. 33 // of a window. It's used used during dragging a window to show a snap location.
33 class ASH_EXPORT PhantomWindowController : public ui::AnimationDelegate { 34 class ASH_EXPORT PhantomWindowController : public ui::AnimationDelegate {
34 public: 35 public:
36 // TODO(yusukes): Rename STYLE_WINDOW to STYLE_NONE and remove WindowPainter.
37 // See comments in CreatePhantomWidget() for more details.
35 enum Style { 38 enum Style {
36 STYLE_SHADOW, // for window snapping. 39 STYLE_SHADOW, // for window snapping.
37 STYLE_WINDOW, // for window dragging. 40 STYLE_WINDOW, // for window dragging.
38 }; 41 };
39 42
40 explicit PhantomWindowController(aura::Window* window); 43 explicit PhantomWindowController(aura::Window* window);
41 virtual ~PhantomWindowController(); 44 virtual ~PhantomWindowController();
42 45
43 // Sets the display where the phantom is placed. 46 // Sets the display where the phantom is placed.
44 void SetDestinationDisplay(const gfx::Display& dst_display); 47 void SetDestinationDisplay(const gfx::Display& dst_display);
(...skipping 14 matching lines...) Expand all
59 62
60 // Returns true if the phantom is showing. 63 // Returns true if the phantom is showing.
61 bool IsShowing() const; 64 bool IsShowing() const;
62 65
63 // If set, the phantom window is stacked below this window, otherwise it 66 // If set, the phantom window is stacked below this window, otherwise it
64 // is stacked above the window passed to the constructor. 67 // is stacked above the window passed to the constructor.
65 void set_phantom_below_window(aura::Window* phantom_below_window) { 68 void set_phantom_below_window(aura::Window* phantom_below_window) {
66 phantom_below_window_ = phantom_below_window; 69 phantom_below_window_ = phantom_below_window;
67 } 70 }
68 71
72 // Sets/gets the |layer| which is shown on top of the |phantom_widget_|.
73 // PhantomWindowController does not own the |layer|.
74 void set_layer(ui::Layer* layer);
75 ui::Layer* layer() const { return layer_; }
76
69 // Sets/gets the style of the phantom window. 77 // Sets/gets the style of the phantom window.
70 void set_style(Style style); 78 void set_style(Style style);
71 Style style() const { return style_; } 79 Style style() const { return style_; }
72 80
73 // Sets/gets the opacity of the phantom window. 81 // Sets/gets the opacity of the phantom window.
74 void SetOpacity(float opacity); 82 void SetOpacity(float opacity);
75 float GetOpacity() const; 83 float GetOpacity() const;
76 84
77 // ui::AnimationDelegate overrides: 85 // ui::AnimationDelegate overrides:
78 virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE; 86 virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE;
(...skipping 25 matching lines...) Expand all
104 gfx::Rect bounds_; 112 gfx::Rect bounds_;
105 113
106 views::Widget* phantom_widget_; 114 views::Widget* phantom_widget_;
107 115
108 // Used to transition the bounds. 116 // Used to transition the bounds.
109 scoped_ptr<ui::SlideAnimation> animation_; 117 scoped_ptr<ui::SlideAnimation> animation_;
110 118
111 // The style of the phantom window. 119 // The style of the phantom window.
112 Style style_; 120 Style style_;
113 121
122 // The layer which should be shown on top of the |phantom_widget_|. NULL when
123 // no layer needs to be shown. This object does not own the layer.
124 ui::Layer* layer_;
125
114 DISALLOW_COPY_AND_ASSIGN(PhantomWindowController); 126 DISALLOW_COPY_AND_ASSIGN(PhantomWindowController);
115 }; 127 };
116 128
117 } // namespace internal 129 } // namespace internal
118 } // namespace ash 130 } // namespace ash
119 131
120 #endif // ASH_WM_WORKSPACE_PHANTOM_WINDOW_CONTROLLER_H_ 132 #endif // ASH_WM_WORKSPACE_PHANTOM_WINDOW_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698