Chromium Code Reviews| 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_types.h" | |
| 9 #include "ash/wm/workspace/snap_types.h" | 10 #include "ash/wm/workspace/snap_types.h" |
| 10 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 11 #include "base/timer.h" | 12 #include "base/timer.h" |
| 12 #include "ui/aura/window_observer.h" | 13 #include "ui/aura/window_observer.h" |
| 13 #include "ui/views/controls/button/image_button.h" | 14 #include "ui/views/controls/button/image_button.h" |
| 14 | 15 |
| 15 namespace views { | 16 namespace views { |
| 16 class NonClientFrameView; | 17 class NonClientFrameView; |
| 17 } | 18 } |
| 18 | 19 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 56 // ImageButton overrides: | 57 // ImageButton overrides: |
| 57 virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE; | 58 virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE; |
| 58 virtual void OnMouseEntered(const ui::MouseEvent& event) OVERRIDE; | 59 virtual void OnMouseEntered(const ui::MouseEvent& event) OVERRIDE; |
| 59 virtual void OnMouseExited(const ui::MouseEvent& event) OVERRIDE; | 60 virtual void OnMouseExited(const ui::MouseEvent& event) OVERRIDE; |
| 60 virtual bool OnMouseDragged(const ui::MouseEvent& event) OVERRIDE; | 61 virtual bool OnMouseDragged(const ui::MouseEvent& event) OVERRIDE; |
| 61 virtual void OnMouseReleased(const ui::MouseEvent& event) OVERRIDE; | 62 virtual void OnMouseReleased(const ui::MouseEvent& event) OVERRIDE; |
| 62 virtual void OnMouseCaptureLost() OVERRIDE; | 63 virtual void OnMouseCaptureLost() OVERRIDE; |
| 63 virtual ui::GestureStatus OnGestureEvent( | 64 virtual ui::GestureStatus OnGestureEvent( |
| 64 const ui::GestureEvent& event) OVERRIDE; | 65 const ui::GestureEvent& event) OVERRIDE; |
| 65 | 66 |
| 67 // Toggles between maximize and restore. Note: After this call this object | |
| 68 // can be destroyed. | |
| 69 void ToggleMaximize(); | |
|
sky
2012/08/27 22:18:16
ToggleMaximized
Mr4D (OOO till 08-26)
2012/08/28 01:30:25
Done.
| |
| 70 | |
| 66 // Unit test overwrite: Change the UI delay used for the bubble show up. | 71 // Unit test overwrite: Change the UI delay used for the bubble show up. |
| 67 void set_bubble_appearance_delay_ms(int bubble_appearance_delay_ms) { | 72 void set_bubble_appearance_delay_ms(int bubble_appearance_delay_ms) { |
| 68 bubble_appearance_delay_ms_ = bubble_appearance_delay_ms; | 73 bubble_appearance_delay_ms_ = bubble_appearance_delay_ms; |
| 69 } | 74 } |
| 70 | 75 |
| 71 // Unit test accessor for the maximize bubble. | 76 // Unit test accessor for the maximize bubble. |
| 72 MaximizeBubbleController* maximizer() { return maximizer_.get(); } | 77 MaximizeBubbleController* maximizer() { return maximizer_.get(); } |
| 73 | 78 |
| 74 // Unit test to see if phantom window is open. | 79 // Unit test to see if phantom window is open. |
| 75 bool phantom_window_open() { return phantom_window_.get() != NULL; } | 80 bool phantom_window_open() { return phantom_window_.get() != NULL; } |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 110 gfx::Rect ScreenBoundsForType(SnapType type, | 115 gfx::Rect ScreenBoundsForType(SnapType type, |
| 111 const internal::SnapSizer& snap_sizer) const; | 116 const internal::SnapSizer& snap_sizer) const; |
| 112 | 117 |
| 113 // Converts location to screen coordinates and returns it. These are the | 118 // Converts location to screen coordinates and returns it. These are the |
| 114 // coordinates used by the SnapSizer. | 119 // coordinates used by the SnapSizer. |
| 115 gfx::Point LocationForSnapSizer(const gfx::Point& location) const; | 120 gfx::Point LocationForSnapSizer(const gfx::Point& location) const; |
| 116 | 121 |
| 117 // Snaps the window to the current snap position. | 122 // Snaps the window to the current snap position. |
| 118 void Snap(const internal::SnapSizer& snap_sizer); | 123 void Snap(const internal::SnapSizer& snap_sizer); |
| 119 | 124 |
| 125 // Determine the maximize type of this window. | |
| 126 MaximizeType GetMaximizeType() const; | |
| 127 | |
| 128 // Maximizes the Window. | |
| 129 void Maximize(); | |
| 130 | |
| 120 // Frame that the maximize button acts on. | 131 // Frame that the maximize button acts on. |
| 121 views::NonClientFrameView* frame_; | 132 views::NonClientFrameView* frame_; |
| 122 | 133 |
| 123 // Renders the snap position. | 134 // Renders the snap position. |
| 124 scoped_ptr<internal::PhantomWindowController> phantom_window_; | 135 scoped_ptr<internal::PhantomWindowController> phantom_window_; |
| 125 | 136 |
| 126 // Is snapping enabled? Set on press so that in drag we know whether we | 137 // Is snapping enabled? Set on press so that in drag we know whether we |
| 127 // should show the snap locations. | 138 // should show the snap locations. |
| 128 bool is_snap_enabled_; | 139 bool is_snap_enabled_; |
| 129 | 140 |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 149 | 160 |
| 150 // The delay of the bubble appearance. | 161 // The delay of the bubble appearance. |
| 151 int bubble_appearance_delay_ms_; | 162 int bubble_appearance_delay_ms_; |
| 152 | 163 |
| 153 DISALLOW_COPY_AND_ASSIGN(FrameMaximizeButton); | 164 DISALLOW_COPY_AND_ASSIGN(FrameMaximizeButton); |
| 154 }; | 165 }; |
| 155 | 166 |
| 156 } // namespace ash | 167 } // namespace ash |
| 157 | 168 |
| 158 #endif // ASH_WM_WORKSPACE_FRAME_MAXIMIZE_BUTTON_H_ | 169 #endif // ASH_WM_WORKSPACE_FRAME_MAXIMIZE_BUTTON_H_ |
| OLD | NEW |