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 MOJO_UI_VIEW_PROVIDER_APP_H_ | 5 #ifndef MOJO_UI_VIEW_PROVIDER_APP_H_ |
6 #define MOJO_UI_VIEW_PROVIDER_APP_H_ | 6 #define MOJO_UI_VIEW_PROVIDER_APP_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "mojo/common/strong_binding_set.h" | 10 #include "mojo/common/strong_binding_set.h" |
(...skipping 24 matching lines...) Expand all Loading... |
35 void Initialize(mojo::ApplicationImpl* app) override; | 35 void Initialize(mojo::ApplicationImpl* app) override; |
36 bool ConfigureIncomingConnection( | 36 bool ConfigureIncomingConnection( |
37 mojo::ApplicationConnection* connection) override; | 37 mojo::ApplicationConnection* connection) override; |
38 | 38 |
39 // Called by the ViewProvider to create a view. | 39 // Called by the ViewProvider to create a view. |
40 // This method may be called multiple times in the case where the | 40 // This method may be called multiple times in the case where the |
41 // view provider is asked to create multiple view instances. | 41 // view provider is asked to create multiple view instances. |
42 // | 42 // |
43 // The |view_provider_url| is the connection URL of the view provider request. | 43 // The |view_provider_url| is the connection URL of the view provider request. |
44 // | 44 // |
45 // Returns true if successful, false if the view could not be created. | 45 // The |view_owner_request| should be attached to the newly created view |
46 virtual bool CreateView( | 46 // and closed or left pending if the view could not be created. |
| 47 // |
| 48 // The |services| parameter is used to receive services from the view |
| 49 // on behalf of the caller. |
| 50 // |
| 51 // The |exposed_services| parameters is used to provide services to |
| 52 // the view from the caller. |
| 53 virtual void CreateView( |
47 const std::string& view_provider_url, | 54 const std::string& view_provider_url, |
| 55 mojo::InterfaceRequest<mojo::ui::ViewOwner> view_owner_request, |
48 mojo::InterfaceRequest<mojo::ServiceProvider> services, | 56 mojo::InterfaceRequest<mojo::ServiceProvider> services, |
49 mojo::ServiceProviderPtr exposed_services, | 57 mojo::ServiceProviderPtr exposed_services) = 0; |
50 const mojo::ui::ViewProvider::CreateViewCallback& callback) = 0; | |
51 | 58 |
52 private: | 59 private: |
53 class DelegatingViewProvider; | 60 class DelegatingViewProvider; |
54 | 61 |
55 // |InterfaceFactory<mojo::ui::ViewProvider>|: | 62 // |InterfaceFactory<mojo::ui::ViewProvider>|: |
56 void Create(mojo::ApplicationConnection* connection, | 63 void Create(mojo::ApplicationConnection* connection, |
57 mojo::InterfaceRequest<mojo::ui::ViewProvider> request) override; | 64 mojo::InterfaceRequest<mojo::ui::ViewProvider> request) override; |
58 | 65 |
59 void CreateView(DelegatingViewProvider* provider, | 66 void CreateView( |
60 const std::string& view_provider_url, | 67 DelegatingViewProvider* provider, |
61 mojo::InterfaceRequest<mojo::ServiceProvider> services, | 68 const std::string& view_provider_url, |
62 mojo::ServiceProviderPtr exposed_services, | 69 mojo::InterfaceRequest<mojo::ui::ViewOwner> view_owner_request, |
63 const mojo::ui::ViewProvider::CreateViewCallback& callback); | 70 mojo::InterfaceRequest<mojo::ServiceProvider> services, |
| 71 mojo::ServiceProviderPtr exposed_services); |
64 | 72 |
65 mojo::ApplicationImpl* app_impl_ = nullptr; | 73 mojo::ApplicationImpl* app_impl_ = nullptr; |
66 mojo::StrongBindingSet<mojo::ui::ViewProvider> bindings_; | 74 mojo::StrongBindingSet<mojo::ui::ViewProvider> bindings_; |
67 | 75 |
68 MOJO_DISALLOW_COPY_AND_ASSIGN(ViewProviderApp); | 76 MOJO_DISALLOW_COPY_AND_ASSIGN(ViewProviderApp); |
69 }; | 77 }; |
70 | 78 |
71 } // namespace ui | 79 } // namespace ui |
72 } // namespace mojo | 80 } // namespace mojo |
73 | 81 |
74 #endif // MOJO_UI_VIEW_PROVIDER_APP_H_ | 82 #endif // MOJO_UI_VIEW_PROVIDER_APP_H_ |
OLD | NEW |