| OLD | NEW |
| 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_FRAME_MAXIMIZE_BUTTON_H_ | 5 #ifndef ASH_WM_WORKSPACE_FRAME_MAXIMIZE_BUTTON_H_ |
| 6 #define ASH_WM_WORKSPACE_FRAME_MAXIMIZE_BUTTON_H_ | 6 #define ASH_WM_WORKSPACE_FRAME_MAXIMIZE_BUTTON_H_ |
| 7 | 7 |
| 8 #include "ash/ash_export.h" | 8 #include "ash/ash_export.h" |
| 9 #include "ash/wm/workspace/maximize_bubble_frame_state.h" | 9 #include "ash/wm/workspace/maximize_bubble_frame_state.h" |
| 10 #include "ash/wm/workspace/snap_types.h" | 10 #include "ash/wm/workspace/snap_types.h" |
| 11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "base/timer/timer.h" | 12 #include "base/timer/timer.h" |
| 13 #include "ui/aura/window_observer.h" | 13 #include "ui/aura/window_observer.h" |
| 14 #include "ui/views/controls/button/image_button.h" | 14 #include "ui/views/controls/button/image_button.h" |
| 15 #include "ui/views/widget/widget_observer.h" | 15 #include "ui/views/widget/widget_observer.h" |
| 16 | 16 |
| 17 namespace views { | 17 namespace views { |
| 18 class NonClientFrameView; | 18 class NonClientFrameView; |
| 19 } | 19 } |
| 20 | 20 |
| 21 namespace ash { | 21 namespace ash { |
| 22 | 22 |
| 23 namespace internal { | 23 namespace internal { |
| 24 class PhantomWindowController; | 24 class PhantomWindowController; |
| 25 class SnapSizer; | |
| 26 } | 25 } |
| 27 | 26 |
| 28 class MaximizeBubbleController; | 27 class MaximizeBubbleController; |
| 29 | 28 |
| 30 // Button used for the maximize control on the frame. Handles snapping logic. | 29 // Button used for the maximize control on the frame. Handles snapping logic. |
| 31 class ASH_EXPORT FrameMaximizeButton : public views::ImageButton, | 30 class ASH_EXPORT FrameMaximizeButton : public views::ImageButton, |
| 32 public views::WidgetObserver, | 31 public views::WidgetObserver, |
| 33 public aura::WindowObserver { | 32 public aura::WindowObserver { |
| 34 public: | 33 public: |
| 35 FrameMaximizeButton(views::ButtonListener* listener, | 34 FrameMaximizeButton(views::ButtonListener* listener, |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 // the single button click default setting of the snap sizer should be used. | 117 // the single button click default setting of the snap sizer should be used. |
| 119 // Set |is_touch| to true to make touch snapping at the corners possible. | 118 // Set |is_touch| to true to make touch snapping at the corners possible. |
| 120 void UpdateSnap(const gfx::Point& location, | 119 void UpdateSnap(const gfx::Point& location, |
| 121 bool select_default, | 120 bool select_default, |
| 122 bool is_touch); | 121 bool is_touch); |
| 123 | 122 |
| 124 // Returns the type of snap based on the specified location. | 123 // Returns the type of snap based on the specified location. |
| 125 SnapType SnapTypeForLocation(const gfx::Point& location) const; | 124 SnapType SnapTypeForLocation(const gfx::Point& location) const; |
| 126 | 125 |
| 127 // Returns the bounds of the resulting window for the specified type. | 126 // Returns the bounds of the resulting window for the specified type. |
| 128 gfx::Rect ScreenBoundsForType(SnapType type, | 127 gfx::Rect ScreenBoundsForType(SnapType type) const; |
| 129 const internal::SnapSizer& snap_sizer) const; | |
| 130 | |
| 131 // Converts location to screen coordinates and returns it. These are the | |
| 132 // coordinates used by the SnapSizer. | |
| 133 gfx::Point LocationForSnapSizer(const gfx::Point& location) const; | |
| 134 | 128 |
| 135 // Snaps the window to the current snap position. | 129 // Snaps the window to the current snap position. |
| 136 void Snap(const internal::SnapSizer& snap_sizer); | 130 void Snap(); |
| 137 | 131 |
| 138 // Determine the maximize type of this window. | 132 // Determine the maximize type of this window. |
| 139 MaximizeBubbleFrameState GetMaximizeBubbleFrameState() const; | 133 MaximizeBubbleFrameState GetMaximizeBubbleFrameState() const; |
| 140 | 134 |
| 141 // Frame that the maximize button acts on. | 135 // Frame that the maximize button acts on. |
| 142 views::NonClientFrameView* frame_; | 136 views::NonClientFrameView* frame_; |
| 143 | 137 |
| 144 // Renders the snap position. | 138 // Renders the snap position. |
| 145 scoped_ptr<internal::PhantomWindowController> phantom_window_; | 139 scoped_ptr<internal::PhantomWindowController> phantom_window_; |
| 146 | 140 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 157 | 151 |
| 158 // Location of the press. | 152 // Location of the press. |
| 159 gfx::Point press_location_; | 153 gfx::Point press_location_; |
| 160 | 154 |
| 161 // True if the press was triggered by a gesture/touch. | 155 // True if the press was triggered by a gesture/touch. |
| 162 bool press_is_gesture_; | 156 bool press_is_gesture_; |
| 163 | 157 |
| 164 // Current snap type. | 158 // Current snap type. |
| 165 SnapType snap_type_; | 159 SnapType snap_type_; |
| 166 | 160 |
| 167 scoped_ptr<internal::SnapSizer> snap_sizer_; | |
| 168 | |
| 169 scoped_ptr<EscapeEventFilter> escape_event_filter_; | 161 scoped_ptr<EscapeEventFilter> escape_event_filter_; |
| 170 | 162 |
| 171 base::OneShotTimer<FrameMaximizeButton> update_timer_; | 163 base::OneShotTimer<FrameMaximizeButton> update_timer_; |
| 172 | 164 |
| 173 scoped_ptr<MaximizeBubbleController> maximizer_; | 165 scoped_ptr<MaximizeBubbleController> maximizer_; |
| 174 | 166 |
| 175 // The delay of the bubble appearance. | 167 // The delay of the bubble appearance. |
| 176 int bubble_appearance_delay_ms_; | 168 int bubble_appearance_delay_ms_; |
| 177 | 169 |
| 178 DISALLOW_COPY_AND_ASSIGN(FrameMaximizeButton); | 170 DISALLOW_COPY_AND_ASSIGN(FrameMaximizeButton); |
| 179 }; | 171 }; |
| 180 | 172 |
| 181 } // namespace ash | 173 } // namespace ash |
| 182 | 174 |
| 183 #endif // ASH_WM_WORKSPACE_FRAME_MAXIMIZE_BUTTON_H_ | 175 #endif // ASH_WM_WORKSPACE_FRAME_MAXIMIZE_BUTTON_H_ |
| OLD | NEW |