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

Side by Side Diff: ash/wm/window_util.cc

Issue 9956056: ash: Add accelerator for snapping windows left/right. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 8 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
« ash/accelerators/accelerator_table.h ('K') | « ash/wm/window_util.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/window_util.h" 5 #include "ash/wm/window_util.h"
6 6
7 #include "ash/shell.h" 7 #include "ash/shell.h"
8 #include "ash/wm/activation_controller.h" 8 #include "ash/wm/activation_controller.h"
9 #include "ui/aura/client/activation_client.h" 9 #include "ui/aura/client/activation_client.h"
10 #include "ui/aura/client/aura_constants.h" 10 #include "ui/aura/client/aura_constants.h"
11 #include "ui/aura/env.h"
12 #include "ui/aura/monitor.h"
13 #include "ui/aura/monitor_manager.h"
11 #include "ui/aura/root_window.h" 14 #include "ui/aura/root_window.h"
12 #include "ui/aura/window.h" 15 #include "ui/aura/window.h"
13 #include "ui/aura/window_property.h" 16 #include "ui/aura/window_property.h"
14 #include "ui/base/ui_base_types.h" 17 #include "ui/base/ui_base_types.h"
15 #include "ui/gfx/screen.h" 18 #include "ui/gfx/screen.h"
16 19
17 DECLARE_WINDOW_PROPERTY_TYPE(bool); 20 DECLARE_WINDOW_PROPERTY_TYPE(bool);
18 21
19 namespace ash { 22 namespace ash {
20 DEFINE_WINDOW_PROPERTY_KEY(bool, kOpenWindowSplitKey, false); 23 DEFINE_WINDOW_PROPERTY_KEY(bool, kOpenWindowSplitKey, false);
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 } 92 }
90 93
91 void MinimizeWindow(aura::Window* window) { 94 void MinimizeWindow(aura::Window* window) {
92 window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MINIMIZED); 95 window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MINIMIZED);
93 } 96 }
94 97
95 void RestoreWindow(aura::Window* window) { 98 void RestoreWindow(aura::Window* window) {
96 window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_NORMAL); 99 window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_NORMAL);
97 } 100 }
98 101
102 void CenterWindow(aura::Window* window) {
103 const aura::Monitor* monitor = aura::Env::GetInstance()->monitor_manager()->
104 GetMonitorNearestWindow(window);
105 gfx::Rect center = monitor->GetWorkAreaBounds().Center(
106 window->bounds().size());
107 window->SetBounds(center);
Daniel Erat 2012/04/25 16:11:42 should this be taking the grid into account?
sadrul 2012/04/25 16:15:38 [don't have an opinion]
108 }
109
99 } // namespace wm 110 } // namespace wm
100 } // namespace ash 111 } // namespace ash
OLDNEW
« ash/accelerators/accelerator_table.h ('K') | « ash/wm/window_util.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698