Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(74)

Side by Side Diff: ash/wm/workspace/frame_maximize_button.cc

Issue 10855150: Revert 151485 - Adding unit tests for maximize menu (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ash/wm/workspace/frame_maximize_button.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "ash/wm/workspace/frame_maximize_button.h" 5 #include "ash/wm/workspace/frame_maximize_button.h"
6 6
7 #include "ash/launcher/launcher.h" 7 #include "ash/launcher/launcher.h"
8 #include "ash/screen_ash.h" 8 #include "ash/screen_ash.h"
9 #include "ash/shell.h" 9 #include "ash/shell.h"
10 #include "ash/wm/property_util.h" 10 #include "ash/wm/property_util.h"
(...skipping 14 matching lines...) Expand all
25 25
26 using ash::internal::SnapSizer; 26 using ash::internal::SnapSizer;
27 27
28 namespace ash { 28 namespace ash {
29 29
30 namespace { 30 namespace {
31 31
32 // Delay before forcing an update of the snap location. 32 // Delay before forcing an update of the snap location.
33 const int kUpdateDelayMS = 400; 33 const int kUpdateDelayMS = 400;
34 34
35 // The delay of the bubble appearance.
36 const int kBubbleAppearanceDelayMS = 200;
37
38 } 35 }
39 36
40 // EscapeEventFilter is installed on the RootWindow to track when the escape key 37 // EscapeEventFilter is installed on the RootWindow to track when the escape key
41 // is pressed. We use an EventFilter for this as the FrameMaximizeButton 38 // is pressed. We use an EventFilter for this as the FrameMaximizeButton
42 // normally does not get focus. 39 // normally does not get focus.
43 class FrameMaximizeButton::EscapeEventFilter : public aura::EventFilter { 40 class FrameMaximizeButton::EscapeEventFilter : public aura::EventFilter {
44 public: 41 public:
45 explicit EscapeEventFilter(FrameMaximizeButton* button); 42 explicit EscapeEventFilter(FrameMaximizeButton* button);
46 virtual ~EscapeEventFilter(); 43 virtual ~EscapeEventFilter();
47 44
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 100
104 // FrameMaximizeButton --------------------------------------------------------- 101 // FrameMaximizeButton ---------------------------------------------------------
105 102
106 FrameMaximizeButton::FrameMaximizeButton(views::ButtonListener* listener, 103 FrameMaximizeButton::FrameMaximizeButton(views::ButtonListener* listener,
107 views::NonClientFrameView* frame) 104 views::NonClientFrameView* frame)
108 : ImageButton(listener), 105 : ImageButton(listener),
109 frame_(frame), 106 frame_(frame),
110 is_snap_enabled_(false), 107 is_snap_enabled_(false),
111 exceeded_drag_threshold_(false), 108 exceeded_drag_threshold_(false),
112 window_(NULL), 109 window_(NULL),
113 snap_type_(SNAP_NONE), 110 snap_type_(SNAP_NONE) {
114 bubble_appearance_delay_ms_(kBubbleAppearanceDelayMS) {
115 // TODO(sky): nuke this. It's temporary while we don't have good images. 111 // TODO(sky): nuke this. It's temporary while we don't have good images.
116 SetImageAlignment(ALIGN_LEFT, ALIGN_BOTTOM); 112 SetImageAlignment(ALIGN_LEFT, ALIGN_BOTTOM);
117 } 113 }
118 114
119 FrameMaximizeButton::~FrameMaximizeButton() { 115 FrameMaximizeButton::~FrameMaximizeButton() {
120 // Before the window gets destroyed, the maximizer dialog needs to be shut 116 // Before the window gets destroyed, the maximizer dialog needs to be shut
121 // down since it would otherwise call into a deleted object. 117 // down since it would otherwise call into a deleted object.
122 maximizer_.reset(); 118 maximizer_.reset();
123 if (window_) 119 if (window_)
124 OnWindowDestroying(window_); 120 OnWindowDestroying(window_);
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 void FrameMaximizeButton::OnMouseEntered(const ui::MouseEvent& event) { 195 void FrameMaximizeButton::OnMouseEntered(const ui::MouseEvent& event) {
200 ImageButton::OnMouseEntered(event); 196 ImageButton::OnMouseEntered(event);
201 if (!maximizer_.get()) { 197 if (!maximizer_.get()) {
202 DCHECK(GetWidget()); 198 DCHECK(GetWidget());
203 if (!window_) { 199 if (!window_) {
204 window_ = frame_->GetWidget()->GetNativeWindow(); 200 window_ = frame_->GetWidget()->GetNativeWindow();
205 window_->AddObserver(this); 201 window_->AddObserver(this);
206 } 202 }
207 maximizer_.reset(new MaximizeBubbleController( 203 maximizer_.reset(new MaximizeBubbleController(
208 this, 204 this,
209 frame_->GetWidget()->IsMaximized(), 205 frame_->GetWidget()->IsMaximized()));
210 bubble_appearance_delay_ms_));
211 } 206 }
212 } 207 }
213 208
214 void FrameMaximizeButton::OnMouseExited(const ui::MouseEvent& event) { 209 void FrameMaximizeButton::OnMouseExited(const ui::MouseEvent& event) {
215 ImageButton::OnMouseExited(event); 210 ImageButton::OnMouseExited(event);
216 // Remove the bubble menu when the button is not pressed and the mouse is not 211 // Remove the bubble menu when the button is not pressed and the mouse is not
217 // within the bubble. 212 // within the bubble.
218 if (!is_snap_enabled_ && maximizer_.get()) { 213 if (!is_snap_enabled_ && maximizer_.get()) {
219 if (maximizer_->GetBubbleWindow()) { 214 if (maximizer_->GetBubbleWindow()) {
220 gfx::Point screen_location = gfx::Screen::GetCursorScreenPoint(); 215 gfx::Point screen_location = gfx::Screen::GetCursorScreenPoint();
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 278
284 return ImageButton::OnGestureEvent(event); 279 return ImageButton::OnGestureEvent(event);
285 } 280 }
286 281
287 void FrameMaximizeButton::ProcessStartEvent(const ui::LocatedEvent& event) { 282 void FrameMaximizeButton::ProcessStartEvent(const ui::LocatedEvent& event) {
288 DCHECK(is_snap_enabled_); 283 DCHECK(is_snap_enabled_);
289 // Prepare the help menu. 284 // Prepare the help menu.
290 if (!maximizer_.get()) { 285 if (!maximizer_.get()) {
291 maximizer_.reset(new MaximizeBubbleController( 286 maximizer_.reset(new MaximizeBubbleController(
292 this, 287 this,
293 frame_->GetWidget()->IsMaximized(), 288 frame_->GetWidget()->IsMaximized()));
294 bubble_appearance_delay_ms_));
295 } else { 289 } else {
296 // If the menu did not show up yet, we delay it even a bit more. 290 // If the menu did not show up yet, we delay it even a bit more.
297 maximizer_->DelayCreation(); 291 maximizer_->DelayCreation();
298 } 292 }
299 snap_sizer_.reset(NULL); 293 snap_sizer_.reset(NULL);
300 InstallEventFilter(); 294 InstallEventFilter();
301 snap_type_ = SNAP_NONE; 295 snap_type_ = SNAP_NONE;
302 press_location_ = event.location(); 296 press_location_ = event.location();
303 exceeded_drag_threshold_ = false; 297 exceeded_drag_threshold_ = false;
304 update_timer_.Start( 298 update_timer_.Start(
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
496 break; 490 break;
497 case SNAP_RESTORE: 491 case SNAP_RESTORE:
498 frame_->GetWidget()->Restore(); 492 frame_->GetWidget()->Restore();
499 break; 493 break;
500 case SNAP_NONE: 494 case SNAP_NONE:
501 NOTREACHED(); 495 NOTREACHED();
502 } 496 }
503 } 497 }
504 498
505 } // namespace ash 499 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/workspace/frame_maximize_button.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698