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 "mojo/application/application_runner_chromium.h" | 5 #include "mojo/application/application_runner_chromium.h" |
6 #include "mojo/common/binding_set.h" | 6 #include "mojo/common/binding_set.h" |
7 #include "mojo/public/c/system/main.h" | 7 #include "mojo/public/c/system/main.h" |
8 #include "mojo/public/cpp/application/application_connection.h" | 8 #include "mojo/public/cpp/application/application_connection.h" |
9 #include "mojo/public/cpp/application/application_delegate.h" | 9 #include "mojo/public/cpp/application/application_delegate.h" |
10 #include "mojo/public/cpp/bindings/interface_ptr.h" | 10 #include "mojo/public/cpp/bindings/interface_ptr.h" |
11 #include "mojo/services/icu_data/interfaces/icu_data.mojom.h" | 11 #include "mojo/services/icu_data/interfaces/icu_data.mojom.h" |
12 #include "services/icu_data/kICUData.h" | 12 #include "services/icu_data/kICUData.h" |
13 | 13 |
14 namespace icu_data { | 14 namespace icu_data { |
15 | 15 |
16 class ICUDataImpl : public mojo::ApplicationDelegate, public ICUData { | 16 class ICUDataImpl : public mojo::ApplicationDelegate, public ICUData { |
17 public: | 17 public: |
18 ICUDataImpl() {} | 18 ICUDataImpl() {} |
19 ~ICUDataImpl() override {} | 19 ~ICUDataImpl() override {} |
20 | 20 |
21 // mojo::ApplicationDelegate implementation. | 21 // mojo::ApplicationDelegate implementation. |
22 bool ConfigureIncomingConnection( | 22 bool ConfigureIncomingConnection( |
23 mojo::ApplicationConnection* connection) override { | 23 mojo::ServiceProviderImpl* service_provider_impl) override { |
24 connection->GetServiceProviderImpl().AddService<ICUData>( | 24 service_provider_impl->AddService<ICUData>( |
25 [this](const mojo::ConnectionContext& connection_context, | 25 [this](const mojo::ConnectionContext& connection_context, |
26 mojo::InterfaceRequest<ICUData> icu_data_request) { | 26 mojo::InterfaceRequest<ICUData> icu_data_request) { |
27 bindings_.AddBinding(this, icu_data_request.Pass()); | 27 bindings_.AddBinding(this, icu_data_request.Pass()); |
28 }); | 28 }); |
29 | 29 |
30 return true; | 30 return true; |
31 } | 31 } |
32 | 32 |
33 void Map(const mojo::String& sha1hash, | 33 void Map(const mojo::String& sha1hash, |
34 const mojo::Callback<void(mojo::ScopedSharedBufferHandle)>& callback) | 34 const mojo::Callback<void(mojo::ScopedSharedBufferHandle)>& callback) |
(...skipping 26 matching lines...) Expand all Loading... |
61 | 61 |
62 scoped_ptr<mojo::SharedBuffer> buffer_; | 62 scoped_ptr<mojo::SharedBuffer> buffer_; |
63 mojo::BindingSet<ICUData> bindings_; | 63 mojo::BindingSet<ICUData> bindings_; |
64 }; | 64 }; |
65 } | 65 } |
66 | 66 |
67 MojoResult MojoMain(MojoHandle application_request) { | 67 MojoResult MojoMain(MojoHandle application_request) { |
68 mojo::ApplicationRunnerChromium runner(new icu_data::ICUDataImpl); | 68 mojo::ApplicationRunnerChromium runner(new icu_data::ICUDataImpl); |
69 return runner.Run(application_request); | 69 return runner.Run(application_request); |
70 } | 70 } |
OLD | NEW |