| 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 COMPONENTS_VIEW_MANAGER_PUBLIC_CPP_VIEW_MANAGER_DELEGATE_H_ | 5 #ifndef COMPONENTS_VIEW_MANAGER_PUBLIC_CPP_VIEW_MANAGER_DELEGATE_H_ |
| 6 #define COMPONENTS_VIEW_MANAGER_PUBLIC_CPP_VIEW_MANAGER_DELEGATE_H_ | 6 #define COMPONENTS_VIEW_MANAGER_PUBLIC_CPP_VIEW_MANAGER_DELEGATE_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "components/view_manager/public/interfaces/view_manager.mojom.h" |
| 10 #include "mojo/application/public/interfaces/service_provider.mojom.h" | 11 #include "mojo/application/public/interfaces/service_provider.mojom.h" |
| 12 #include "mojo/services/network/public/interfaces/url_loader.mojom.h" |
| 11 | 13 |
| 12 namespace mojo { | 14 namespace mojo { |
| 13 | 15 |
| 14 class View; | 16 class View; |
| 15 class ViewManager; | 17 class ViewManager; |
| 16 | 18 |
| 17 // Interface implemented by an application using the view manager. | 19 // Interface implemented by an application using the view manager. |
| 18 // | 20 // |
| 19 // Each call to OnEmbed() results in a new ViewManager and new root View. | 21 // Each call to OnEmbed() results in a new ViewManager and new root View. |
| 20 // ViewManager is deleted by any of the following: | 22 // ViewManager is deleted by any of the following: |
| (...skipping 13 matching lines...) Expand all Loading... |
| 34 // | 36 // |
| 35 // |services| exposes the services offered by the embedder to the delegate. | 37 // |services| exposes the services offered by the embedder to the delegate. |
| 36 // | 38 // |
| 37 // |exposed_services| is an object that the delegate can add services to | 39 // |exposed_services| is an object that the delegate can add services to |
| 38 // expose to the embedder. | 40 // expose to the embedder. |
| 39 // | 41 // |
| 40 // Note that if a different application is subsequently embedded at |root|, | 42 // Note that if a different application is subsequently embedded at |root|, |
| 41 // the pipes connecting |services| and |exposed_services| to the embedder and | 43 // the pipes connecting |services| and |exposed_services| to the embedder and |
| 42 // any services obtained from them are not broken and will continue to be | 44 // any services obtained from them are not broken and will continue to be |
| 43 // valid. | 45 // valid. |
| 44 virtual void OnEmbed(View* root, | 46 virtual void OnEmbed(View* root) = 0; |
| 45 InterfaceRequest<ServiceProvider> services, | |
| 46 ServiceProviderPtr exposed_services) = 0; | |
| 47 | 47 |
| 48 // Only invoked if the connection has been marked as an embed root. This | 48 // Only invoked if the connection has been marked as an embed root. This |
| 49 // allows the delegate to disallow the embed (return false), or change | 49 // allows the delegate to disallow the embed (return false), or change |
| 50 // the ServiceProviders that would be exposed to the new client. | 50 // the ServiceProviders that would be exposed to the new client. |
| 51 // | 51 // |
| 52 // This implementation returns true (allowing the embed), and does not alter | 52 // This implementation returns true (allowing the embed), and does not alter |
| 53 // the supplied ServiceProviders. | 53 // the supplied ServiceProviders. |
| 54 // | 54 // |
| 55 // See the mojom for more details. | 55 // See the mojom for more details. |
| 56 virtual bool OnWillEmbed(View* view, | 56 virtual void OnEmbedForDescendant(View* view, |
| 57 InterfaceRequest<ServiceProvider>* services, | 57 URLRequestPtr request, |
| 58 ServiceProviderPtr* exposed_services); | 58 ViewManagerClientPtr* client); |
| 59 | 59 |
| 60 // Called from the destructor of ViewManager after all the Views have been | 60 // Called from the destructor of ViewManager after all the Views have been |
| 61 // destroyed. |view_manager| is no longer valid after this call. | 61 // destroyed. |view_manager| is no longer valid after this call. |
| 62 virtual void OnViewManagerDestroyed(ViewManager* view_manager) = 0; | 62 virtual void OnViewManagerDestroyed(ViewManager* view_manager) = 0; |
| 63 | 63 |
| 64 protected: | 64 protected: |
| 65 virtual ~ViewManagerDelegate() {} | 65 virtual ~ViewManagerDelegate() {} |
| 66 }; | 66 }; |
| 67 | 67 |
| 68 } // namespace mojo | 68 } // namespace mojo |
| 69 | 69 |
| 70 #endif // COMPONENTS_VIEW_MANAGER_PUBLIC_CPP_VIEW_MANAGER_DELEGATE_H_ | 70 #endif // COMPONENTS_VIEW_MANAGER_PUBLIC_CPP_VIEW_MANAGER_DELEGATE_H_ |
| OLD | NEW |