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 <stddef.h> | 7 #include <stddef.h> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
11 #include "base/files/file.h" | 11 #include "base/files/file.h" |
12 #include "mojo/application/public/cpp/application_impl.h" | |
13 #include "mojo/application/public/cpp/connect.h" | |
14 #include "mojo/application/public/interfaces/service_provider.mojom.h" | |
15 #include "mojo/application/public/interfaces/shell.mojom.h" | |
16 #include "mojo/common/common_type_converters.h" | 12 #include "mojo/common/common_type_converters.h" |
17 #include "mojo/platform_handle/platform_handle_functions.h" | 13 #include "mojo/platform_handle/platform_handle_functions.h" |
| 14 #include "mojo/shell/public/cpp/application_impl.h" |
| 15 #include "mojo/shell/public/cpp/connect.h" |
| 16 #include "mojo/shell/public/interfaces/service_provider.mojom.h" |
| 17 #include "mojo/shell/public/interfaces/shell.mojom.h" |
18 | 18 |
19 namespace resource_provider { | 19 namespace resource_provider { |
20 namespace { | 20 namespace { |
21 base::File GetFileFromHandle(mojo::ScopedHandle handle) { | 21 base::File GetFileFromHandle(mojo::ScopedHandle handle) { |
22 CHECK(handle.is_valid()); | 22 CHECK(handle.is_valid()); |
23 MojoPlatformHandle platform_handle; | 23 MojoPlatformHandle platform_handle; |
24 CHECK(MojoExtractPlatformHandle(handle.release().value(), | 24 CHECK(MojoExtractPlatformHandle(handle.release().value(), |
25 &platform_handle) == MOJO_RESULT_OK); | 25 &platform_handle) == MOJO_RESULT_OK); |
26 return base::File(platform_handle); | 26 return base::File(platform_handle); |
27 } | 27 } |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 CHECK(!resources.is_null()); | 63 CHECK(!resources.is_null()); |
64 CHECK_EQ(resources.size(), paths.size()); | 64 CHECK_EQ(resources.size(), paths.size()); |
65 for (size_t i = 0; i < resources.size(); ++i) { | 65 for (size_t i = 0; i < resources.size(); ++i) { |
66 resource_map_[paths[i]].reset( | 66 resource_map_[paths[i]].reset( |
67 new base::File(GetFileFromHandle(std::move(resources[i])))); | 67 new base::File(GetFileFromHandle(std::move(resources[i])))); |
68 } | 68 } |
69 loaded_ = true; | 69 loaded_ = true; |
70 } | 70 } |
71 | 71 |
72 } // namespace resource_provider | 72 } // namespace resource_provider |
OLD | NEW |