| 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 "ash/ash_export.h" | 8 #include "ash/ash_export.h" |
| 9 #include "ash/wm/overview/scoped_transform_overview_window.h" | 9 #include "ash/wm/overview/scoped_transform_overview_window.h" |
| 10 #include "ash/wm/overview/transparent_activate_window_button.h" | |
| 11 #include "ash/wm/overview/transparent_activate_window_button_delegate.h" | |
| 12 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| 13 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 14 #include "ui/aura/window_observer.h" | 12 #include "ui/aura/window_observer.h" |
| 15 #include "ui/gfx/geometry/rect.h" | 13 #include "ui/gfx/geometry/rect.h" |
| 16 #include "ui/views/controls/button/button.h" | 14 #include "ui/views/controls/button/button.h" |
| 17 #include "ui/views/controls/button/image_button.h" | 15 #include "ui/views/controls/button/image_button.h" |
| 18 | 16 |
| 19 namespace aura { | 17 namespace aura { |
| 20 class Window; | 18 class Window; |
| 21 } | 19 } |
| 22 | 20 |
| 23 namespace views { | 21 namespace views { |
| 24 class Label; | 22 class LabelButton; |
| 25 class Widget; | 23 class Widget; |
| 26 } | 24 } |
| 27 | 25 |
| 28 namespace ash { | 26 namespace ash { |
| 29 | 27 |
| 30 // This class represents an item in overview mode. An item can have one or more | 28 // This class represents an item in overview mode. An item can have one or more |
| 31 // windows, of which only one can be activated by keyboard (i.e. alt+tab) but | 29 // windows, of which only one can be activated by keyboard (i.e. alt+tab) but |
| 32 // any can be selected with a pointer (touch or mouse). | 30 // any can be selected with a pointer (touch or mouse). |
| 33 class ASH_EXPORT WindowSelectorItem | 31 class ASH_EXPORT WindowSelectorItem |
| 34 : public views::ButtonListener, | 32 : public views::ButtonListener, |
| 35 public aura::WindowObserver, | 33 public aura::WindowObserver { |
| 36 public TransparentActivateWindowButtonDelegate { | |
| 37 public: | 34 public: |
| 38 explicit WindowSelectorItem(aura::Window* root_window); | 35 explicit WindowSelectorItem(aura::Window* root_window); |
| 39 ~WindowSelectorItem() override; | 36 ~WindowSelectorItem() override; |
| 40 | 37 |
| 41 // Returns the root window on which this item is shown. | 38 // Returns the root window on which this item is shown. |
| 42 aura::Window* root_window() { return root_window_; } | 39 aura::Window* root_window() { return root_window_; } |
| 43 | 40 |
| 44 // Adds a window to this selector item. Windows should be added in reverse | 41 // Adds a window to this selector item. Windows should be added in reverse |
| 45 // visible order so that the transparent overlay ordering matches the visible | 42 // visible order so that the transparent overlay ordering matches the visible |
| 46 // ordering. Each |window| should have the same root window as |this| was | 43 // ordering. Each |window| should have the same root window as |this| was |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 bool dimmed() const { return dimmed_; } | 91 bool dimmed() const { return dimmed_; } |
| 95 | 92 |
| 96 const gfx::Rect& target_bounds() const { return target_bounds_; } | 93 const gfx::Rect& target_bounds() const { return target_bounds_; } |
| 97 | 94 |
| 98 // views::ButtonListener: | 95 // views::ButtonListener: |
| 99 void ButtonPressed(views::Button* sender, const ui::Event& event) override; | 96 void ButtonPressed(views::Button* sender, const ui::Event& event) override; |
| 100 | 97 |
| 101 // aura::WindowObserver: | 98 // aura::WindowObserver: |
| 102 void OnWindowTitleChanged(aura::Window* window) override; | 99 void OnWindowTitleChanged(aura::Window* window) override; |
| 103 | 100 |
| 104 // ash::TransparentActivateWindowButtonDelegate: | |
| 105 void Select() override; | |
| 106 | |
| 107 private: | 101 private: |
| 108 friend class WindowSelectorTest; | 102 friend class WindowSelectorTest; |
| 109 | 103 |
| 110 typedef ScopedVector<ScopedTransformOverviewWindow> TransformWindows; | 104 typedef ScopedVector<ScopedTransformOverviewWindow> TransformWindows; |
| 111 | 105 |
| 112 // Sets the bounds of this selector's items to |target_bounds| in | 106 // Sets the bounds of this selector's items to |target_bounds| in |
| 113 // |root_window|. The bounds change will be animated as specified | 107 // |root_window|. The bounds change will be animated as specified |
| 114 // by |animation_type|. | 108 // by |animation_type|. |
| 115 void SetItemBounds(aura::Window* root_window, | 109 void SetItemBounds(aura::Window* root_window, |
| 116 const gfx::Rect& target_bounds, | 110 const gfx::Rect& target_bounds, |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 | 148 |
| 155 // True if running SetItemBounds. This prevents recursive calls resulting from | 149 // True if running SetItemBounds. This prevents recursive calls resulting from |
| 156 // the bounds update when calling ::wm::RecreateWindowLayers to copy | 150 // the bounds update when calling ::wm::RecreateWindowLayers to copy |
| 157 // a window layer for display on another monitor. | 151 // a window layer for display on another monitor. |
| 158 bool in_bounds_update_; | 152 bool in_bounds_update_; |
| 159 | 153 |
| 160 // Label under the window displaying its active tab name. | 154 // Label under the window displaying its active tab name. |
| 161 scoped_ptr<views::Widget> window_label_; | 155 scoped_ptr<views::Widget> window_label_; |
| 162 | 156 |
| 163 // View for the label under the window. | 157 // View for the label under the window. |
| 164 views::Label* window_label_view_; | 158 views::LabelButton* window_label_button_view_; |
| 165 | 159 |
| 166 // The close buttons widget container. | 160 // The close buttons widget container. |
| 167 views::Widget close_button_widget_; | 161 views::Widget close_button_widget_; |
| 168 | 162 |
| 169 // An easy to access close button for the window in this item. Owned by the | 163 // An easy to access close button for the window in this item. Owned by the |
| 170 // close_button_widget_. | 164 // close_button_widget_. |
| 171 views::ImageButton* close_button_; | 165 views::ImageButton* close_button_; |
| 172 | 166 |
| 173 // Transparent overlay that covers the entire bounds of the | |
| 174 // WindowSelectorItem and is stacked in front of all windows but behind each | |
| 175 // Windows' own TransparentActivateWindowButton. | |
| 176 scoped_ptr<TransparentActivateWindowButton> | |
| 177 selector_item_activate_window_button_; | |
| 178 | |
| 179 // List of all Windows added to this and their associated helper classes. | 167 // List of all Windows added to this and their associated helper classes. |
| 180 TransformWindows transform_windows_; | 168 TransformWindows transform_windows_; |
| 181 | 169 |
| 182 DISALLOW_COPY_AND_ASSIGN(WindowSelectorItem); | 170 DISALLOW_COPY_AND_ASSIGN(WindowSelectorItem); |
| 183 }; | 171 }; |
| 184 | 172 |
| 185 } // namespace ash | 173 } // namespace ash |
| 186 | 174 |
| 187 #endif // ASH_WM_OVERVIEW_WINDOW_SELECTOR_ITEM_H_ | 175 #endif // ASH_WM_OVERVIEW_WINDOW_SELECTOR_ITEM_H_ |
| OLD | NEW |