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

Side by Side Diff: sky/viewer/content_handler_impl.cc

Issue 905583002: Pass the final URL an app was loaded from to the app in Initialize(). (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: o Created 5 years, 10 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 | « shell/external_application_listener_unittest.cc ('k') | no next file » | 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 "sky/viewer/content_handler_impl.h" 5 #include "sky/viewer/content_handler_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "mojo/public/cpp/application/connect.h" 8 #include "mojo/public/cpp/application/connect.h"
9 #include "mojo/public/cpp/bindings/strong_binding.h" 9 #include "mojo/public/cpp/bindings/strong_binding.h"
10 #include "mojo/public/cpp/utility/run_loop.h" 10 #include "mojo/public/cpp/utility/run_loop.h"
11 #include "mojo/services/network/public/interfaces/network_service.mojom.h" 11 #include "mojo/services/network/public/interfaces/network_service.mojom.h"
12 #include "sky/viewer/document_view.h" 12 #include "sky/viewer/document_view.h"
13 13
14 namespace sky { 14 namespace sky {
15 15
16 class SkyApplication : public mojo::Application { 16 class SkyApplication : public mojo::Application {
17 public: 17 public:
18 SkyApplication(mojo::InterfaceRequest<mojo::Application> application, 18 SkyApplication(mojo::InterfaceRequest<mojo::Application> application,
19 mojo::URLResponsePtr response) 19 mojo::URLResponsePtr response)
20 : url_(response->url), 20 : url_(response->url),
21 binding_(this, application.Pass()), 21 binding_(this, application.Pass()),
22 initial_response_(response.Pass()) {} 22 initial_response_(response.Pass()) {}
23 23
24 void Initialize(mojo::ShellPtr shell, 24 void Initialize(mojo::ShellPtr shell,
25 mojo::Array<mojo::String> args) override { 25 mojo::Array<mojo::String> args,
26 const mojo::String& url) override {
26 shell_ = shell.Pass(); 27 shell_ = shell.Pass();
27 mojo::ServiceProviderPtr service_provider; 28 mojo::ServiceProviderPtr service_provider;
28 shell_->ConnectToApplication("mojo:network_service", 29 shell_->ConnectToApplication("mojo:network_service",
29 mojo::GetProxy(&service_provider), nullptr); 30 mojo::GetProxy(&service_provider), nullptr);
30 mojo::ConnectToService(service_provider.get(), &network_service_); 31 mojo::ConnectToService(service_provider.get(), &network_service_);
31 } 32 }
32 33
33 void AcceptConnection(const mojo::String& requestor_url, 34 void AcceptConnection(const mojo::String& requestor_url,
34 mojo::InterfaceRequest<mojo::ServiceProvider> services, 35 mojo::InterfaceRequest<mojo::ServiceProvider> services,
35 mojo::ServiceProviderPtr exposed_services) override { 36 mojo::ServiceProviderPtr exposed_services) override {
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 ContentHandlerImpl::~ContentHandlerImpl() { 83 ContentHandlerImpl::~ContentHandlerImpl() {
83 } 84 }
84 85
85 void ContentHandlerImpl::StartApplication( 86 void ContentHandlerImpl::StartApplication(
86 mojo::InterfaceRequest<mojo::Application> application, 87 mojo::InterfaceRequest<mojo::Application> application,
87 mojo::URLResponsePtr response) { 88 mojo::URLResponsePtr response) {
88 new SkyApplication(application.Pass(), response.Pass()); 89 new SkyApplication(application.Pass(), response.Pass());
89 } 90 }
90 91
91 } // namespace sky 92 } // namespace sky
OLDNEW
« no previous file with comments | « shell/external_application_listener_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698