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

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

Issue 68033003: Undocks window first before side-snapping bounds (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Undocks window first before side-snapping bounds (nits) Created 7 years 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/caption_buttons/frame_maximize_button.h" 5 #include "ash/wm/caption_buttons/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 509 matching lines...) Expand 10 before | Expand all | Expand 10 after
520 520
521 gfx::Point FrameMaximizeButton::LocationForSnapSizer( 521 gfx::Point FrameMaximizeButton::LocationForSnapSizer(
522 const gfx::Point& location) const { 522 const gfx::Point& location) const {
523 gfx::Point result(location); 523 gfx::Point result(location);
524 views::View::ConvertPointToScreen(this, &result); 524 views::View::ConvertPointToScreen(this, &result);
525 return result; 525 return result;
526 } 526 }
527 527
528 void FrameMaximizeButton::Snap(SnapSizer* snap_sizer) { 528 void FrameMaximizeButton::Snap(SnapSizer* snap_sizer) {
529 Shell* shell = Shell::GetInstance(); 529 Shell* shell = Shell::GetInstance();
530 wm::WindowState* window_state = wm::GetWindowState(frame_->GetNativeWindow());
531 switch (snap_type_) { 530 switch (snap_type_) {
532 case SNAP_LEFT: 531 case SNAP_LEFT:
533 case SNAP_RIGHT: { 532 case SNAP_RIGHT: {
534 // Others might also have set up a restore rectangle already. If so, we
535 // should not overwrite the restore rectangle.
536 gfx::Rect current_bounds_in_screen = frame_->GetWindowBoundsInScreen();
537 snap_sizer->SnapWindowToTargetBounds(); 533 snap_sizer->SnapWindowToTargetBounds();
538 if (!window_state->HasRestoreBounds())
539 window_state->SetRestoreBoundsInScreen(current_bounds_in_screen);
540 shell->delegate()->RecordUserMetricsAction( 534 shell->delegate()->RecordUserMetricsAction(
541 snap_type_ == SNAP_LEFT ? 535 snap_type_ == SNAP_LEFT ?
542 UMA_WINDOW_MAXIMIZE_BUTTON_MAXIMIZE_LEFT : 536 UMA_WINDOW_MAXIMIZE_BUTTON_MAXIMIZE_LEFT :
543 UMA_WINDOW_MAXIMIZE_BUTTON_MAXIMIZE_RIGHT); 537 UMA_WINDOW_MAXIMIZE_BUTTON_MAXIMIZE_RIGHT);
544 break; 538 break;
545 } 539 }
546 case SNAP_MAXIMIZE: 540 case SNAP_MAXIMIZE:
547 frame_->Maximize(); 541 frame_->Maximize();
548 shell->delegate()->RecordUserMetricsAction( 542 shell->delegate()->RecordUserMetricsAction(
549 UMA_WINDOW_MAXIMIZE_BUTTON_MAXIMIZE); 543 UMA_WINDOW_MAXIMIZE_BUTTON_MAXIMIZE);
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
589 return FRAME_STATE_SNAP_LEFT; 583 return FRAME_STATE_SNAP_LEFT;
590 if (bounds.right() == screen.right()) 584 if (bounds.right() == screen.right())
591 return FRAME_STATE_SNAP_RIGHT; 585 return FRAME_STATE_SNAP_RIGHT;
592 // If we come here, it is likely caused by the fact that the 586 // If we come here, it is likely caused by the fact that the
593 // "VerticalResizeDoubleClick" stored a restore rectangle. In that case 587 // "VerticalResizeDoubleClick" stored a restore rectangle. In that case
594 // we allow all maximize operations (and keep the restore rectangle). 588 // we allow all maximize operations (and keep the restore rectangle).
595 return FRAME_STATE_NONE; 589 return FRAME_STATE_NONE;
596 } 590 }
597 591
598 } // namespace ash 592 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698