| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 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" | |
| 9 #include "mojo/common/tracing_impl.h" | |
| 10 #include "mojo/icu/icu.h" | |
| 11 #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 "services/sky/content_handler_impl.h" | |
| 18 #include "services/sky/document_view.h" | |
| 19 #include "services/sky/platform_impl.h" | |
| 20 #include "services/sky/runtime_flags.h" | |
| 21 #include "sky/engine/public/web/Sky.h" | |
| 22 #include "sky/engine/public/web/WebRuntimeFeatures.h" | |
| 23 | |
| 24 namespace sky { | |
| 25 | |
| 26 class Viewer : public mojo::ApplicationDelegate, | |
| 27 public mojo::InterfaceFactory<mojo::ContentHandler> { | |
| 28 public: | |
| 29 Viewer() {} | |
| 30 | |
| 31 ~Viewer() override { blink::shutdown(); } | |
| 32 | |
| 33 private: | |
| 34 // Overridden from ApplicationDelegate: | |
| 35 void Initialize(mojo::ApplicationImpl* app) override { | |
| 36 RuntimeFlags::Initialize(app); | |
| 37 | |
| 38 blink::WebRuntimeFeatures::enableObservatory( | |
| 39 !RuntimeFlags::Get().testing()); | |
| 40 | |
| 41 platform_impl_.reset(new PlatformImpl()); | |
| 42 blink::initialize(platform_impl_.get()); | |
| 43 | |
| 44 mojo::icu::Initialize(app); | |
| 45 tracing_.Initialize(app); | |
| 46 } | |
| 47 | |
| 48 bool ConfigureIncomingConnection( | |
| 49 mojo::ApplicationConnection* connection) override { | |
| 50 connection->AddService<mojo::ContentHandler>(this); | |
| 51 return true; | |
| 52 } | |
| 53 | |
| 54 // Overridden from InterfaceFactory<ContentHandler> | |
| 55 void Create(mojo::ApplicationConnection* connection, | |
| 56 mojo::InterfaceRequest<mojo::ContentHandler> request) override { | |
| 57 new ContentHandlerImpl(request.Pass()); | |
| 58 } | |
| 59 | |
| 60 scoped_ptr<PlatformImpl> platform_impl_; | |
| 61 mojo::TracingImpl tracing_; | |
| 62 | |
| 63 DISALLOW_COPY_AND_ASSIGN(Viewer); | |
| 64 }; | |
| 65 | |
| 66 } // namespace sky | |
| 67 | |
| 68 MojoResult MojoMain(MojoHandle application_request) { | |
| 69 mojo::ApplicationRunnerChromium runner(new sky::Viewer); | |
| 70 return runner.Run(application_request); | |
| 71 } | |
| OLD | NEW |