OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 #ifndef ASH_WM_DOCK_DOCKED_WINDOW_LAYOUT_MANAGER_H_ | 5 #ifndef ASH_WM_DOCK_DOCKED_WINDOW_LAYOUT_MANAGER_H_ |
6 #define ASH_WM_DOCK_DOCKED_WINDOW_LAYOUT_MANAGER_H_ | 6 #define ASH_WM_DOCK_DOCKED_WINDOW_LAYOUT_MANAGER_H_ |
7 | 7 |
8 #include "ash/ash_export.h" | 8 #include "ash/ash_export.h" |
9 #include "ash/shelf/shelf_layout_manager_observer.h" | 9 #include "ash/shelf/shelf_layout_manager_observer.h" |
10 #include "ash/shell_observer.h" | 10 #include "ash/shell_observer.h" |
| 11 #include "ash/snap_to_pixel_layout_manager.h" |
11 #include "ash/wm/dock/dock_types.h" | 12 #include "ash/wm/dock/dock_types.h" |
12 #include "ash/wm/dock/docked_window_layout_manager_observer.h" | 13 #include "ash/wm/dock/docked_window_layout_manager_observer.h" |
13 #include "ash/wm/window_state_observer.h" | 14 #include "ash/wm/window_state_observer.h" |
14 #include "base/basictypes.h" | 15 #include "base/basictypes.h" |
15 #include "base/compiler_specific.h" | 16 #include "base/compiler_specific.h" |
16 #include "base/gtest_prod_util.h" | 17 #include "base/gtest_prod_util.h" |
17 #include "base/memory/scoped_ptr.h" | 18 #include "base/memory/scoped_ptr.h" |
18 #include "base/observer_list.h" | 19 #include "base/observer_list.h" |
19 #include "base/time/time.h" | 20 #include "base/time/time.h" |
20 #include "ui/aura/layout_manager.h" | |
21 #include "ui/aura/window.h" | 21 #include "ui/aura/window.h" |
22 #include "ui/aura/window_observer.h" | 22 #include "ui/aura/window_observer.h" |
23 #include "ui/gfx/rect.h" | 23 #include "ui/gfx/rect.h" |
24 #include "ui/keyboard/keyboard_controller_observer.h" | 24 #include "ui/keyboard/keyboard_controller_observer.h" |
25 #include "ui/wm/public/activation_change_observer.h" | 25 #include "ui/wm/public/activation_change_observer.h" |
26 | 26 |
27 namespace aura { | 27 namespace aura { |
28 class Window; | 28 class Window; |
29 } | 29 } |
30 | 30 |
(...skipping 29 matching lines...) Expand all Loading... |
60 // windows added to that container. | 60 // windows added to that container. |
61 // | 61 // |
62 // The constructor takes a |dock_container| argument which is expected to set | 62 // The constructor takes a |dock_container| argument which is expected to set |
63 // its layout manager to this instance, e.g.: | 63 // its layout manager to this instance, e.g.: |
64 // dock_container->SetLayoutManager( | 64 // dock_container->SetLayoutManager( |
65 // new DockedWindowLayoutManager(dock_container)); | 65 // new DockedWindowLayoutManager(dock_container)); |
66 // | 66 // |
67 // TODO(varkha): extend BaseLayoutManager instead of LayoutManager to inherit | 67 // TODO(varkha): extend BaseLayoutManager instead of LayoutManager to inherit |
68 // common functionality. | 68 // common functionality. |
69 class ASH_EXPORT DockedWindowLayoutManager | 69 class ASH_EXPORT DockedWindowLayoutManager |
70 : public aura::LayoutManager, | 70 : public SnapToPixelLayoutManager, |
71 public ash::ShellObserver, | 71 public ash::ShellObserver, |
72 public aura::WindowObserver, | 72 public aura::WindowObserver, |
73 public aura::client::ActivationChangeObserver, | 73 public aura::client::ActivationChangeObserver, |
74 public keyboard::KeyboardControllerObserver, | 74 public keyboard::KeyboardControllerObserver, |
75 public ShelfLayoutManagerObserver, | 75 public ShelfLayoutManagerObserver, |
76 public wm::WindowStateObserver { | 76 public wm::WindowStateObserver { |
77 public: | 77 public: |
78 // Maximum width of the docked windows area. | 78 // Maximum width of the docked windows area. |
79 static const int kMaxDockWidth; | 79 static const int kMaxDockWidth; |
80 | 80 |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 | 127 |
128 // Returns last known coordinates of |dragged_window_| after Relayout. | 128 // Returns last known coordinates of |dragged_window_| after Relayout. |
129 const gfx::Rect dragged_bounds() const { return dragged_bounds_;} | 129 const gfx::Rect dragged_bounds() const { return dragged_bounds_;} |
130 | 130 |
131 // Returns true if currently dragged window is docked at the screen edge. | 131 // Returns true if currently dragged window is docked at the screen edge. |
132 bool is_dragged_window_docked() const { return is_dragged_window_docked_; } | 132 bool is_dragged_window_docked() const { return is_dragged_window_docked_; } |
133 | 133 |
134 // Updates docked layout when shelf bounds change. | 134 // Updates docked layout when shelf bounds change. |
135 void OnShelfBoundsChanged(); | 135 void OnShelfBoundsChanged(); |
136 | 136 |
137 // aura::LayoutManager: | 137 // SnapLayoutManager: |
138 virtual void OnWindowResized() OVERRIDE; | 138 virtual void OnWindowResized() OVERRIDE; |
139 virtual void OnWindowAddedToLayout(aura::Window* child) OVERRIDE; | 139 virtual void OnWindowAddedToLayout(aura::Window* child) OVERRIDE; |
140 virtual void OnWillRemoveWindowFromLayout(aura::Window* child) OVERRIDE {} | 140 virtual void OnWillRemoveWindowFromLayout(aura::Window* child) OVERRIDE {} |
141 virtual void OnWindowRemovedFromLayout(aura::Window* child) OVERRIDE; | 141 virtual void OnWindowRemovedFromLayout(aura::Window* child) OVERRIDE; |
142 virtual void OnChildWindowVisibilityChanged(aura::Window* child, | 142 virtual void OnChildWindowVisibilityChanged(aura::Window* child, |
143 bool visibile) OVERRIDE; | 143 bool visibile) OVERRIDE; |
144 virtual void SetChildBounds(aura::Window* child, | 144 virtual void SetChildBounds(aura::Window* child, |
145 const gfx::Rect& requested_bounds) OVERRIDE; | 145 const gfx::Rect& requested_bounds) OVERRIDE; |
146 | 146 |
147 // ash::ShellObserver: | 147 // ash::ShellObserver: |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
303 | 303 |
304 // Observers of dock bounds changes. | 304 // Observers of dock bounds changes. |
305 ObserverList<DockedWindowLayoutManagerObserver> observer_list_; | 305 ObserverList<DockedWindowLayoutManagerObserver> observer_list_; |
306 | 306 |
307 DISALLOW_COPY_AND_ASSIGN(DockedWindowLayoutManager); | 307 DISALLOW_COPY_AND_ASSIGN(DockedWindowLayoutManager); |
308 }; | 308 }; |
309 | 309 |
310 } // namespace ash | 310 } // namespace ash |
311 | 311 |
312 #endif // ASH_WM_DOCK_DOCKED_WINDOW_LAYOUT_MANAGER_H_ | 312 #endif // ASH_WM_DOCK_DOCKED_WINDOW_LAYOUT_MANAGER_H_ |
OLD | NEW |