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/application/interface_factory.h" | 10 #include "mojo/public/cpp/application/interface_factory.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 ~ICUDataImpl() override {} | 22 ~ICUDataImpl() override {} |
23 | 23 |
24 // mojo::ApplicationDelegate implementation. | 24 // mojo::ApplicationDelegate implementation. |
25 bool ConfigureIncomingConnection( | 25 bool ConfigureIncomingConnection( |
26 mojo::ApplicationConnection* connection) override { | 26 mojo::ApplicationConnection* connection) override { |
27 connection->AddService(this); | 27 connection->AddService(this); |
28 return true; | 28 return true; |
29 } | 29 } |
30 | 30 |
31 // mojo::InterfaceFactory<mojo::ICUData> implementation. | 31 // mojo::InterfaceFactory<mojo::ICUData> implementation. |
32 void Create(mojo::ApplicationConnection* connection, | 32 void Create(const mojo::ConnectionContext& connection, |
33 mojo::InterfaceRequest<ICUData> request) override { | 33 mojo::InterfaceRequest<ICUData> request) override { |
34 bindings_.AddBinding(this, request.Pass()); | 34 bindings_.AddBinding(this, request.Pass()); |
35 } | 35 } |
36 | 36 |
37 void Map(const mojo::String& sha1hash, | 37 void Map(const mojo::String& sha1hash, |
38 const mojo::Callback<void(mojo::ScopedSharedBufferHandle)>& callback) | 38 const mojo::Callback<void(mojo::ScopedSharedBufferHandle)>& callback) |
39 override { | 39 override { |
40 if (std::string(sha1hash) != std::string(kICUData.hash)) { | 40 if (std::string(sha1hash) != std::string(kICUData.hash)) { |
41 LOG(WARNING) << "Failed to match sha1sum. Expected " << kICUData.hash; | 41 LOG(WARNING) << "Failed to match sha1sum. Expected " << kICUData.hash; |
42 callback.Run(mojo::ScopedSharedBufferHandle()); | 42 callback.Run(mojo::ScopedSharedBufferHandle()); |
(...skipping 22 matching lines...) Expand all Loading... |
65 | 65 |
66 scoped_ptr<mojo::SharedBuffer> buffer_; | 66 scoped_ptr<mojo::SharedBuffer> buffer_; |
67 mojo::BindingSet<ICUData> bindings_; | 67 mojo::BindingSet<ICUData> bindings_; |
68 }; | 68 }; |
69 } | 69 } |
70 | 70 |
71 MojoResult MojoMain(MojoHandle application_request) { | 71 MojoResult MojoMain(MojoHandle application_request) { |
72 mojo::ApplicationRunnerChromium runner(new icu_data::ICUDataImpl); | 72 mojo::ApplicationRunnerChromium runner(new icu_data::ICUDataImpl); |
73 return runner.Run(application_request); | 73 return runner.Run(application_request); |
74 } | 74 } |
OLD | NEW |