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

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

Issue 9773009: Disable left/right/maximize for panels. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 9 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
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/screen_ash.h" 7 #include "ash/screen_ash.h"
8 #include "ash/shell.h" 8 #include "ash/shell.h"
9 #include "ash/wm/property_util.h" 9 #include "ash/wm/property_util.h"
10 #include "ash/launcher/launcher.h" 10 #include "ash/launcher/launcher.h"
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 return ui::GESTURE_STATUS_UNKNOWN; 89 return ui::GESTURE_STATUS_UNKNOWN;
90 } 90 }
91 91
92 // FrameMaximizeButton --------------------------------------------------------- 92 // FrameMaximizeButton ---------------------------------------------------------
93 93
94 FrameMaximizeButton::FrameMaximizeButton(views::ButtonListener* listener, 94 FrameMaximizeButton::FrameMaximizeButton(views::ButtonListener* listener,
95 views::NonClientFrameView* frame) 95 views::NonClientFrameView* frame)
96 : ImageButton(listener), 96 : ImageButton(listener),
97 frame_(frame), 97 frame_(frame),
98 is_snap_enabled_(false), 98 is_snap_enabled_(false),
99 is_left_right_enabled_(true),
100 is_maximize_enabled_(true),
99 exceeded_drag_threshold_(false), 101 exceeded_drag_threshold_(false),
100 snap_type_(SNAP_NONE) { 102 snap_type_(SNAP_NONE) {
101 // TODO(sky): nuke this. It's temporary while we don't have good images. 103 // TODO(sky): nuke this. It's temporary while we don't have good images.
102 SetImageAlignment(ALIGN_LEFT, ALIGN_BOTTOM); 104 SetImageAlignment(ALIGN_LEFT, ALIGN_BOTTOM);
103 SetTooltipText(l10n_util::GetStringUTF16(IDS_FRAME_MAXIMIZE_BUTTON_TOOLTIP)); 105 SetTooltipText(l10n_util::GetStringUTF16(IDS_FRAME_MAXIMIZE_BUTTON_TOOLTIP));
104 } 106 }
105 107
106 FrameMaximizeButton::~FrameMaximizeButton() { 108 FrameMaximizeButton::~FrameMaximizeButton() {
107 } 109 }
108 110
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 230
229 void FrameMaximizeButton::UpdateSnap(const gfx::Point& location) { 231 void FrameMaximizeButton::UpdateSnap(const gfx::Point& location) {
230 SnapType type = SnapTypeForLocation(location); 232 SnapType type = SnapTypeForLocation(location);
231 if (type == snap_type_) { 233 if (type == snap_type_) {
232 if (snap_sizer_.get()) { 234 if (snap_sizer_.get()) {
233 snap_sizer_->Update(LocationForSnapSizer(location)); 235 snap_sizer_->Update(LocationForSnapSizer(location));
234 phantom_window_->Show(snap_sizer_->target_bounds()); 236 phantom_window_->Show(snap_sizer_->target_bounds());
235 } 237 }
236 return; 238 return;
237 } 239 }
240 if ((!is_left_right_enabled_ && (type == SNAP_LEFT || type == SNAP_RIGHT)) ||
sky 2012/03/25 22:53:05 Move this to SnapTypeForLocation, otherwise we're
stevenjb 2012/03/25 23:11:37 Done.
241 (!is_maximize_enabled_ && type == SNAP_MAXIMIZE)) {
242 return;
243 }
238 244
239 snap_type_ = type; 245 snap_type_ = type;
240 snap_sizer_.reset(); 246 snap_sizer_.reset();
241 SchedulePaint(); 247 SchedulePaint();
242 248
243 if (snap_type_ == SNAP_NONE) { 249 if (snap_type_ == SNAP_NONE) {
244 phantom_window_.reset(); 250 phantom_window_.reset();
245 return; 251 return;
246 } 252 }
247 253
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 break; 331 break;
326 case SNAP_MINIMIZE: 332 case SNAP_MINIMIZE:
327 frame_->GetWidget()->Minimize(); 333 frame_->GetWidget()->Minimize();
328 break; 334 break;
329 default: 335 default:
330 NOTREACHED(); 336 NOTREACHED();
331 } 337 }
332 } 338 }
333 339
334 } // namespace ash 340 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698