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/accelerators/accelerator_controller.h" | 5 #include "ash/accelerators/accelerator_controller.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <cmath> | 8 #include <cmath> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 592 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
603 // http://crbug.com/135487. | 603 // http://crbug.com/135487. |
604 if (!window || | 604 if (!window || |
605 window->type() != aura::client::WINDOW_TYPE_NORMAL || | 605 window->type() != aura::client::WINDOW_TYPE_NORMAL || |
606 wm::IsWindowFullscreen(window)) { | 606 wm::IsWindowFullscreen(window)) { |
607 break; | 607 break; |
608 } | 608 } |
609 | 609 |
610 internal::SnapSizer sizer(window, | 610 internal::SnapSizer sizer(window, |
611 gfx::Point(), | 611 gfx::Point(), |
612 action == WINDOW_SNAP_LEFT ? internal::SnapSizer::LEFT_EDGE : | 612 action == WINDOW_SNAP_LEFT ? internal::SnapSizer::LEFT_EDGE : |
613 internal::SnapSizer::RIGHT_EDGE, | 613 internal::SnapSizer::RIGHT_EDGE); |
614 shell->GetGridSize()); | |
615 if (wm::IsWindowFullscreen(window) || | 614 if (wm::IsWindowFullscreen(window) || |
616 wm::IsWindowMaximized(window)) { | 615 wm::IsWindowMaximized(window)) { |
617 // Before we can set the bounds we need to restore the window. | 616 // Before we can set the bounds we need to restore the window. |
618 // Restoring the window will set the window to its restored bounds. | 617 // Restoring the window will set the window to its restored bounds. |
619 // To avoid an unnecessary bounds changes (which may have side effects) | 618 // To avoid an unnecessary bounds changes (which may have side effects) |
620 // we set the restore bounds to the bounds we want, restore the window, | 619 // we set the restore bounds to the bounds we want, restore the window, |
621 // then reset the restore bounds. This way no unnecessary bounds | 620 // then reset the restore bounds. This way no unnecessary bounds |
622 // changes occurs and the original restore bounds is remembered. | 621 // changes occurs and the original restore bounds is remembered. |
623 gfx::Rect restore = *GetRestoreBoundsInScreen(window); | 622 gfx::Rect restore = *GetRestoreBoundsInScreen(window); |
624 SetRestoreBoundsInParent(window, sizer.GetSnapBounds(window->bounds())); | 623 SetRestoreBoundsInParent(window, sizer.GetSnapBounds(window->bounds())); |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
788 accelerators_.insert( | 787 accelerators_.insert( |
789 std::make_pair(accelerator, accelerators[i].action)); | 788 std::make_pair(accelerator, accelerators[i].action)); |
790 } | 789 } |
791 } | 790 } |
792 | 791 |
793 bool AcceleratorController::CanHandleAccelerators() const { | 792 bool AcceleratorController::CanHandleAccelerators() const { |
794 return true; | 793 return true; |
795 } | 794 } |
796 | 795 |
797 } // namespace ash | 796 } // namespace ash |
OLD | NEW |