| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 COMPONENTS_VIEW_MANAGER_PUBLIC_CPP_VIEW_MANAGER_INIT_H_ | 5 #ifndef COMPONENTS_VIEW_MANAGER_PUBLIC_CPP_VIEW_MANAGER_INIT_H_ |
| 6 #define COMPONENTS_VIEW_MANAGER_PUBLIC_CPP_VIEW_MANAGER_INIT_H_ | 6 #define COMPONENTS_VIEW_MANAGER_PUBLIC_CPP_VIEW_MANAGER_INIT_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "components/view_manager/public/interfaces/view_manager.mojom.h" | |
| 11 #include "components/view_manager/public/interfaces/view_manager_root.mojom.h" | 10 #include "components/view_manager/public/interfaces/view_manager_root.mojom.h" |
| 11 #include "components/view_manager/public/interfaces/view_tree.mojom.h" |
| 12 #include "third_party/mojo/src/mojo/public/cpp/bindings/binding.h" | 12 #include "third_party/mojo/src/mojo/public/cpp/bindings/binding.h" |
| 13 | 13 |
| 14 namespace mojo { | 14 namespace mojo { |
| 15 | 15 |
| 16 class ApplicationConnection; | 16 class ApplicationConnection; |
| 17 class ApplicationImpl; | 17 class ApplicationImpl; |
| 18 class ViewManagerDelegate; | 18 class ViewManagerDelegate; |
| 19 | 19 |
| 20 // ViewManagerInit is used to establish the initial connection to the | 20 // ViewManagerInit is used to establish the initial connection to the |
| 21 // ViewManager. Use it when you know the ViewManager is not running and you're | 21 // ViewManager. Use it when you know the ViewManager is not running and you're |
| 22 // app is going to be the first one to contact it. | 22 // app is going to be the first one to contact it. |
| 23 class ViewManagerInit { | 23 class ViewManagerInit { |
| 24 public: | 24 public: |
| 25 // |root_client| is optional. | 25 // |root_client| is optional. |
| 26 ViewManagerInit(ApplicationImpl* app, | 26 ViewManagerInit(ApplicationImpl* app, |
| 27 ViewManagerDelegate* delegate, | 27 ViewManagerDelegate* delegate, |
| 28 ViewManagerRootClient* root_client); | 28 ViewManagerRootClient* root_client); |
| 29 ~ViewManagerInit(); | 29 ~ViewManagerInit(); |
| 30 | 30 |
| 31 // Returns the ViewManagerRoot. This is only valid if |root_client| was | 31 // Returns the ViewManagerRoot. This is only valid if |root_client| was |
| 32 // supplied to the constructor. | 32 // supplied to the constructor. |
| 33 ViewManagerRoot* view_manager_root() { return view_manager_root_.get(); } | 33 ViewManagerRoot* view_manager_root() { return view_manager_root_.get(); } |
| 34 | 34 |
| 35 // Returns the application connection established with the view manager. | 35 // Returns the application connection established with the view manager. |
| 36 ApplicationConnection* connection() { return connection_.get(); } | 36 ApplicationConnection* connection() { return connection_.get(); } |
| 37 | 37 |
| 38 private: | 38 private: |
| 39 class ClientFactory; | 39 class ClientFactory; |
| 40 | 40 |
| 41 void OnCreate(InterfaceRequest<ViewManagerClient> request); | 41 void OnCreate(InterfaceRequest<ViewTreeClient> request); |
| 42 | 42 |
| 43 ApplicationImpl* app_; | 43 ApplicationImpl* app_; |
| 44 scoped_ptr<ApplicationConnection> connection_; | 44 scoped_ptr<ApplicationConnection> connection_; |
| 45 ViewManagerDelegate* delegate_; | 45 ViewManagerDelegate* delegate_; |
| 46 scoped_ptr<ClientFactory> client_factory_; | 46 scoped_ptr<ClientFactory> client_factory_; |
| 47 ViewManagerRootPtr view_manager_root_; | 47 ViewManagerRootPtr view_manager_root_; |
| 48 scoped_ptr<Binding<ViewManagerRootClient>> root_client_binding_; | 48 scoped_ptr<Binding<ViewManagerRootClient>> root_client_binding_; |
| 49 | 49 |
| 50 DISALLOW_COPY_AND_ASSIGN(ViewManagerInit); | 50 DISALLOW_COPY_AND_ASSIGN(ViewManagerInit); |
| 51 }; | 51 }; |
| 52 | 52 |
| 53 } // namespace mojo | 53 } // namespace mojo |
| 54 | 54 |
| 55 #endif // COMPONENTS_VIEW_MANAGER_PUBLIC_CPP_VIEW_MANAGER_INIT_H_ | 55 #endif // COMPONENTS_VIEW_MANAGER_PUBLIC_CPP_VIEW_MANAGER_INIT_H_ |
| OLD | NEW |