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_VIEW_MANAGER_PUBLIC_CPP_VIEW_MANAGER_DELEGATE_H_ | 5 #ifndef MOJO_SERVICES_VIEW_MANAGER_PUBLIC_CPP_VIEW_MANAGER_DELEGATE_H_ |
6 #define MOJO_SERVICES_VIEW_MANAGER_PUBLIC_CPP_VIEW_MANAGER_DELEGATE_H_ | 6 #define MOJO_SERVICES_VIEW_MANAGER_PUBLIC_CPP_VIEW_MANAGER_DELEGATE_H_ |
7 | 7 |
8 #include "base/memory/scoped_ptr.h" | |
9 #include "mojo/public/interfaces/application/service_provider.mojom.h" | 8 #include "mojo/public/interfaces/application/service_provider.mojom.h" |
10 | 9 |
11 namespace mojo { | 10 namespace mojo { |
12 | 11 |
13 class ServiceProviderImpl; | |
14 class View; | 12 class View; |
15 class ViewManager; | 13 class ViewManager; |
16 | 14 |
17 // Interface implemented by an application using the view manager. | 15 // Interface implemented by an application using the view manager. |
18 class ViewManagerDelegate { | 16 class ViewManagerDelegate { |
19 public: | 17 public: |
20 // Called when the application implementing this interface is embedded at | 18 // Called when the application implementing this interface is embedded at |
21 // |root|. Every embed results in a new ViewManager and root View being | 19 // |root|. Every embed results in a new ViewManager and root View being |
22 // created. |root| and it's corresponding ViewManager are valid until | 20 // created. |root| and it's corresponding ViewManager are valid until |
23 // OnViewManagerDisconnected() is called with the same object. | 21 // OnViewManagerDisconnected() is called with the same object. |
24 // | 22 // |
25 // |exported_services| is an object that the delegate can add services to | 23 // |services| exposes the services offered by the embedder to the delegate. |
26 // expose to the embedder. |imported_services| exposes the services offered by | 24 // |
27 // the embedder to the delegate. Note that if a different application is | 25 // |exposed_services| is an object that the delegate can add services to |
28 // subsequently embedded at |root|, the pipe(s) connecting |imported_services| | 26 // expose to the embedder. |
29 // to the embedder and any services obtained from it are not broken and will | 27 // |
30 // continue to be valid. | 28 // Note that if a different application is subsequently embedded at |root|, |
| 29 // the pipes connecting |services| and |exposed_services| to the embedder and |
| 30 // any services obtained from them are not broken and will continue to be |
| 31 // valid. |
31 virtual void OnEmbed(View* root, | 32 virtual void OnEmbed(View* root, |
32 ServiceProviderImpl* exported_services, | 33 InterfaceRequest<ServiceProvider> services, |
33 scoped_ptr<ServiceProvider> imported_services) = 0; | 34 ServiceProviderPtr exposed_services) = 0; |
34 | 35 |
35 // Called when a connection to the view manager service is closed. | 36 // Called when a connection to the view manager service is closed. |
36 // |view_manager| is not valid after this function returns. | 37 // |view_manager| is not valid after this function returns. |
37 virtual void OnViewManagerDisconnected(ViewManager* view_manager) = 0; | 38 virtual void OnViewManagerDisconnected(ViewManager* view_manager) = 0; |
38 | 39 |
39 protected: | 40 protected: |
40 virtual ~ViewManagerDelegate() {} | 41 virtual ~ViewManagerDelegate() {} |
41 }; | 42 }; |
42 | 43 |
43 } // namespace mojo | 44 } // namespace mojo |
44 | 45 |
45 #endif // MOJO_SERVICES_VIEW_MANAGER_PUBLIC_CPP_VIEW_MANAGER_DELEGATE_H_ | 46 #endif // MOJO_SERVICES_VIEW_MANAGER_PUBLIC_CPP_VIEW_MANAGER_DELEGATE_H_ |
OLD | NEW |