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

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

Issue 1975253002: ApplicationConnection devolution, part 2.1. (Closed) Base URL: https://github.com/domokit/mojo.git@work792-x-work791_service_registry_spimpl
Patch Set: Created 4 years, 7 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
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_CONTENT_VIEWER_APP_H_ 5 #ifndef MOJO_UI_CONTENT_VIEWER_APP_H_
6 #define MOJO_UI_CONTENT_VIEWER_APP_H_ 6 #define MOJO_UI_CONTENT_VIEWER_APP_H_
7 7
8 #include "mojo/common/strong_binding_set.h" 8 #include "mojo/common/strong_binding_set.h"
9 #include "mojo/services/content_handler/interfaces/content_handler.mojom.h" 9 #include "mojo/services/content_handler/interfaces/content_handler.mojom.h"
10 #include "mojo/ui/view_provider_app.h" 10 #include "mojo/ui/view_provider_app.h"
11 11
12 namespace mojo { 12 namespace mojo {
13 namespace ui { 13 namespace ui {
14 14
15 // A simple ContentHandler application implementation for rendering 15 // A simple ContentHandler application implementation for rendering
16 // content as Views. Subclasses must provide a function to create 16 // content as Views. Subclasses must provide a function to create
17 // the view provider application on demand. 17 // the view provider application on demand.
18 // 18 //
19 // TODO(jeffbrown): Support creating the view provider application in a 19 // TODO(jeffbrown): Support creating the view provider application in a
20 // separate thread if desired (often not the case). This is one reason 20 // separate thread if desired (often not the case). This is one reason
21 // we are not using the ContentHandlerFactory here. 21 // we are not using the ContentHandlerFactory here.
22 class ContentViewerApp : public ApplicationDelegate, 22 class ContentViewerApp : public ApplicationDelegate {
23 public InterfaceFactory<ContentHandler> {
24 public: 23 public:
25 ContentViewerApp(); 24 ContentViewerApp();
26 ~ContentViewerApp() override; 25 ~ContentViewerApp() override;
27 26
28 ApplicationImpl* app_impl() { return app_impl_; } 27 ApplicationImpl* app_impl() { return app_impl_; }
29 28
30 // |ApplicationDelegate|: 29 // |ApplicationDelegate|:
31 void Initialize(ApplicationImpl* app) override; 30 void Initialize(ApplicationImpl* app) override;
32 bool ConfigureIncomingConnection(ApplicationConnection* connection) override; 31 bool ConfigureIncomingConnection(ApplicationConnection* connection) override;
33 32
34 // Called to create the view provider application to view the content. 33 // Called to create the view provider application to view the content.
35 // 34 //
36 // This method may be called multiple times to load different content 35 // This method may be called multiple times to load different content
37 // into separate view providers. The view provider implementation should 36 // into separate view providers. The view provider implementation should
38 // cache the loaded content in case it is asked to create multiple instances 37 // cache the loaded content in case it is asked to create multiple instances
39 // of the view since the response can only be consumed once. 38 // of the view since the response can only be consumed once.
40 // 39 //
41 // The |content_handler_url| is the connection URL of the content handler 40 // The |content_handler_url| is the connection URL of the content handler
42 // request. 41 // request.
43 // The |response| carries the data retrieved by the content handler. 42 // The |response| carries the data retrieved by the content handler.
44 // 43 //
45 // Returns the view provider application delegate to view the content, 44 // Returns the view provider application delegate to view the content,
46 // or nullptr if the content could not be loaded. 45 // or nullptr if the content could not be loaded.
47 virtual ViewProviderApp* LoadContent(const std::string& content_handler_url, 46 virtual ViewProviderApp* LoadContent(const std::string& content_handler_url,
48 URLResponsePtr response) = 0; 47 URLResponsePtr response) = 0;
49 48
50 private: 49 private:
51 class DelegatingContentHandler; 50 class DelegatingContentHandler;
52 51
53 // |InterfaceFactory<ContentHandler>|:
54 void Create(const ConnectionContext& connection_context,
55 InterfaceRequest<ContentHandler> request) override;
56
57 void StartViewer(const std::string& content_handler_url, 52 void StartViewer(const std::string& content_handler_url,
58 InterfaceRequest<Application> application_request, 53 InterfaceRequest<Application> application_request,
59 URLResponsePtr response); 54 URLResponsePtr response);
60 55
61 ApplicationImpl* app_impl_ = nullptr; 56 ApplicationImpl* app_impl_ = nullptr;
62 StrongBindingSet<ContentHandler> bindings_; 57 StrongBindingSet<ContentHandler> bindings_;
63 58
64 MOJO_DISALLOW_COPY_AND_ASSIGN(ContentViewerApp); 59 MOJO_DISALLOW_COPY_AND_ASSIGN(ContentViewerApp);
65 }; 60 };
66 61
67 } // namespace ui 62 } // namespace ui
68 } // namespace mojo 63 } // namespace mojo
69 64
70 #endif // MOJO_UI_CONTENT_VIEWER_APP_H_ 65 #endif // MOJO_UI_CONTENT_VIEWER_APP_H_
OLDNEW
« no previous file with comments | « mojo/public/cpp/bindings/tests/versioning_test_service.cc ('k') | mojo/ui/content_viewer_app.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698