OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "components/resource_provider/public/cpp/resource_loader.h" | 5 #include "components/resource_provider/public/cpp/resource_loader.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/files/file.h" | 8 #include "base/files/file.h" |
| 9 #include "mojo/application/public/cpp/connect.h" |
| 10 #include "mojo/application/public/interfaces/shell.mojom.h" |
9 #include "mojo/common/common_type_converters.h" | 11 #include "mojo/common/common_type_converters.h" |
10 #include "mojo/platform_handle/platform_handle_functions.h" | 12 #include "mojo/platform_handle/platform_handle_functions.h" |
11 #include "third_party/mojo/src/mojo/public/cpp/application/connect.h" | |
12 #include "third_party/mojo/src/mojo/public/interfaces/application/shell.mojom.h" | |
13 | 13 |
14 namespace resource_provider { | 14 namespace resource_provider { |
15 | 15 |
16 ResourceLoader::ResourceLoader(mojo::Shell* shell, | 16 ResourceLoader::ResourceLoader(mojo::Shell* shell, |
17 const std::set<std::string>& paths) | 17 const std::set<std::string>& paths) |
18 : loaded_(false), did_block_(false) { | 18 : loaded_(false), did_block_(false) { |
19 shell->ConnectToApplication("mojo:resource_provider", | 19 shell->ConnectToApplication("mojo:resource_provider", |
20 GetProxy(&resource_provider_service_provider_), | 20 GetProxy(&resource_provider_service_provider_), |
21 nullptr); | 21 nullptr); |
22 mojo::ConnectToService(resource_provider_service_provider_.get(), | 22 mojo::ConnectToService(resource_provider_service_provider_.get(), |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 CHECK(resources[i].is_valid()); | 59 CHECK(resources[i].is_valid()); |
60 MojoPlatformHandle platform_handle; | 60 MojoPlatformHandle platform_handle; |
61 CHECK(MojoExtractPlatformHandle(resources[i].release().value(), | 61 CHECK(MojoExtractPlatformHandle(resources[i].release().value(), |
62 &platform_handle) == MOJO_RESULT_OK); | 62 &platform_handle) == MOJO_RESULT_OK); |
63 resource_map_[paths[i]].reset(new base::File(platform_handle)); | 63 resource_map_[paths[i]].reset(new base::File(platform_handle)); |
64 } | 64 } |
65 loaded_ = true; | 65 loaded_ = true; |
66 } | 66 } |
67 | 67 |
68 } // namespace resource_provider | 68 } // namespace resource_provider |
OLD | NEW |