| 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 "mojo/services/window_manager/window_manager_app.h" | 5 #include "mojo/services/window_manager/window_manager_app.h" |
| 6 | 6 |
| 7 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
| 8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
| 9 #include "mojo/aura/aura_init.h" | 9 #include "mojo/aura/aura_init.h" |
| 10 #include "mojo/aura/window_tree_host_mojo.h" | 10 #include "mojo/aura/window_tree_host_mojo.h" |
| 11 #include "mojo/public/cpp/application/application_connection.h" | 11 #include "mojo/public/cpp/application/application_connection.h" |
| 12 #include "mojo/services/public/cpp/view_manager/node.h" | 12 #include "mojo/services/public/cpp/view_manager/node.h" |
| 13 #include "mojo/services/public/cpp/view_manager/view_manager.h" | 13 #include "mojo/services/public/cpp/view_manager/view_manager.h" |
| 14 #include "mojo/services/window_manager/window_manager_service_impl.h" | |
| 15 #include "ui/aura/window.h" | 14 #include "ui/aura/window.h" |
| 16 #include "ui/aura/window_property.h" | 15 #include "ui/aura/window_property.h" |
| 17 #include "ui/wm/core/capture_controller.h" | 16 #include "ui/wm/core/capture_controller.h" |
| 18 #include "ui/wm/core/focus_controller.h" | 17 #include "ui/wm/core/focus_controller.h" |
| 19 #include "ui/wm/core/focus_rules.h" | 18 #include "ui/wm/core/focus_rules.h" |
| 20 #include "ui/wm/public/activation_client.h" | 19 #include "ui/wm/public/activation_client.h" |
| 21 | 20 |
| 22 DECLARE_WINDOW_PROPERTY_TYPE(mojo::view_manager::Node*); | 21 DECLARE_WINDOW_PROPERTY_TYPE(mojo::view_manager::Node*); |
| 23 | 22 |
| 24 namespace mojo { | 23 namespace mojo { |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 } | 63 } |
| 65 | 64 |
| 66 DISALLOW_COPY_AND_ASSIGN(WMFocusRules); | 65 DISALLOW_COPY_AND_ASSIGN(WMFocusRules); |
| 67 }; | 66 }; |
| 68 | 67 |
| 69 } // namespace | 68 } // namespace |
| 70 | 69 |
| 71 //////////////////////////////////////////////////////////////////////////////// | 70 //////////////////////////////////////////////////////////////////////////////// |
| 72 // WindowManagerApp, public: | 71 // WindowManagerApp, public: |
| 73 | 72 |
| 74 WindowManagerApp::WindowManagerApp() : view_manager_(NULL), root_(NULL) {} | 73 WindowManagerApp::WindowManagerApp() |
| 74 : InterfaceFactoryWithContext(this), |
| 75 view_manager_(NULL), |
| 76 view_manager_client_factory_(this), |
| 77 root_(NULL) { |
| 78 } |
| 75 WindowManagerApp::~WindowManagerApp() { | 79 WindowManagerApp::~WindowManagerApp() { |
| 76 // TODO(beng): Figure out if this should be done in | 80 // TODO(beng): Figure out if this should be done in |
| 77 // OnViewManagerDisconnected(). | 81 // OnViewManagerDisconnected(). |
| 78 STLDeleteValues(&node_id_to_window_map_); | 82 STLDeleteValues(&node_id_to_window_map_); |
| 79 if (focus_client_.get()) | 83 if (focus_client_.get()) |
| 80 focus_client_->RemoveObserver(this); | 84 focus_client_->RemoveObserver(this); |
| 81 if (activation_client_) | 85 if (activation_client_) |
| 82 activation_client_->RemoveObserver(this); | 86 activation_client_->RemoveObserver(this); |
| 83 } | 87 } |
| 84 | 88 |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 | 133 |
| 130 //////////////////////////////////////////////////////////////////////////////// | 134 //////////////////////////////////////////////////////////////////////////////// |
| 131 // WindowManagerApp, ApplicationDelegate implementation: | 135 // WindowManagerApp, ApplicationDelegate implementation: |
| 132 | 136 |
| 133 void WindowManagerApp::Initialize(ApplicationImpl* impl) { | 137 void WindowManagerApp::Initialize(ApplicationImpl* impl) { |
| 134 aura_init_.reset(new AuraInit); | 138 aura_init_.reset(new AuraInit); |
| 135 } | 139 } |
| 136 | 140 |
| 137 bool WindowManagerApp::ConfigureIncomingConnection( | 141 bool WindowManagerApp::ConfigureIncomingConnection( |
| 138 ApplicationConnection* connection) { | 142 ApplicationConnection* connection) { |
| 139 connection->AddService<WindowManagerServiceImpl>(this); | 143 connection->AddService(this); |
| 140 view_manager::ViewManager::ConfigureIncomingConnection(connection, this); | 144 connection->AddService(&view_manager_client_factory_); |
| 141 return true; | 145 return true; |
| 142 } | 146 } |
| 143 | 147 |
| 144 //////////////////////////////////////////////////////////////////////////////// | 148 //////////////////////////////////////////////////////////////////////////////// |
| 145 // WindowManagerApp, view_manager::ViewManagerDelegate implementation: | 149 // WindowManagerApp, view_manager::ViewManagerDelegate implementation: |
| 146 | 150 |
| 147 void WindowManagerApp::OnRootAdded(view_manager::ViewManager* view_manager, | 151 void WindowManagerApp::OnRootAdded(view_manager::ViewManager* view_manager, |
| 148 view_manager::Node* root) { | 152 view_manager::Node* root) { |
| 149 DCHECK(!view_manager_ && !root_); | 153 DCHECK(!view_manager_ && !root_); |
| 150 view_manager_ = view_manager; | 154 view_manager_ = view_manager; |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 272 | 276 |
| 273 //////////////////////////////////////////////////////////////////////////////// | 277 //////////////////////////////////////////////////////////////////////////////// |
| 274 // ApplicationDelegate, public: | 278 // ApplicationDelegate, public: |
| 275 | 279 |
| 276 // static | 280 // static |
| 277 ApplicationDelegate* ApplicationDelegate::Create() { | 281 ApplicationDelegate* ApplicationDelegate::Create() { |
| 278 return new WindowManagerApp; | 282 return new WindowManagerApp; |
| 279 } | 283 } |
| 280 | 284 |
| 281 } // namespace mojo | 285 } // namespace mojo |
| OLD | NEW |