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

Side by Side Diff: ui/aura_shell/window_util.cc

Issue 9035001: Move some more WM functionality down into ash. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 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 | Annotate | Revision Log
« no previous file with comments | « ui/aura_shell/window_util.h ('k') | ui/aura_shell/workspace/workspace.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "ui/aura_shell/window_util.h"
6
7 #include "ash/wm/activation_controller.h"
8 #include "ui/aura/client/activation_client.h"
9 #include "ui/aura/client/aura_constants.h"
10 #include "ui/aura/root_window.h"
11 #include "ui/aura/window.h"
12 #include "ui/aura_shell/property_util.h"
13 #include "ui/base/ui_base_types.h"
14 #include "ui/gfx/screen.h"
15
16 namespace aura_shell {
17
18 bool IsWindowMaximized(aura::Window* window) {
19 return window->GetIntProperty(aura::client::kShowStateKey) ==
20 ui::SHOW_STATE_MAXIMIZED;
21 }
22
23 void ActivateWindow(aura::Window* window) {
24 aura::client::GetActivationClient()->ActivateWindow(window);
25 }
26
27 void DeactivateWindow(aura::Window* window) {
28 aura::client::GetActivationClient()->DeactivateWindow(window);
29 }
30
31 bool IsActiveWindow(aura::Window* window) {
32 return GetActiveWindow() == window;
33 }
34
35 aura::Window* GetActiveWindow() {
36 return aura::client::GetActivationClient()->GetActiveWindow();
37 }
38
39 aura::Window* GetActivatableWindow(aura::Window* window) {
40 return internal::ActivationController::GetActivatableWindow(window);
41 }
42
43 void UpdateBoundsFromShowState(aura::Window* window) {
44 switch (window->GetIntProperty(aura::client::kShowStateKey)) {
45 case ui::SHOW_STATE_NORMAL: {
46 const gfx::Rect* restore = GetRestoreBounds(window);
47 window->SetProperty(aura::client::kRestoreBoundsKey, NULL);
48 if (restore)
49 window->SetBounds(*restore);
50 delete restore;
51 break;
52 }
53
54 case ui::SHOW_STATE_MAXIMIZED:
55 SetRestoreBoundsIfNotSet(window);
56 window->SetBounds(gfx::Screen::GetMonitorWorkAreaNearestWindow(window));
57 break;
58
59 case ui::SHOW_STATE_FULLSCREEN:
60 SetRestoreBoundsIfNotSet(window);
61 window->SetBounds(gfx::Screen::GetMonitorAreaNearestWindow(window));
62 break;
63
64 default:
65 break;
66 }
67 }
68
69 } // namespace aura_shell
OLDNEW
« no previous file with comments | « ui/aura_shell/window_util.h ('k') | ui/aura_shell/workspace/workspace.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698