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

Side by Side Diff: mojo/examples/content_handler_demo/content_handler_demo.cc

Issue 489493004: Update view manager to support content handling. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: blah to the blizzah Created 6 years, 3 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 | Annotate | Revision Log
OLDNEW
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 #include <stdio.h> 5 #include <stdio.h>
6 6
7 #include "mojo/public/cpp/application/application_delegate.h" 7 #include "mojo/public/cpp/application/application_delegate.h"
8 #include "mojo/public/cpp/application/application_impl.h" 8 #include "mojo/public/cpp/application/application_impl.h"
9 #include "mojo/public/cpp/application/interface_factory_impl.h" 9 #include "mojo/public/cpp/application/interface_factory_impl.h"
10 #include "mojo/services/public/interfaces/content_handler/content_handler.mojom. h" 10 #include "mojo/services/public/interfaces/content_handler/content_handler.mojom. h"
11 11
12 namespace mojo { 12 namespace mojo {
13 namespace examples { 13 namespace examples {
14 14
15 class ContentHandlerApp; 15 class ContentHandlerApp;
16 16
17 class ContentHandlerImpl : public InterfaceImpl<ContentHandler> { 17 class ContentHandlerImpl : public InterfaceImpl<ContentHandler> {
18 public: 18 public:
19 explicit ContentHandlerImpl(ContentHandlerApp* content_handler_app) 19 explicit ContentHandlerImpl(ContentHandlerApp* content_handler_app)
20 : content_handler_app_(content_handler_app) { 20 : content_handler_app_(content_handler_app) {
21 } 21 }
22 virtual ~ContentHandlerImpl() {} 22 virtual ~ContentHandlerImpl() {}
23 23
24 private: 24 private:
25 virtual void OnConnect(const mojo::String& url, 25 virtual void OnConnect(
26 URLResponsePtr content, 26 const mojo::String& url,
27 ServiceProviderPtr service_provider) MOJO_OVERRIDE; 27 ContentHandlerResponsePtr content,
28 InterfaceRequest<ServiceProvider> service_provider) MOJO_OVERRIDE;
28 29
29 ContentHandlerApp* content_handler_app_; 30 ContentHandlerApp* content_handler_app_;
30 }; 31 };
31 32
32 class ContentHandlerApp : public ApplicationDelegate { 33 class ContentHandlerApp : public ApplicationDelegate {
33 public: 34 public:
34 ContentHandlerApp() : content_handler_factory_(this) { 35 ContentHandlerApp() : content_handler_factory_(this) {
35 } 36 }
36 37
37 virtual void Initialize(ApplicationImpl* app) MOJO_OVERRIDE { 38 virtual void Initialize(ApplicationImpl* app) MOJO_OVERRIDE {
(...skipping 26 matching lines...) Expand all
64 65
65 printf("\n>>> EOF <<<\n"); 66 printf("\n>>> EOF <<<\n");
66 } 67 }
67 } 68 }
68 69
69 private: 70 private:
70 InterfaceFactoryImplWithContext<ContentHandlerImpl, 71 InterfaceFactoryImplWithContext<ContentHandlerImpl,
71 ContentHandlerApp> content_handler_factory_; 72 ContentHandlerApp> content_handler_factory_;
72 }; 73 };
73 74
74 void ContentHandlerImpl::OnConnect(const mojo::String& url, 75 void ContentHandlerImpl::OnConnect(
75 URLResponsePtr content, 76 const mojo::String& url,
76 ServiceProviderPtr service_provider) { 77 ContentHandlerResponsePtr content,
78 InterfaceRequest<ServiceProvider> service_provider) {
77 printf("ContentHandler::OnConnect - url:%s - body follows\n\n", 79 printf("ContentHandler::OnConnect - url:%s - body follows\n\n",
78 url.To<std::string>().c_str()); 80 url.To<std::string>().c_str());
79 content_handler_app_->PrintResponse(content->body.Pass()); 81 content_handler_app_->PrintResponse(content->response->body.Pass());
80 } 82 }
81 83
82 } // namespace examples 84 } // namespace examples
83 85
84 // static 86 // static
85 ApplicationDelegate* ApplicationDelegate::Create() { 87 ApplicationDelegate* ApplicationDelegate::Create() {
86 return new examples::ContentHandlerApp(); 88 return new examples::ContentHandlerApp();
87 } 89 }
88 90
89 } // namespace mojo 91 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/application_manager/application_manager.cc ('k') | mojo/examples/embedded_app/embedded_app.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698