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

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

Issue 1154223003: NOT FOR COMMIT: POC of using AuthenticatingURLLoader in Sky (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: updated comment Created 5 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 | « sky/viewer/content_handler_impl.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 "base/files/file_path.h" 5 #include "base/files/file_path.h"
6 #include "base/message_loop/message_loop.h" 6 #include "base/message_loop/message_loop.h"
7 #include "base/threading/thread.h" 7 #include "base/threading/thread.h"
8 #include "mojo/application/application_runner_chromium.h" 8 #include "mojo/application/application_runner_chromium.h"
9 #include "mojo/common/tracing_impl.h" 9 #include "mojo/common/tracing_impl.h"
10 #include "mojo/icu/icu.h" 10 #include "mojo/icu/icu.h"
11 #include "mojo/public/c/system/main.h" 11 #include "mojo/public/c/system/main.h"
12 #include "mojo/public/cpp/application/application_connection.h" 12 #include "mojo/public/cpp/application/application_connection.h"
13 #include "mojo/public/cpp/application/application_delegate.h" 13 #include "mojo/public/cpp/application/application_delegate.h"
14 #include "mojo/public/cpp/application/application_impl.h" 14 #include "mojo/public/cpp/application/application_impl.h"
15 #include "mojo/public/cpp/application/interface_factory_impl.h" 15 #include "mojo/public/cpp/application/interface_factory_impl.h"
16 #include "mojo/services/authenticating_url_loader/public/interfaces/authenticati ng_url_loader_factory.mojom.h"
17 #include "mojo/services/authentication/public/interfaces/authentication.mojom.h"
16 #include "mojo/services/content_handler/public/interfaces/content_handler.mojom. h" 18 #include "mojo/services/content_handler/public/interfaces/content_handler.mojom. h"
17 #include "sky/engine/public/web/Sky.h" 19 #include "sky/engine/public/web/Sky.h"
18 #include "sky/engine/public/web/WebRuntimeFeatures.h" 20 #include "sky/engine/public/web/WebRuntimeFeatures.h"
19 #include "sky/services/platform/platform_impl.h" 21 #include "sky/services/platform/platform_impl.h"
20 #include "sky/viewer/content_handler_impl.h" 22 #include "sky/viewer/content_handler_impl.h"
21 #include "sky/viewer/document_view.h" 23 #include "sky/viewer/document_view.h"
22 #include "sky/viewer/runtime_flags.h" 24 #include "sky/viewer/runtime_flags.h"
23 25
24 namespace sky { 26 namespace sky {
25 27
26 class Viewer : public mojo::ApplicationDelegate, 28 class Viewer : public mojo::ApplicationDelegate,
27 public mojo::InterfaceFactory<mojo::ContentHandler> { 29 public mojo::InterfaceFactory<mojo::ContentHandler> {
28 public: 30 public:
29 Viewer() {} 31 Viewer() {}
30 32
31 ~Viewer() override { blink::shutdown(); } 33 ~Viewer() override { blink::shutdown(); }
32 34
33 private: 35 private:
34 // Overridden from ApplicationDelegate: 36 // Overridden from ApplicationDelegate:
35 void Initialize(mojo::ApplicationImpl* app) override { 37 void Initialize(mojo::ApplicationImpl* app) override {
36 RuntimeFlags::Initialize(app); 38 RuntimeFlags::Initialize(app);
37 39
38 blink::WebRuntimeFeatures::enableObservatory(!RuntimeFlags::Get().testing()) ; 40 blink::WebRuntimeFeatures::enableObservatory(!RuntimeFlags::Get().testing()) ;
39 41
40 mojo::NetworkServicePtr network_service; 42 mojo::NetworkServicePtr network_service;
43 mojo::AuthenticatingURLLoaderFactoryPtr authenticating_url_loader_factory;
41 app->ConnectToService("mojo:network_service", &network_service); 44 app->ConnectToService("mojo:network_service", &network_service);
42 platform_impl_.reset(new PlatformImpl(network_service.Pass())); 45 app->ConnectToService("mojo:authenticating_url_loader",
46 &authenticating_url_loader_factory);
47 authentication::AuthenticationServicePtr authentication_service;
48 app->ConnectToService("mojo:authentication", &authentication_service);
49 authenticating_url_loader_factory->SetAuthenticationService(
50 authentication_service.Pass());
51 platform_impl_.reset(new PlatformImpl(
52 network_service.Pass(), authenticating_url_loader_factory.Pass()));
43 blink::initialize(platform_impl_.get()); 53 blink::initialize(platform_impl_.get());
44 54
45 mojo::icu::Initialize(app); 55 mojo::icu::Initialize(app);
46 tracing_.Initialize(app); 56 tracing_.Initialize(app);
47 } 57 }
48 58
49 bool ConfigureIncomingConnection( 59 bool ConfigureIncomingConnection(
50 mojo::ApplicationConnection* connection) override { 60 mojo::ApplicationConnection* connection) override {
51 connection->AddService<mojo::ContentHandler>(this); 61 connection->AddService<mojo::ContentHandler>(this);
52 return true; 62 return true;
(...skipping 10 matching lines...) Expand all
63 73
64 DISALLOW_COPY_AND_ASSIGN(Viewer); 74 DISALLOW_COPY_AND_ASSIGN(Viewer);
65 }; 75 };
66 76
67 } // namespace sky 77 } // namespace sky
68 78
69 MojoResult MojoMain(MojoHandle application_request) { 79 MojoResult MojoMain(MojoHandle application_request) {
70 mojo::ApplicationRunnerChromium runner(new sky::Viewer); 80 mojo::ApplicationRunnerChromium runner(new sky::Viewer);
71 return runner.Run(application_request); 81 return runner.Run(application_request);
72 } 82 }
OLDNEW
« no previous file with comments | « sky/viewer/content_handler_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698