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

Side by Side Diff: ash/wm/workspace/workspace_layout_manager2.h

Issue 11293014: Renames Workspace*2 -> Workspace*. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 1 month 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef ASH_WM_WORKSPACE_WORKSPACE_LAYOUT_MANAGER2_H_
6 #define ASH_WM_WORKSPACE_WORKSPACE_LAYOUT_MANAGER2_H_
7
8 #include <set>
9
10 #include "ash/shell_observer.h"
11 #include "ash/wm/base_layout_manager.h"
12 #include "base/basictypes.h"
13 #include "base/compiler_specific.h"
14 #include "ui/aura/layout_manager.h"
15 #include "ui/aura/root_window_observer.h"
16 #include "ui/base/ui_base_types.h"
17 #include "ui/aura/window_observer.h"
18 #include "ui/gfx/rect.h"
19
20 namespace aura {
21 class RootWindow;
22 class Window;
23 }
24
25 namespace ui {
26 class Layer;
27 }
28
29 namespace ash {
30
31 // We force at least this many DIPs for any window on the screen.
32 const int kMinimumOnScreenArea = 10;
33
34 namespace internal {
35
36 class Workspace2;
37 class WorkspaceManager2;
38
39 // LayoutManager used on the window created for a Workspace.
40 // TODO(sky): this code shares a fair amount of similarities with
41 // BaseLayoutManager, yet its different enough that subclassing is painful.
42 // See if I can refactor the code to make it easier to share common bits.
43 class ASH_EXPORT WorkspaceLayoutManager2
44 : public aura::LayoutManager,
45 public aura::RootWindowObserver,
46 public ash::ShellObserver,
47 public aura::WindowObserver {
48 public:
49 public:
50 explicit WorkspaceLayoutManager2(Workspace2* workspace);
51 virtual ~WorkspaceLayoutManager2();
52
53 // Overridden from BaseWorkspaceLayoutManager:
54 virtual void OnWindowResized() OVERRIDE {}
55 virtual void OnWindowAddedToLayout(aura::Window* child) OVERRIDE;
56 virtual void OnWillRemoveWindowFromLayout(aura::Window* child) OVERRIDE;
57 virtual void OnWindowRemovedFromLayout(aura::Window* child) OVERRIDE;
58 virtual void OnChildWindowVisibilityChanged(aura::Window* child,
59 bool visibile) OVERRIDE;
60 virtual void SetChildBounds(aura::Window* child,
61 const gfx::Rect& requested_bounds) OVERRIDE;
62
63 // RootWindowObserver overrides:
64 virtual void OnRootWindowResized(const aura::RootWindow* root,
65 const gfx::Size& old_size) OVERRIDE;
66
67 // ash::ShellObserver overrides:
68 virtual void OnDisplayWorkAreaInsetsChanged() OVERRIDE;
69
70 // Overriden from WindowObserver:
71 virtual void OnWindowPropertyChanged(aura::Window* window,
72 const void* key,
73 intptr_t old) OVERRIDE;
74 virtual void OnWindowDestroying(aura::Window* window) OVERRIDE;
75
76 private:
77 typedef std::set<aura::Window*> WindowSet;
78
79 // Invoked when the show state of a window changes. |cloned_layer| is a clone
80 // of the windows layer tree. |cloned_layer| is only non-NULL if a cross fade
81 // should happen between the states. This method takes ownership of
82 // |cloned_layer|.
83 void ShowStateChanged(aura::Window* window,
84 ui::WindowShowState last_show_state,
85 ui::Layer* cloned_layer);
86
87 enum AdjustWindowReason {
88 ADJUST_WINDOW_SCREEN_SIZE_CHANGED,
89 ADJUST_WINDOW_DISPLAY_INSETS_CHANGED
90 };
91
92 // Adjusts the sizes of the windows during a screen change. If this is called
93 // for a screen size change (i.e. |reason| is
94 // ADJUST_WINDOW_SCREEN_SIZE_CHANGED), the non-maximized/non-fullscreen
95 // windows are readjusted to make sure the window is completely within the
96 // display region. Otherwise, it makes sure at least some parts of the window
97 // is on display.
98 void AdjustWindowSizesForScreenChange(AdjustWindowReason reason);
99
100 // Adjusts the sizes of the specific window in respond to a screen change or
101 // display-area size change.
102 void AdjustWindowSizeForScreenChange(aura::Window* window,
103 AdjustWindowReason reason);
104
105 // Updates the bounds of the window from a show state change.
106 void UpdateBoundsFromShowState(aura::Window* window);
107
108 // If |window| is maximized or fullscreen the bounds of the window are set and
109 // true is returned. Does nothing otherwise.
110 bool SetMaximizedOrFullscreenBounds(aura::Window* window);
111
112 WorkspaceManager2* workspace_manager();
113
114 aura::RootWindow* root_window_;
115
116 Workspace2* workspace_;
117
118 // Set of windows we're listening to.
119 WindowSet windows_;
120
121 // The work area. Cached to avoid unnecessarily moving windows during a
122 // workspace switch.
123 gfx::Rect work_area_;
124
125 DISALLOW_COPY_AND_ASSIGN(WorkspaceLayoutManager2);
126 };
127
128 } // namespace internal
129 } // namespace ash
130
131 #endif // ASH_WM_WORKSPACE_WORKSPACE_LAYOUT_MANAGER2_H_
OLDNEW
« no previous file with comments | « ash/wm/workspace/workspace_layout_manager.cc ('k') | ash/wm/workspace/workspace_layout_manager2.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698