OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "athena/screen/public/screen_manager.h" | 5 #include "athena/screen/public/screen_manager.h" |
6 | 6 |
| 7 #include "athena/common/fill_layout_manager.h" |
7 #include "athena/input/public/accelerator_manager.h" | 8 #include "athena/input/public/accelerator_manager.h" |
8 #include "athena/screen/background_controller.h" | 9 #include "athena/screen/background_controller.h" |
9 #include "athena/screen/screen_accelerator_handler.h" | 10 #include "athena/screen/screen_accelerator_handler.h" |
10 #include "base/logging.h" | 11 #include "base/logging.h" |
11 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
12 #include "ui/aura/client/window_tree_client.h" | 13 #include "ui/aura/client/window_tree_client.h" |
13 #include "ui/aura/layout_manager.h" | 14 #include "ui/aura/layout_manager.h" |
14 #include "ui/aura/window.h" | 15 #include "ui/aura/window.h" |
15 #include "ui/wm/core/capture_controller.h" | 16 #include "ui/wm/core/capture_controller.h" |
16 | 17 |
17 namespace athena { | 18 namespace athena { |
18 namespace { | 19 namespace { |
19 | 20 |
20 ScreenManager* instance = NULL; | 21 ScreenManager* instance = NULL; |
21 | 22 |
22 // TODO(oshima): There seems to be a couple of private implementation which does | |
23 // the same. | |
24 // Consider consolidating and reuse it. | |
25 class FillLayoutManager : public aura::LayoutManager { | |
26 public: | |
27 explicit FillLayoutManager(aura::Window* container) : container_(container) { | |
28 DCHECK(container_); | |
29 } | |
30 | |
31 // aura::LayoutManager: | |
32 virtual void OnWindowResized() OVERRIDE { | |
33 gfx::Rect full_bounds = gfx::Rect(container_->bounds().size()); | |
34 for (aura::Window::Windows::const_iterator iter = | |
35 container_->children().begin(); | |
36 iter != container_->children().end(); | |
37 ++iter) { | |
38 SetChildBoundsDirect(*iter, full_bounds); | |
39 } | |
40 } | |
41 virtual void OnWindowAddedToLayout(aura::Window* child) OVERRIDE { | |
42 SetChildBoundsDirect(child, (gfx::Rect(container_->bounds().size()))); | |
43 } | |
44 virtual void OnWillRemoveWindowFromLayout(aura::Window* child) OVERRIDE {} | |
45 virtual void OnWindowRemovedFromLayout(aura::Window* child) OVERRIDE {} | |
46 virtual void OnChildWindowVisibilityChanged(aura::Window* child, | |
47 bool visible) OVERRIDE {} | |
48 virtual void SetChildBounds(aura::Window* child, | |
49 const gfx::Rect& requested_bounds) OVERRIDE { | |
50 // Ignore SetBounds request. | |
51 } | |
52 | |
53 private: | |
54 aura::Window* container_; | |
55 | |
56 DISALLOW_COPY_AND_ASSIGN(FillLayoutManager); | |
57 }; | |
58 | |
59 class AthenaWindowTreeClient : public aura::client::WindowTreeClient { | 23 class AthenaWindowTreeClient : public aura::client::WindowTreeClient { |
60 public: | 24 public: |
61 explicit AthenaWindowTreeClient(aura::Window* container) | 25 explicit AthenaWindowTreeClient(aura::Window* container) |
62 : container_(container) {} | 26 : container_(container) {} |
63 | 27 |
64 private: | 28 private: |
65 virtual ~AthenaWindowTreeClient() {} | 29 virtual ~AthenaWindowTreeClient() {} |
66 | 30 |
67 // aura::client::WindowTreeClient: | 31 // aura::client::WindowTreeClient: |
68 virtual aura::Window* GetDefaultParent(aura::Window* context, | 32 virtual aura::Window* GetDefaultParent(aura::Window* context, |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 } | 132 } |
169 | 133 |
170 // static | 134 // static |
171 void ScreenManager::Shutdown() { | 135 void ScreenManager::Shutdown() { |
172 DCHECK(instance); | 136 DCHECK(instance); |
173 delete instance; | 137 delete instance; |
174 DCHECK(!instance); | 138 DCHECK(!instance); |
175 } | 139 } |
176 | 140 |
177 } // namespace athena | 141 } // namespace athena |
OLD | NEW |