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 #ifndef MOJO_SERVICES_WINDOW_MANAGER_WINDOW_MANAGER_APP_H_ | 5 #ifndef MOJO_SERVICES_WINDOW_MANAGER_WINDOW_MANAGER_APP_H_ |
6 #define MOJO_SERVICES_WINDOW_MANAGER_WINDOW_MANAGER_APP_H_ | 6 #define MOJO_SERVICES_WINDOW_MANAGER_WINDOW_MANAGER_APP_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 24 matching lines...) Expand all Loading... |
35 class WindowManagerServiceImpl; | 35 class WindowManagerServiceImpl; |
36 class WindowTreeHostMojo; | 36 class WindowTreeHostMojo; |
37 | 37 |
38 class WindowManagerApp : public ApplicationDelegate, | 38 class WindowManagerApp : public ApplicationDelegate, |
39 public view_manager::ViewManagerDelegate, | 39 public view_manager::ViewManagerDelegate, |
40 public view_manager::NodeObserver, | 40 public view_manager::NodeObserver, |
41 public WindowTreeHostMojoDelegate, | 41 public WindowTreeHostMojoDelegate, |
42 public aura::client::FocusChangeObserver, | 42 public aura::client::FocusChangeObserver, |
43 public aura::client::ActivationChangeObserver { | 43 public aura::client::ActivationChangeObserver { |
44 public: | 44 public: |
45 WindowManagerApp(); | 45 explicit WindowManagerApp(view_manager::ViewManagerDelegate* delegate); |
46 virtual ~WindowManagerApp(); | 46 virtual ~WindowManagerApp(); |
47 | 47 |
48 void AddConnection(WindowManagerServiceImpl* connection); | 48 void AddConnection(WindowManagerServiceImpl* connection); |
49 void RemoveConnection(WindowManagerServiceImpl* connection); | 49 void RemoveConnection(WindowManagerServiceImpl* connection); |
50 | 50 |
51 view_manager::Id OpenWindow(); | 51 view_manager::Id OpenWindow(); |
52 view_manager::Id OpenWindowWithURL(const String& url); | 52 view_manager::Id OpenWindowWithURL(const String& url); |
53 void SetCapture(view_manager::Id node); | 53 void SetCapture(view_manager::Id node); |
54 void FocusWindow(view_manager::Id node); | 54 void FocusWindow(view_manager::Id node); |
55 void ActivateWindow(view_manager::Id node); | 55 void ActivateWindow(view_manager::Id node); |
56 | 56 |
57 bool IsReady() const; | 57 bool IsReady() const; |
58 | 58 |
59 private: | |
60 typedef std::set<WindowManagerServiceImpl*> Connections; | |
61 typedef std::map<view_manager::Id, aura::Window*> NodeIdToWindowMap; | |
62 | |
63 // Overridden from ApplicationDelegate: | 59 // Overridden from ApplicationDelegate: |
64 virtual void Initialize(ApplicationImpl* impl) MOJO_OVERRIDE; | 60 virtual void Initialize(ApplicationImpl* impl) MOJO_OVERRIDE; |
65 virtual bool ConfigureIncomingConnection(ApplicationConnection* connection) | 61 virtual bool ConfigureIncomingConnection(ApplicationConnection* connection) |
66 MOJO_OVERRIDE; | 62 MOJO_OVERRIDE; |
67 | 63 |
| 64 private: |
| 65 typedef std::set<WindowManagerServiceImpl*> Connections; |
| 66 typedef std::map<view_manager::Id, aura::Window*> NodeIdToWindowMap; |
| 67 |
68 // Overridden from view_manager::ViewManagerDelegate: | 68 // Overridden from view_manager::ViewManagerDelegate: |
69 virtual void OnRootAdded(view_manager::ViewManager* view_manager, | 69 virtual void OnRootAdded(view_manager::ViewManager* view_manager, |
70 view_manager::Node* root) MOJO_OVERRIDE; | 70 view_manager::Node* root) MOJO_OVERRIDE; |
71 virtual void OnViewManagerDisconnected( | 71 virtual void OnViewManagerDisconnected( |
72 view_manager::ViewManager* view_manager) MOJO_OVERRIDE; | 72 view_manager::ViewManager* view_manager) MOJO_OVERRIDE; |
73 | 73 |
74 // Overridden from view_manager::NodeObserver: | 74 // Overridden from view_manager::NodeObserver: |
75 virtual void OnTreeChanged( | 75 virtual void OnTreeChanged( |
76 const view_manager::NodeObserver::TreeChangeParams& params) MOJO_OVERRIDE; | 76 const view_manager::NodeObserver::TreeChangeParams& params) MOJO_OVERRIDE; |
77 | 77 |
(...skipping 12 matching lines...) Expand all Loading... |
90 | 90 |
91 // Creates an aura::Window for every node in the hierarchy beneath |id|, | 91 // Creates an aura::Window for every node in the hierarchy beneath |id|, |
92 // and adds to the registry so that it can be retrieved later via | 92 // and adds to the registry so that it can be retrieved later via |
93 // GetWindowForNodeId(). | 93 // GetWindowForNodeId(). |
94 // TODO(beng): perhaps Node should have a property bag. | 94 // TODO(beng): perhaps Node should have a property bag. |
95 void RegisterSubtree(view_manager::Id id, aura::Window* parent); | 95 void RegisterSubtree(view_manager::Id id, aura::Window* parent); |
96 // Deletes the aura::Windows associated with the hierarchy beneath |id|, | 96 // Deletes the aura::Windows associated with the hierarchy beneath |id|, |
97 // and removes from the registry. | 97 // and removes from the registry. |
98 void UnregisterSubtree(view_manager::Id id); | 98 void UnregisterSubtree(view_manager::Id id); |
99 | 99 |
| 100 view_manager::ViewManagerDelegate* wrapped_delegate_; |
| 101 |
100 view_manager::ViewManager* view_manager_; | 102 view_manager::ViewManager* view_manager_; |
101 view_manager::Node* root_; | 103 view_manager::Node* root_; |
102 | 104 |
103 scoped_ptr<AuraInit> aura_init_; | 105 scoped_ptr<AuraInit> aura_init_; |
104 scoped_ptr<WindowTreeHostMojo> window_tree_host_; | 106 scoped_ptr<WindowTreeHostMojo> window_tree_host_; |
105 | 107 |
106 scoped_ptr<wm::ScopedCaptureClient> capture_client_; | 108 scoped_ptr<wm::ScopedCaptureClient> capture_client_; |
107 scoped_ptr<aura::client::FocusClient> focus_client_; | 109 scoped_ptr<aura::client::FocusClient> focus_client_; |
108 aura::client::ActivationClient* activation_client_; | 110 aura::client::ActivationClient* activation_client_; |
109 | 111 |
110 Connections connections_; | 112 Connections connections_; |
111 NodeIdToWindowMap node_id_to_window_map_; | 113 NodeIdToWindowMap node_id_to_window_map_; |
112 | 114 |
113 DISALLOW_COPY_AND_ASSIGN(WindowManagerApp); | 115 DISALLOW_COPY_AND_ASSIGN(WindowManagerApp); |
114 }; | 116 }; |
115 | 117 |
116 } // namespace mojo | 118 } // namespace mojo |
117 | 119 |
118 #endif // MOJO_SERVICES_WINDOW_MANAGER_WINDOW_MANAGER_APP_H_ | 120 #endif // MOJO_SERVICES_WINDOW_MANAGER_WINDOW_MANAGER_APP_H_ |
OLD | NEW |