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/container_priorities.h" | 7 #include "athena/common/container_priorities.h" |
8 #include "athena/common/fill_layout_manager.h" | 8 #include "athena/common/fill_layout_manager.h" |
9 #include "athena/input/public/accelerator_manager.h" | 9 #include "athena/input/public/accelerator_manager.h" |
10 #include "athena/screen/background_controller.h" | 10 #include "athena/screen/background_controller.h" |
11 #include "athena/screen/screen_accelerator_handler.h" | 11 #include "athena/screen/screen_accelerator_handler.h" |
12 #include "base/logging.h" | 12 #include "base/logging.h" |
13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
14 #include "ui/aura/client/screen_position_client.h" | 14 #include "ui/aura/client/screen_position_client.h" |
15 #include "ui/aura/client/window_tree_client.h" | 15 #include "ui/aura/client/window_tree_client.h" |
16 #include "ui/aura/layout_manager.h" | 16 #include "ui/aura/layout_manager.h" |
17 #include "ui/aura/test/test_screen.h" | 17 #include "ui/aura/test/test_screen.h" |
18 #include "ui/aura/window.h" | 18 #include "ui/aura/window.h" |
19 #include "ui/aura/window_property.h" | 19 #include "ui/aura/window_property.h" |
20 #include "ui/aura/window_targeter.h" | 20 #include "ui/aura/window_targeter.h" |
21 #include "ui/aura/window_tree_host.h" | 21 #include "ui/aura/window_tree_host.h" |
22 #include "ui/compositor/layer.h" | 22 #include "ui/compositor/layer.h" |
23 #include "ui/gfx/display.h" | 23 #include "ui/gfx/display.h" |
24 #include "ui/gfx/screen.h" | 24 #include "ui/gfx/screen.h" |
25 #include "ui/wm/core/base_focus_rules.h" | 25 #include "ui/wm/core/base_focus_rules.h" |
26 #include "ui/wm/core/capture_controller.h" | 26 #include "ui/wm/core/capture_controller.h" |
27 #include "ui/wm/core/focus_controller.h" | 27 #include "ui/wm/core/focus_controller.h" |
28 #include "ui/wm/core/window_util.h" | |
28 | 29 |
29 namespace athena { | 30 namespace athena { |
30 namespace { | 31 namespace { |
31 | 32 |
32 DEFINE_OWNED_WINDOW_PROPERTY_KEY(ScreenManager::ContainerParams, | 33 DEFINE_OWNED_WINDOW_PROPERTY_KEY(ScreenManager::ContainerParams, |
33 kContainerParamsKey, | 34 kContainerParamsKey, |
34 NULL); | 35 NULL); |
35 | 36 |
36 ScreenManager* instance = NULL; | 37 ScreenManager* instance = NULL; |
37 | 38 |
38 bool GrabsInput(aura::Window* container) { | 39 bool GrabsInput(aura::Window* container) { |
39 ScreenManager::ContainerParams* params = | 40 ScreenManager::ContainerParams* params = |
40 container->GetProperty(kContainerParamsKey); | 41 container->GetProperty(kContainerParamsKey); |
41 return params && params->grab_inputs; | 42 return params && params->grab_inputs; |
42 } | 43 } |
43 | 44 |
44 // Returns the container which contains |window|. | 45 // Returns the container which contains |window|. |
45 aura::Window* GetContainer(aura::Window* window) { | 46 aura::Window* GetContainer(aura::Window* window) { |
46 // No containers for NULL or the root window itself. | 47 if (!window) |
47 if (!window || !window->parent()) | |
48 return NULL; | 48 return NULL; |
49 if (window->parent()->IsRootWindow()) | 49 if (window->GetProperty(kContainerParamsKey)) |
50 return window; | 50 return window; |
51 return GetContainer(window->parent()); | 51 return GetContainer(window->parent()); |
oshima
2014/09/04 15:04:53
this is not your fault, but you can change to use
mohsen
2014/09/04 15:39:54
Sure; Done.
| |
52 } | 52 } |
53 | 53 |
54 class AthenaFocusRules : public wm::BaseFocusRules { | 54 class AthenaFocusRules : public wm::BaseFocusRules { |
55 public: | 55 public: |
56 AthenaFocusRules() {} | 56 AthenaFocusRules() {} |
57 virtual ~AthenaFocusRules() {} | 57 virtual ~AthenaFocusRules() {} |
58 | 58 |
59 // wm::BaseFocusRules: | 59 // wm::BaseFocusRules: |
60 virtual bool SupportsChildActivation(aura::Window* window) const OVERRIDE { | 60 virtual bool SupportsChildActivation(aura::Window* window) const OVERRIDE { |
61 ScreenManager::ContainerParams* params = | 61 ScreenManager::ContainerParams* params = |
(...skipping 26 matching lines...) Expand all Loading... | |
88 explicit AthenaWindowTreeClient(aura::Window* container) | 88 explicit AthenaWindowTreeClient(aura::Window* container) |
89 : container_(container) {} | 89 : container_(container) {} |
90 | 90 |
91 private: | 91 private: |
92 virtual ~AthenaWindowTreeClient() {} | 92 virtual ~AthenaWindowTreeClient() {} |
93 | 93 |
94 // aura::client::WindowTreeClient: | 94 // aura::client::WindowTreeClient: |
95 virtual aura::Window* GetDefaultParent(aura::Window* context, | 95 virtual aura::Window* GetDefaultParent(aura::Window* context, |
96 aura::Window* window, | 96 aura::Window* window, |
97 const gfx::Rect& bounds) OVERRIDE { | 97 const gfx::Rect& bounds) OVERRIDE { |
98 aura::Window* transient_parent = wm::GetTransientParent(window); | |
99 if (transient_parent) | |
100 return GetContainer(transient_parent); | |
98 return container_; | 101 return container_; |
99 } | 102 } |
100 | 103 |
101 aura::Window* container_; | 104 aura::Window* container_; |
102 | 105 |
103 DISALLOW_COPY_AND_ASSIGN(AthenaWindowTreeClient); | 106 DISALLOW_COPY_AND_ASSIGN(AthenaWindowTreeClient); |
104 }; | 107 }; |
105 | 108 |
106 class AthenaScreenPositionClient : public aura::client::ScreenPositionClient { | 109 class AthenaScreenPositionClient : public aura::client::ScreenPositionClient { |
107 public: | 110 public: |
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
384 } | 387 } |
385 | 388 |
386 // static | 389 // static |
387 void ScreenManager::Shutdown() { | 390 void ScreenManager::Shutdown() { |
388 DCHECK(instance); | 391 DCHECK(instance); |
389 delete instance; | 392 delete instance; |
390 DCHECK(!instance); | 393 DCHECK(!instance); |
391 } | 394 } |
392 | 395 |
393 } // namespace athena | 396 } // namespace athena |
OLD | NEW |