| 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 "base/strings/string16.h" | 10 #include "base/strings/string16.h" |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 // calling RemoveWindow for the last contained window). | 58 // calling RemoveWindow for the last contained window). |
| 59 virtual bool empty() const = 0; | 59 virtual bool empty() const = 0; |
| 60 | 60 |
| 61 // Dispatched before beginning window overview. This will do any necessary | 61 // Dispatched before beginning window overview. This will do any necessary |
| 62 // one time actions such as restoring minimized windows. | 62 // one time actions such as restoring minimized windows. |
| 63 virtual void PrepareForOverview() = 0; | 63 virtual void PrepareForOverview() = 0; |
| 64 | 64 |
| 65 // Sets the bounds of this window selector item to |target_bounds| in the | 65 // Sets the bounds of this window selector item to |target_bounds| in the |
| 66 // |root_window| root window. | 66 // |root_window| root window. |
| 67 void SetBounds(aura::Window* root_window, | 67 void SetBounds(aura::Window* root_window, |
| 68 const gfx::Rect& target_bounds); | 68 const gfx::Rect& target_bounds, |
| 69 bool animate); |
| 69 | 70 |
| 70 // Recomputes the positions for the windows in this selection item. This is | 71 // Recomputes the positions for the windows in this selection item. This is |
| 71 // dispatched when the bounds of a window change. | 72 // dispatched when the bounds of a window change. |
| 72 void RecomputeWindowTransforms(); | 73 void RecomputeWindowTransforms(); |
| 73 | 74 |
| 74 const gfx::Rect& bounds() { return bounds_; } | 75 const gfx::Rect& bounds() { return bounds_; } |
| 75 const gfx::Rect& target_bounds() { return target_bounds_; } | 76 const gfx::Rect& target_bounds() { return target_bounds_; } |
| 76 | 77 |
| 77 protected: | 78 protected: |
| 78 // Sets the bounds of this selector item to |target_bounds| in |root_window|. | 79 // Sets the bounds of this selector item to |target_bounds| in |root_window|. |
| 79 // If |animate| the windows are animated from their current location. | 80 // If |animate| the windows are animated from their current location. |
| 80 virtual void SetItemBounds(aura::Window* root_window, | 81 virtual void SetItemBounds(aura::Window* root_window, |
| 81 const gfx::Rect& target_bounds, | 82 const gfx::Rect& target_bounds, |
| 82 bool animate) = 0; | 83 bool animate) = 0; |
| 83 | 84 |
| 84 // Sets the bounds used by the selector item's windows. | 85 // Sets the bounds used by the selector item's windows. |
| 85 void set_bounds(const gfx::Rect& bounds) { bounds_ = bounds; } | 86 void set_bounds(const gfx::Rect& bounds) { bounds_ = bounds; } |
| 86 | 87 |
| 87 // Creates a label to display under the window selector item. | |
| 88 void UpdateWindowLabels(const gfx::Rect& target_bounds, | |
| 89 aura::Window* root_window); | |
| 90 | |
| 91 private: | 88 private: |
| 92 friend class WindowSelectorTest; | 89 friend class WindowSelectorTest; |
| 93 | 90 |
| 91 // Creates a label to display under the window selector item. |
| 92 void UpdateWindowLabels(const gfx::Rect& target_bounds, |
| 93 aura::Window* root_window, |
| 94 bool animate); |
| 95 |
| 94 // The root window this item is being displayed on. | 96 // The root window this item is being displayed on. |
| 95 aura::Window* root_window_; | 97 aura::Window* root_window_; |
| 96 | 98 |
| 97 // The target bounds this selector item is fit within. | 99 // The target bounds this selector item is fit within. |
| 98 gfx::Rect target_bounds_; | 100 gfx::Rect target_bounds_; |
| 99 | 101 |
| 100 // The actual bounds of the window(s) for this item. The aspect ratio of | 102 // The actual bounds of the window(s) for this item. The aspect ratio of |
| 101 // window(s) are maintained so they may not fill the target_bounds_. | 103 // window(s) are maintained so they may not fill the target_bounds_. |
| 102 gfx::Rect bounds_; | 104 gfx::Rect bounds_; |
| 103 | 105 |
| 104 // True if running SetItemBounds. This prevents recursive calls resulting from | 106 // True if running SetItemBounds. This prevents recursive calls resulting from |
| 105 // the bounds update when calling ::wm::RecreateWindowLayers to copy | 107 // the bounds update when calling ::wm::RecreateWindowLayers to copy |
| 106 // a window layer for display on another monitor. | 108 // a window layer for display on another monitor. |
| 107 bool in_bounds_update_; | 109 bool in_bounds_update_; |
| 108 | 110 |
| 109 // Label under the window displaying its active tab name. | 111 // Label under the window displaying its active tab name. |
| 110 scoped_ptr<views::Widget> window_label_; | 112 scoped_ptr<views::Widget> window_label_; |
| 111 | 113 |
| 112 DISALLOW_COPY_AND_ASSIGN(WindowSelectorItem); | 114 DISALLOW_COPY_AND_ASSIGN(WindowSelectorItem); |
| 113 }; | 115 }; |
| 114 | 116 |
| 115 } // namespace ash | 117 } // namespace ash |
| 116 | 118 |
| 117 #endif // ASH_WM_OVERVIEW_WINDOW_SELECTOR_ITEM_H_ | 119 #endif // ASH_WM_OVERVIEW_WINDOW_SELECTOR_ITEM_H_ |
| OLD | NEW |