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 #ifndef ASH_WM_OVERVIEW_WINDOW_SELECTOR_ITEM_H_ | 5 #ifndef ASH_WM_OVERVIEW_WINDOW_SELECTOR_ITEM_H_ |
6 #define ASH_WM_OVERVIEW_WINDOW_SELECTOR_ITEM_H_ | 6 #define ASH_WM_OVERVIEW_WINDOW_SELECTOR_ITEM_H_ |
7 | 7 |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "ui/aura/window_observer.h" |
10 #include "ui/gfx/rect.h" | 11 #include "ui/gfx/rect.h" |
11 #include "ui/views/controls/button/button.h" | 12 #include "ui/views/controls/button/button.h" |
12 | 13 |
13 namespace aura { | 14 namespace aura { |
14 class Window; | 15 class Window; |
15 } | 16 } |
16 | 17 |
17 namespace views { | 18 namespace views { |
18 class Widget; | 19 class Widget; |
19 } | 20 } |
20 | 21 |
21 namespace ash { | 22 namespace ash { |
22 class TransparentActivateWindowButton; | 23 class TransparentActivateWindowButton; |
23 | 24 |
24 // This class represents an item in overview mode. An item can have one or more | 25 // This class represents an item in overview mode. An item can have one or more |
25 // windows, of which only one can be activated by keyboard (i.e. alt+tab) but | 26 // windows, of which only one can be activated by keyboard (i.e. alt+tab) but |
26 // any can be selected with a pointer (touch or mouse). | 27 // any can be selected with a pointer (touch or mouse). |
27 class WindowSelectorItem : public views::ButtonListener { | 28 class WindowSelectorItem : public views::ButtonListener, |
| 29 public aura::WindowObserver { |
28 public: | 30 public: |
29 WindowSelectorItem(); | 31 WindowSelectorItem(); |
30 virtual ~WindowSelectorItem(); | 32 virtual ~WindowSelectorItem(); |
31 | 33 |
32 // The time for the close buttons and labels to fade in when initially shown | 34 // The time for the close buttons and labels to fade in when initially shown |
33 // on entering overview mode. | 35 // on entering overview mode. |
34 static const int kFadeInMilliseconds; | 36 static const int kFadeInMilliseconds; |
35 | 37 |
36 // Returns the root window on which this item is shown. | 38 // Returns the root window on which this item is shown. |
37 virtual aura::Window* GetRootWindow() = 0; | 39 virtual aura::Window* GetRootWindow() = 0; |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 // label is read. | 78 // label is read. |
77 void SendFocusAlert() const; | 79 void SendFocusAlert() const; |
78 | 80 |
79 const gfx::Rect& bounds() const { return bounds_; } | 81 const gfx::Rect& bounds() const { return bounds_; } |
80 const gfx::Rect& target_bounds() const { return target_bounds_; } | 82 const gfx::Rect& target_bounds() const { return target_bounds_; } |
81 | 83 |
82 // views::ButtonListener: | 84 // views::ButtonListener: |
83 virtual void ButtonPressed(views::Button* sender, | 85 virtual void ButtonPressed(views::Button* sender, |
84 const ui::Event& event) OVERRIDE; | 86 const ui::Event& event) OVERRIDE; |
85 | 87 |
| 88 // aura::WindowObserver: |
| 89 virtual void OnWindowTitleChanged(aura::Window* window, |
| 90 const base::string16& title) OVERRIDE; |
| 91 |
86 protected: | 92 protected: |
87 // Sets the bounds of this selector's items to |target_bounds| in | 93 // Sets the bounds of this selector's items to |target_bounds| in |
88 // |root_window|. If |animate| the windows are animated from their current | 94 // |root_window|. If |animate| the windows are animated from their current |
89 // location. | 95 // location. |
90 virtual void SetItemBounds(aura::Window* root_window, | 96 virtual void SetItemBounds(aura::Window* root_window, |
91 const gfx::Rect& target_bounds, | 97 const gfx::Rect& target_bounds, |
92 bool animate) = 0; | 98 bool animate) = 0; |
93 | 99 |
94 // Sets the bounds used by the selector item's windows. | 100 // Sets the bounds used by the selector item's windows. |
95 void set_bounds(const gfx::Rect& bounds) { bounds_ = bounds; } | 101 void set_bounds(const gfx::Rect& bounds) { bounds_ = bounds; } |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 // Transparent window on top of the real windows in the overview that | 136 // Transparent window on top of the real windows in the overview that |
131 // activates them on click or tap. | 137 // activates them on click or tap. |
132 scoped_ptr<TransparentActivateWindowButton> activate_window_button_; | 138 scoped_ptr<TransparentActivateWindowButton> activate_window_button_; |
133 | 139 |
134 DISALLOW_COPY_AND_ASSIGN(WindowSelectorItem); | 140 DISALLOW_COPY_AND_ASSIGN(WindowSelectorItem); |
135 }; | 141 }; |
136 | 142 |
137 } // namespace ash | 143 } // namespace ash |
138 | 144 |
139 #endif // ASH_WM_OVERVIEW_WINDOW_SELECTOR_ITEM_H_ | 145 #endif // ASH_WM_OVERVIEW_WINDOW_SELECTOR_ITEM_H_ |
OLD | NEW |