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

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

Issue 1083273003: Expose some sky_viewer plumbing to allow for reuse (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 8 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/sky_viewer_base.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"
6 #include "base/message_loop/message_loop.h"
7 #include "base/threading/thread.h"
8 #include "mojo/application/application_runner_chromium.h" 5 #include "mojo/application/application_runner_chromium.h"
9 #include "mojo/common/tracing_impl.h"
10 #include "mojo/icu/icu.h"
11 #include "mojo/public/c/system/main.h" 6 #include "mojo/public/c/system/main.h"
12 #include "mojo/public/cpp/application/application_connection.h"
13 #include "mojo/public/cpp/application/application_delegate.h"
14 #include "mojo/public/cpp/application/application_impl.h"
15 #include "mojo/public/cpp/application/interface_factory_impl.h"
16 #include "mojo/services/content_handler/public/interfaces/content_handler.mojom. h"
17 #include "sky/engine/public/web/Sky.h"
18 #include "sky/services/platform/platform_impl.h"
19 #include "sky/viewer/content_handler_impl.h" 7 #include "sky/viewer/content_handler_impl.h"
20 #include "sky/viewer/document_view.h" 8 #include "sky/viewer/sky_viewer_base.h"
21 #include "sky/viewer/runtime_flags.h"
22 9
23 namespace sky { 10 namespace sky {
24 11
25 class Viewer : public mojo::ApplicationDelegate, 12 class Viewer : public SkyViewerBase {
26 public mojo::InterfaceFactory<mojo::ContentHandler> {
27 public: 13 public:
28 Viewer() {} 14 Viewer() {}
29 15
30 ~Viewer() override { blink::shutdown(); } 16 ~Viewer() override {}
31 17
32 private: 18 private:
33 // Overridden from ApplicationDelegate:
34 void Initialize(mojo::ApplicationImpl* app) override {
35 RuntimeFlags::Initialize(app);
36
37 mojo::NetworkServicePtr network_service;
38 app->ConnectToService("mojo:network_service", &network_service);
39 platform_impl_.reset(new PlatformImpl(network_service.Pass()));
40 blink::initialize(platform_impl_.get());
41
42 mojo::icu::Initialize(app);
43 tracing_.Initialize(app);
44 }
45
46 bool ConfigureIncomingConnection(
47 mojo::ApplicationConnection* connection) override {
48 connection->AddService<mojo::ContentHandler>(this);
49 return true;
50 }
51
52 // Overridden from InterfaceFactory<ContentHandler> 19 // Overridden from InterfaceFactory<ContentHandler>
53 void Create(mojo::ApplicationConnection* connection, 20 void Create(mojo::ApplicationConnection* connection,
54 mojo::InterfaceRequest<mojo::ContentHandler> request) override { 21 mojo::InterfaceRequest<mojo::ContentHandler> request) override {
55 new ContentHandlerImpl(request.Pass()); 22 new ContentHandlerImpl(request.Pass());
56 } 23 }
57 24
58 scoped_ptr<PlatformImpl> platform_impl_;
59 mojo::TracingImpl tracing_;
60
61 DISALLOW_COPY_AND_ASSIGN(Viewer); 25 DISALLOW_COPY_AND_ASSIGN(Viewer);
62 }; 26 };
63 27
64 } // namespace sky 28 } // namespace sky
65 29
66 MojoResult MojoMain(MojoHandle application_request) { 30 MojoResult MojoMain(MojoHandle application_request) {
67 mojo::ApplicationRunnerChromium runner(new sky::Viewer); 31 mojo::ApplicationRunnerChromium runner(new sky::Viewer);
68 return runner.Run(application_request); 32 return runner.Run(application_request);
69 } 33 }
OLDNEW
« no previous file with comments | « sky/viewer/sky_viewer_base.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698