Chromium Code Reviews| 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 "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 26 } | 26 } |
| 27 | 27 |
| 28 namespace ash { | 28 namespace ash { |
| 29 | 29 |
| 30 // This class represents an item in overview mode. | 30 // This class represents an item in overview mode. |
| 31 class ASH_EXPORT WindowSelectorItem : public views::ButtonListener, | 31 class ASH_EXPORT WindowSelectorItem : public views::ButtonListener, |
| 32 public aura::WindowObserver { | 32 public aura::WindowObserver { |
| 33 public: | 33 public: |
| 34 class OverviewLabelButton : public views::LabelButton { | 34 class OverviewLabelButton : public views::LabelButton { |
| 35 public: | 35 public: |
| 36 OverviewLabelButton(views::ButtonListener* listener, | 36 OverviewLabelButton(WindowSelectorItem* selector_item, |
| 37 const base::string16& text); | 37 const base::string16& text); |
| 38 | 38 |
| 39 ~OverviewLabelButton() override; | 39 ~OverviewLabelButton() override; |
| 40 | 40 |
| 41 void set_top_padding(int top_padding) { top_padding_ = top_padding; } | 41 void set_top_padding(int top_padding) { top_padding_ = top_padding; } |
| 42 | 42 |
| 43 // views::LabelButton: | |
| 44 void OnGestureEvent(ui::GestureEvent* event) override; | |
|
flackr
2015/02/12 18:52:43
nit: indentation.
bruthig
2015/02/12 20:34:16
Done.
| |
| 45 | |
| 43 protected: | 46 protected: |
| 44 // views::LabelButton: | 47 // views::LabelButton: |
| 45 gfx::Rect GetChildAreaBounds() override; | 48 gfx::Rect GetChildAreaBounds() override; |
| 46 | 49 |
| 47 private: | 50 private: |
| 51 // The WindowSelectorItem that the touch gestures are delegated to. | |
| 52 // Not owned. | |
| 53 WindowSelectorItem* selector_item_; | |
| 54 | |
| 55 // The original X location for a scroll begin event. |original_x_| is in the | |
| 56 // local coordinate space of |this|. | |
| 57 float scroll_x_origin_; | |
| 58 | |
| 48 // Padding on top of the button. | 59 // Padding on top of the button. |
| 49 int top_padding_; | 60 int top_padding_; |
| 50 | 61 |
| 51 DISALLOW_COPY_AND_ASSIGN(OverviewLabelButton); | 62 DISALLOW_COPY_AND_ASSIGN(OverviewLabelButton); |
| 52 }; | 63 }; |
| 53 | 64 |
| 54 explicit WindowSelectorItem(aura::Window* window); | 65 explicit WindowSelectorItem(aura::Window* window); |
| 55 ~WindowSelectorItem() override; | 66 ~WindowSelectorItem() override; |
| 56 | 67 |
| 57 aura::Window* GetWindow(); | 68 aura::Window* GetWindow(); |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 87 // label is read. | 98 // label is read. |
| 88 void SendFocusAlert() const; | 99 void SendFocusAlert() const; |
| 89 | 100 |
| 90 // Sets if the item is dimmed in the overview. Changing the value will also | 101 // Sets if the item is dimmed in the overview. Changing the value will also |
| 91 // change the visibility of the transform windows. | 102 // change the visibility of the transform windows. |
| 92 void SetDimmed(bool dimmed); | 103 void SetDimmed(bool dimmed); |
| 93 bool dimmed() const { return dimmed_; } | 104 bool dimmed() const { return dimmed_; } |
| 94 | 105 |
| 95 const gfx::Rect& target_bounds() const { return target_bounds_; } | 106 const gfx::Rect& target_bounds() const { return target_bounds_; } |
| 96 | 107 |
| 108 // Called when a touch scroll begin event occurs on this selector item. | |
| 109 void OnScrollBegin(); | |
| 110 | |
| 111 // Called when a touch scroll update event occurs on this selector item. | |
| 112 void OnScrollUpdate(int delta_x); | |
| 113 | |
| 114 // Called when a touch scroll end event occurs on this selector item. This may | |
| 115 // cause the window to be closed. | |
| 116 void OnScrollEnd(int delta_x); | |
| 117 | |
| 118 // Called when a touch fling event occurs on this selector item. This may | |
| 119 // cause the window to be closed. | |
| 120 void OnFling(int delta_x, float velocity_x); | |
|
flackr
2015/02/12 18:52:43
nit: I kind of feel like we should just have an On
bruthig
2015/02/12 20:34:16
Done.
| |
| 121 | |
| 97 // views::ButtonListener: | 122 // views::ButtonListener: |
| 98 void ButtonPressed(views::Button* sender, const ui::Event& event) override; | 123 void ButtonPressed(views::Button* sender, const ui::Event& event) override; |
| 99 | 124 |
| 100 // aura::WindowObserver: | 125 // aura::WindowObserver: |
| 101 void OnWindowDestroying(aura::Window* window) override; | 126 void OnWindowDestroying(aura::Window* window) override; |
| 102 void OnWindowTitleChanged(aura::Window* window) override; | 127 void OnWindowTitleChanged(aura::Window* window) override; |
| 103 | 128 |
| 104 private: | 129 private: |
| 105 friend class WindowSelectorTest; | 130 friend class WindowSelectorTest; |
| 106 | 131 |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 120 // Creates the window label. | 145 // Creates the window label. |
| 121 void CreateWindowLabel(const base::string16& title); | 146 void CreateWindowLabel(const base::string16& title); |
| 122 | 147 |
| 123 // Updates the close button's bounds. Any change in bounds will be animated | 148 // Updates the close button's bounds. Any change in bounds will be animated |
| 124 // from the current bounds to the new bounds as per the |animation_type|. | 149 // from the current bounds to the new bounds as per the |animation_type|. |
| 125 void UpdateCloseButtonLayout(OverviewAnimationType animation_type); | 150 void UpdateCloseButtonLayout(OverviewAnimationType animation_type); |
| 126 | 151 |
| 127 // Updates the close buttons accessibility name. | 152 // Updates the close buttons accessibility name. |
| 128 void UpdateCloseButtonAccessibilityName(); | 153 void UpdateCloseButtonAccessibilityName(); |
| 129 | 154 |
| 155 // Animates the |transform_window_| back to it's original overview mode | |
| 156 // position. | |
| 157 void ResetScrolledWindow(); | |
| 158 | |
| 159 // Returns the minimum distance at which a scroll gesture will cause this | |
| 160 // selector item to be closed. | |
| 161 int GetMinimumCloseDistance() const; | |
| 162 | |
| 130 // True if the item is being shown in the overview, false if it's being | 163 // True if the item is being shown in the overview, false if it's being |
| 131 // filtered. | 164 // filtered. |
| 132 bool dimmed_; | 165 bool dimmed_; |
| 133 | 166 |
| 134 // The root window this item is being displayed on. | 167 // The root window this item is being displayed on. |
| 135 aura::Window* root_window_; | 168 aura::Window* root_window_; |
| 136 | 169 |
| 137 // The contained Window's wrapper. | 170 // The contained Window's wrapper. |
| 138 ScopedTransformOverviewWindow transform_window_; | 171 ScopedTransformOverviewWindow transform_window_; |
| 139 | 172 |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 157 // An easy to access close button for the window in this item. Owned by the | 190 // An easy to access close button for the window in this item. Owned by the |
| 158 // close_button_widget_. | 191 // close_button_widget_. |
| 159 views::ImageButton* close_button_; | 192 views::ImageButton* close_button_; |
| 160 | 193 |
| 161 DISALLOW_COPY_AND_ASSIGN(WindowSelectorItem); | 194 DISALLOW_COPY_AND_ASSIGN(WindowSelectorItem); |
| 162 }; | 195 }; |
| 163 | 196 |
| 164 } // namespace ash | 197 } // namespace ash |
| 165 | 198 |
| 166 #endif // ASH_WM_OVERVIEW_WINDOW_SELECTOR_ITEM_H_ | 199 #endif // ASH_WM_OVERVIEW_WINDOW_SELECTOR_ITEM_H_ |
| OLD | NEW |