OLD | NEW |
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/engine/config.h" | 5 #include "sky/engine/config.h" |
6 #include "sky/shell/ui/internals.h" | 6 #include "sky/shell/ui/internals.h" |
7 | 7 |
8 #include "mojo/public/cpp/application/connect.h" | 8 #include "mojo/public/cpp/application/connect.h" |
9 #include "mojo/public/cpp/bindings/array.h" | 9 #include "mojo/public/cpp/bindings/array.h" |
| 10 #include "services/asset_bundle/asset_unpacker_impl.h" |
10 #include "sky/engine/tonic/dart_builtin.h" | 11 #include "sky/engine/tonic/dart_builtin.h" |
11 #include "sky/engine/tonic/dart_converter.h" | 12 #include "sky/engine/tonic/dart_converter.h" |
12 #include "sky/engine/tonic/dart_error.h" | 13 #include "sky/engine/tonic/dart_error.h" |
13 #include "sky/engine/tonic/dart_state.h" | 14 #include "sky/engine/tonic/dart_state.h" |
14 | 15 |
15 using namespace blink; | 16 using namespace blink; |
16 | 17 |
17 namespace sky { | 18 namespace sky { |
18 namespace shell { | 19 namespace shell { |
19 namespace { | 20 namespace { |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 DartState* state = DartState::From(isolate); | 63 DartState* state = DartState::From(isolate); |
63 state->SetUserData(&kInternalsKey, new Internals(service_provider.Pass())); | 64 state->SetUserData(&kInternalsKey, new Internals(service_provider.Pass())); |
64 Dart_Handle library = | 65 Dart_Handle library = |
65 Dart_LoadLibrary(Dart_NewStringFromCString(kLibraryName), | 66 Dart_LoadLibrary(Dart_NewStringFromCString(kLibraryName), |
66 Dart_NewStringFromCString(kLibrarySource), 0, 0); | 67 Dart_NewStringFromCString(kLibrarySource), 0, 0); |
67 CHECK(!LogIfError(library)); | 68 CHECK(!LogIfError(library)); |
68 CHECK(!LogIfError(Dart_FinalizeLoading(true))); | 69 CHECK(!LogIfError(Dart_FinalizeLoading(true))); |
69 CHECK(!LogIfError(Dart_SetNativeResolver(library, Resolver, Symbolizer))); | 70 CHECK(!LogIfError(Dart_SetNativeResolver(library, Resolver, Symbolizer))); |
70 } | 71 } |
71 | 72 |
72 Internals::Internals(mojo::ServiceProviderPtr service_provider) | 73 Internals::Internals(mojo::ServiceProviderPtr platform_service_provider) |
73 : service_provider_(service_provider.Pass()) { | 74 : service_provider_impl_(GetProxy(&service_provider_)), |
| 75 platform_service_provider_(platform_service_provider.Pass()) { |
| 76 service_provider_impl_.set_fallback_service_provider( |
| 77 platform_service_provider_.get()); |
| 78 service_provider_impl_.AddService<mojo::asset_bundle::AssetUnpacker>(this); |
74 } | 79 } |
75 | 80 |
76 Internals::~Internals() { | 81 Internals::~Internals() { |
77 } | 82 } |
78 | 83 |
| 84 void Internals::Create( |
| 85 mojo::ApplicationConnection* connection, |
| 86 mojo::InterfaceRequest<mojo::asset_bundle::AssetUnpacker> request) { |
| 87 new mojo::asset_bundle::AssetUnpackerImpl(request.Pass()); |
| 88 } |
| 89 |
79 mojo::Handle Internals::TakeServicesProvidedByEmbedder() { | 90 mojo::Handle Internals::TakeServicesProvidedByEmbedder() { |
80 return service_provider_.PassInterface().PassHandle().release(); | 91 return service_provider_.PassInterface().PassHandle().release(); |
81 } | 92 } |
82 | 93 |
83 } // namespace shell | 94 } // namespace shell |
84 } // namespace sky | 95 } // namespace sky |
OLD | NEW |