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

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

Issue 638293005: ContentHandler::OnConnect: replace the |url| param with |requestor_url|. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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/apps/js/content_handler_impl.cc ('k') | mojo/examples/png_viewer/png_viewer.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 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( 25 virtual void OnConnect(
26 const mojo::String& url, 26 const mojo::String& requestor_url,
27 URLResponsePtr response, 27 URLResponsePtr response,
28 InterfaceRequest<ServiceProvider> service_provider) override; 28 InterfaceRequest<ServiceProvider> service_provider) override;
29 29
30 ContentHandlerApp* content_handler_app_; 30 ContentHandlerApp* content_handler_app_;
31 }; 31 };
32 32
33 class ContentHandlerApp : public ApplicationDelegate { 33 class ContentHandlerApp : public ApplicationDelegate {
34 public: 34 public:
35 ContentHandlerApp() : content_handler_factory_(this) { 35 ContentHandlerApp() : content_handler_factory_(this) {
36 } 36 }
(...skipping 28 matching lines...) Expand all
65 printf("\n>>> EOF <<<\n"); 65 printf("\n>>> EOF <<<\n");
66 } 66 }
67 } 67 }
68 68
69 private: 69 private:
70 InterfaceFactoryImplWithContext<ContentHandlerImpl, 70 InterfaceFactoryImplWithContext<ContentHandlerImpl,
71 ContentHandlerApp> content_handler_factory_; 71 ContentHandlerApp> content_handler_factory_;
72 }; 72 };
73 73
74 void ContentHandlerImpl::OnConnect( 74 void ContentHandlerImpl::OnConnect(
75 const mojo::String& url, 75 const mojo::String& requestor_url,
76 URLResponsePtr response, 76 URLResponsePtr response,
77 InterfaceRequest<ServiceProvider> service_provider) { 77 InterfaceRequest<ServiceProvider> service_provider) {
78 printf("ContentHandler::OnConnect - url:%s - body follows\n\n", 78 printf("ContentHandler::OnConnect - requestor_url:%s - body follows\n\n",
79 url.To<std::string>().c_str()); 79 requestor_url.To<std::string>().c_str());
80 content_handler_app_->PrintResponse(response->body.Pass()); 80 content_handler_app_->PrintResponse(response->body.Pass());
81 } 81 }
82 82
83 } // namespace examples 83 } // namespace examples
84 84
85 // static 85 // static
86 ApplicationDelegate* ApplicationDelegate::Create() { 86 ApplicationDelegate* ApplicationDelegate::Create() {
87 return new examples::ContentHandlerApp(); 87 return new examples::ContentHandlerApp();
88 } 88 }
89 89
90 } // namespace mojo 90 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/apps/js/content_handler_impl.cc ('k') | mojo/examples/png_viewer/png_viewer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698