| 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 class WindowManagerApp | 57 class WindowManagerApp |
| 58 : public ApplicationDelegate, | 58 : public ApplicationDelegate, |
| 59 public ViewManagerDelegate, | 59 public ViewManagerDelegate, |
| 60 public ViewObserver, | 60 public ViewObserver, |
| 61 public ui::EventHandler, | 61 public ui::EventHandler, |
| 62 public aura::client::FocusChangeObserver, | 62 public aura::client::FocusChangeObserver, |
| 63 public aura::client::ActivationChangeObserver { | 63 public aura::client::ActivationChangeObserver { |
| 64 public: | 64 public: |
| 65 WindowManagerApp(ViewManagerDelegate* view_manager_delegate, | 65 WindowManagerApp(ViewManagerDelegate* view_manager_delegate, |
| 66 WindowManagerDelegate* window_manager_delegate); | 66 WindowManagerDelegate* window_manager_delegate); |
| 67 virtual ~WindowManagerApp(); | 67 ~WindowManagerApp() override; |
| 68 | 68 |
| 69 static View* GetViewForWindow(aura::Window* window); | 69 static View* GetViewForWindow(aura::Window* window); |
| 70 aura::Window* GetWindowForViewId(Id view); | 70 aura::Window* GetWindowForViewId(Id view); |
| 71 | 71 |
| 72 // Register/deregister new connections to the window manager service. | 72 // Register/deregister new connections to the window manager service. |
| 73 void AddConnection(WindowManagerService2Impl* connection); | 73 void AddConnection(WindowManagerService2Impl* connection); |
| 74 void RemoveConnection(WindowManagerService2Impl* connection); | 74 void RemoveConnection(WindowManagerService2Impl* connection); |
| 75 | 75 |
| 76 // These are canonical implementations of the window manager API methods. | 76 // These are canonical implementations of the window manager API methods. |
| 77 void SetCapture(Id view); | 77 void SetCapture(Id view); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 88 return window_manager_delegate_; | 88 return window_manager_delegate_; |
| 89 } | 89 } |
| 90 | 90 |
| 91 void InitFocus(wm::FocusRules* rules); | 91 void InitFocus(wm::FocusRules* rules); |
| 92 | 92 |
| 93 void set_window_manager_client(WindowManagerClient* client) { | 93 void set_window_manager_client(WindowManagerClient* client) { |
| 94 window_manager_client_ = client; | 94 window_manager_client_ = client; |
| 95 } | 95 } |
| 96 | 96 |
| 97 // Overridden from ApplicationDelegate: | 97 // Overridden from ApplicationDelegate: |
| 98 virtual void Initialize(ApplicationImpl* impl) override; | 98 void Initialize(ApplicationImpl* impl) override; |
| 99 virtual bool ConfigureIncomingConnection( | 99 bool ConfigureIncomingConnection(ApplicationConnection* connection) override; |
| 100 ApplicationConnection* connection) override; | |
| 101 | 100 |
| 102 private: | 101 private: |
| 103 typedef std::set<WindowManagerService2Impl*> Connections; | 102 typedef std::set<WindowManagerService2Impl*> Connections; |
| 104 typedef std::map<Id, aura::Window*> ViewIdToWindowMap; | 103 typedef std::map<Id, aura::Window*> ViewIdToWindowMap; |
| 105 | 104 |
| 106 // Overridden from ViewManagerDelegate: | 105 // Overridden from ViewManagerDelegate: |
| 107 virtual void OnEmbed(ViewManager* view_manager, | 106 void OnEmbed(ViewManager* view_manager, |
| 108 View* root, | 107 View* root, |
| 109 ServiceProviderImpl* exported_services, | 108 ServiceProviderImpl* exported_services, |
| 110 scoped_ptr<ServiceProvider> imported_services) override; | 109 scoped_ptr<ServiceProvider> imported_services) override; |
| 111 virtual void OnViewManagerDisconnected(ViewManager* view_manager) override; | 110 void OnViewManagerDisconnected(ViewManager* view_manager) override; |
| 112 | 111 |
| 113 // Overridden from ViewObserver: | 112 // Overridden from ViewObserver: |
| 114 virtual void OnTreeChanged( | 113 void OnTreeChanged(const ViewObserver::TreeChangeParams& params) override; |
| 115 const ViewObserver::TreeChangeParams& params) override; | 114 void OnViewDestroying(View* view) override; |
| 116 virtual void OnViewDestroying(View* view) override; | 115 void OnViewBoundsChanged(View* view, |
| 117 virtual void OnViewBoundsChanged(View* view, | 116 const gfx::Rect& old_bounds, |
| 118 const gfx::Rect& old_bounds, | 117 const gfx::Rect& new_bounds) override; |
| 119 const gfx::Rect& new_bounds) override; | |
| 120 | 118 |
| 121 // Overridden from ui::EventHandler: | 119 // Overridden from ui::EventHandler: |
| 122 virtual void OnEvent(ui::Event* event) override; | 120 void OnEvent(ui::Event* event) override; |
| 123 | 121 |
| 124 // Overridden from aura::client::FocusChangeObserver: | 122 // Overridden from aura::client::FocusChangeObserver: |
| 125 virtual void OnWindowFocused(aura::Window* gained_focus, | 123 void OnWindowFocused(aura::Window* gained_focus, |
| 126 aura::Window* lost_focus) override; | 124 aura::Window* lost_focus) override; |
| 127 | 125 |
| 128 // Overridden from aura::client::ActivationChangeObserver: | 126 // Overridden from aura::client::ActivationChangeObserver: |
| 129 virtual void OnWindowActivated(aura::Window* gained_active, | 127 void OnWindowActivated(aura::Window* gained_active, |
| 130 aura::Window* lost_active) override; | 128 aura::Window* lost_active) override; |
| 131 | 129 |
| 132 // Creates an aura::Window for every view in the hierarchy beneath |view|, | 130 // Creates an aura::Window for every view in the hierarchy beneath |view|, |
| 133 // and adds to the registry so that it can be retrieved later via | 131 // and adds to the registry so that it can be retrieved later via |
| 134 // GetWindowForViewId(). | 132 // GetWindowForViewId(). |
| 135 // TODO(beng): perhaps View should have a property bag. | 133 // TODO(beng): perhaps View should have a property bag. |
| 136 void RegisterSubtree(View* view, aura::Window* parent); | 134 void RegisterSubtree(View* view, aura::Window* parent); |
| 137 // Recursively invokes Unregister() for |view| and all its descendants. | 135 // Recursively invokes Unregister() for |view| and all its descendants. |
| 138 void UnregisterSubtree(View* view); | 136 void UnregisterSubtree(View* view); |
| 139 // Deletes the aura::Windows associated with the hierarchy beneath |id|, | 137 // Deletes the aura::Windows associated with the hierarchy beneath |id|, |
| 140 // and removes from the registry. | 138 // and removes from the registry. |
| (...skipping 27 matching lines...) Expand all Loading... |
| 168 scoped_ptr<DummyDelegate> dummy_delegate_; | 166 scoped_ptr<DummyDelegate> dummy_delegate_; |
| 169 | 167 |
| 170 WindowManagerClient* window_manager_client_; | 168 WindowManagerClient* window_manager_client_; |
| 171 | 169 |
| 172 DISALLOW_COPY_AND_ASSIGN(WindowManagerApp); | 170 DISALLOW_COPY_AND_ASSIGN(WindowManagerApp); |
| 173 }; | 171 }; |
| 174 | 172 |
| 175 } // namespace mojo | 173 } // namespace mojo |
| 176 | 174 |
| 177 #endif // MOJO_SERVICES_WINDOW_MANAGER_WINDOW_MANAGER_APP_H_ | 175 #endif // MOJO_SERVICES_WINDOW_MANAGER_WINDOW_MANAGER_APP_H_ |
| OLD | NEW |