| 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 #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/shelf/shelf_widget.h" | 9 #include "ash/shelf/shelf_widget.h" |
| 10 #include "ash/shell.h" | 10 #include "ash/shell.h" |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 : ImageButton(listener), | 84 : ImageButton(listener), |
| 85 frame_(frame), | 85 frame_(frame), |
| 86 is_snap_enabled_(false), | 86 is_snap_enabled_(false), |
| 87 exceeded_drag_threshold_(false), | 87 exceeded_drag_threshold_(false), |
| 88 widget_(NULL), | 88 widget_(NULL), |
| 89 press_is_gesture_(false), | 89 press_is_gesture_(false), |
| 90 snap_type_(SNAP_NONE), | 90 snap_type_(SNAP_NONE), |
| 91 bubble_appearance_delay_ms_(kBubbleAppearanceDelayMS) { | 91 bubble_appearance_delay_ms_(kBubbleAppearanceDelayMS) { |
| 92 // TODO(sky): nuke this. It's temporary while we don't have good images. | 92 // TODO(sky): nuke this. It's temporary while we don't have good images. |
| 93 SetImageAlignment(ALIGN_LEFT, ALIGN_BOTTOM); | 93 SetImageAlignment(ALIGN_LEFT, ALIGN_BOTTOM); |
| 94 |
| 95 if (ash::Shell::IsForcedMaximizeMode()) |
| 96 views::View::SetVisible(false); |
| 94 } | 97 } |
| 95 | 98 |
| 96 FrameMaximizeButton::~FrameMaximizeButton() { | 99 FrameMaximizeButton::~FrameMaximizeButton() { |
| 97 // Before the window gets destroyed, the maximizer dialog needs to be shut | 100 // Before the window gets destroyed, the maximizer dialog needs to be shut |
| 98 // down since it would otherwise call into a deleted object. | 101 // down since it would otherwise call into a deleted object. |
| 99 maximizer_.reset(); | 102 maximizer_.reset(); |
| 100 if (widget_) | 103 if (widget_) |
| 101 OnWindowDestroying(widget_->GetNativeWindow()); | 104 OnWindowDestroying(widget_->GetNativeWindow()); |
| 102 } | 105 } |
| 103 | 106 |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 299 event->type() == ui::ET_GESTURE_SCROLL_BEGIN) { | 302 event->type() == ui::ET_GESTURE_SCROLL_BEGIN) { |
| 300 ProcessUpdateEvent(*event); | 303 ProcessUpdateEvent(*event); |
| 301 event->SetHandled(); | 304 event->SetHandled(); |
| 302 return; | 305 return; |
| 303 } | 306 } |
| 304 } | 307 } |
| 305 | 308 |
| 306 ImageButton::OnGestureEvent(event); | 309 ImageButton::OnGestureEvent(event); |
| 307 } | 310 } |
| 308 | 311 |
| 312 void FrameMaximizeButton::SetVisible(bool visible) { |
| 313 // In the enforced maximized mode we do not allow to be made visible. |
| 314 if (ash::Shell::IsForcedMaximizeMode()) |
| 315 return; |
| 316 |
| 317 views::View::SetVisible(visible); |
| 318 } |
| 319 |
| 309 void FrameMaximizeButton::ProcessStartEvent(const ui::LocatedEvent& event) { | 320 void FrameMaximizeButton::ProcessStartEvent(const ui::LocatedEvent& event) { |
| 310 DCHECK(is_snap_enabled_); | 321 DCHECK(is_snap_enabled_); |
| 311 // Prepare the help menu. | 322 // Prepare the help menu. |
| 312 if (!maximizer_) { | 323 if (!maximizer_) { |
| 313 maximizer_.reset(new MaximizeBubbleController( | 324 maximizer_.reset(new MaximizeBubbleController( |
| 314 this, | 325 this, |
| 315 GetMaximizeBubbleFrameState(), | 326 GetMaximizeBubbleFrameState(), |
| 316 bubble_appearance_delay_ms_)); | 327 bubble_appearance_delay_ms_)); |
| 317 } else { | 328 } else { |
| 318 // If the menu did not show up yet, we delay it even a bit more. | 329 // If the menu did not show up yet, we delay it even a bit more. |
| (...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 600 return FRAME_STATE_SNAP_LEFT; | 611 return FRAME_STATE_SNAP_LEFT; |
| 601 if (bounds.right() == screen.right()) | 612 if (bounds.right() == screen.right()) |
| 602 return FRAME_STATE_SNAP_RIGHT; | 613 return FRAME_STATE_SNAP_RIGHT; |
| 603 // If we come here, it is likely caused by the fact that the | 614 // If we come here, it is likely caused by the fact that the |
| 604 // "VerticalResizeDoubleClick" stored a restore rectangle. In that case | 615 // "VerticalResizeDoubleClick" stored a restore rectangle. In that case |
| 605 // we allow all maximize operations (and keep the restore rectangle). | 616 // we allow all maximize operations (and keep the restore rectangle). |
| 606 return FRAME_STATE_NONE; | 617 return FRAME_STATE_NONE; |
| 607 } | 618 } |
| 608 | 619 |
| 609 } // namespace ash | 620 } // namespace ash |
| OLD | NEW |