Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(21)

Side by Side Diff: mojo/ui/view_provider_app.h

Issue 2020453003: Convert ViewProviderApp and ContentViewerApp to implement ApplicationImplBase instead of Applicatio… (Closed) Base URL: https://github.com/domokit/mojo.git@work796_no_run_main_app
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « mojo/ui/content_viewer_app.cc ('k') | mojo/ui/view_provider_app.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
11 #include "mojo/public/c/system/main.h" 11 #include "mojo/public/cpp/application/application_impl_base.h"
12 #include "mojo/public/cpp/application/application_delegate.h"
13 #include "mojo/public/cpp/application/application_impl.h"
14 #include "mojo/public/cpp/application/service_provider_impl.h"
15 #include "mojo/public/cpp/system/macros.h" 12 #include "mojo/public/cpp/system/macros.h"
16 #include "mojo/services/ui/views/interfaces/view_provider.mojom.h" 13 #include "mojo/services/ui/views/interfaces/view_provider.mojom.h"
17 14
18 namespace mojo { 15 namespace mojo {
16
17 class ServiceProviderImpl;
18
19 namespace ui { 19 namespace ui {
20 20
21 // Abstract implementation of a simple application that offers a ViewProvider. 21 // Abstract implementation of a simple application that offers a ViewProvider.
22 // Subclasses must provide a function to create the necessary Views. 22 // Subclasses must provide a function to create the necessary Views.
23 // 23 //
24 // It is not necessary to use this class to implement all ViewProviders. 24 // It is not necessary to use this class to implement all ViewProviders.
25 // This class is merely intended to make the simple apps easier to write. 25 // This class is merely intended to make the simple apps easier to write.
26 class ViewProviderApp : public ApplicationDelegate { 26 class ViewProviderApp : public ApplicationImplBase {
27 public: 27 public:
28 ViewProviderApp(); 28 ViewProviderApp();
29 ~ViewProviderApp() override; 29 ~ViewProviderApp() override;
30 30
31 ApplicationImpl* app_impl() { return app_impl_; } 31 // |ApplicationImplBase|:
32 32 void OnInitialize() override;
33 // |ApplicationDelegate|: 33 bool OnAcceptConnection(ServiceProviderImpl* service_provider_impl) override;
34 void Initialize(ApplicationImpl* app) override;
35 bool ConfigureIncomingConnection(
36 ServiceProviderImpl* service_provider_impl) override;
37 34
38 // Called by the ViewProvider to create a view. 35 // Called by the ViewProvider to create a view.
39 // This method may be called multiple times in the case where the 36 // This method may be called multiple times in the case where the
40 // view provider is asked to create multiple view instances. 37 // view provider is asked to create multiple view instances.
41 // 38 //
42 // The |view_provider_url| is the connection URL of the view provider request. 39 // The |view_provider_url| is the connection URL of the view provider request.
43 // 40 //
44 // The |view_owner_request| should be attached to the newly created view 41 // The |view_owner_request| should be attached to the newly created view
45 // and closed or left pending if the view could not be created. 42 // and closed or left pending if the view could not be created.
46 // 43 //
47 // The |services| parameter is used to receive services from the view 44 // The |services| parameter is used to receive services from the view
48 // on behalf of the caller. 45 // on behalf of the caller.
49 virtual void CreateView(const std::string& view_provider_url, 46 virtual void CreateView(const std::string& view_provider_url,
50 InterfaceRequest<ViewOwner> view_owner_request, 47 InterfaceRequest<ViewOwner> view_owner_request,
51 InterfaceRequest<ServiceProvider> services) = 0; 48 InterfaceRequest<ServiceProvider> services) = 0;
52 49
53 private: 50 private:
54 class DelegatingViewProvider; 51 class DelegatingViewProvider;
55 52
56 void CreateView(DelegatingViewProvider* provider, 53 void CreateView(DelegatingViewProvider* provider,
57 const std::string& view_provider_url, 54 const std::string& view_provider_url,
58 InterfaceRequest<ViewOwner> view_owner_request, 55 InterfaceRequest<ViewOwner> view_owner_request,
59 InterfaceRequest<ServiceProvider> services); 56 InterfaceRequest<ServiceProvider> services);
60 57
61 ApplicationImpl* app_impl_ = nullptr;
62 StrongBindingSet<ViewProvider> bindings_; 58 StrongBindingSet<ViewProvider> bindings_;
63 59
64 MOJO_DISALLOW_COPY_AND_ASSIGN(ViewProviderApp); 60 MOJO_DISALLOW_COPY_AND_ASSIGN(ViewProviderApp);
65 }; 61 };
66 62
67 } // namespace ui 63 } // namespace ui
68 } // namespace mojo 64 } // namespace mojo
69 65
70 #endif // MOJO_UI_VIEW_PROVIDER_APP_H_ 66 #endif // MOJO_UI_VIEW_PROVIDER_APP_H_
OLDNEW
« no previous file with comments | « mojo/ui/content_viewer_app.cc ('k') | mojo/ui/view_provider_app.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698