| 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 #ifndef COMPONENTS_RESOURCE_PROVIDER_PUBLIC_CPP_RESOURCE_LOADER_H_ | 5 #ifndef COMPONENTS_RESOURCE_PROVIDER_PUBLIC_CPP_RESOURCE_LOADER_H_ |
| 6 #define COMPONENTS_RESOURCE_PROVIDER_PUBLIC_CPP_RESOURCE_LOADER_H_ | 6 #define COMPONENTS_RESOURCE_PROVIDER_PUBLIC_CPP_RESOURCE_LOADER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 | 39 |
| 40 // Uses WaitForIncomingMessage() to block until the results are available, or | 40 // Uses WaitForIncomingMessage() to block until the results are available, or |
| 41 // an error occurs. Returns true if the resources were obtained, false on | 41 // an error occurs. Returns true if the resources were obtained, false on |
| 42 // error. This immediately returns if the resources have already been | 42 // error. This immediately returns if the resources have already been |
| 43 // obtained. | 43 // obtained. |
| 44 bool BlockUntilLoaded(); | 44 bool BlockUntilLoaded(); |
| 45 | 45 |
| 46 // Releases and returns the file wrapping the handle. | 46 // Releases and returns the file wrapping the handle. |
| 47 base::File ReleaseFile(const std::string& path); | 47 base::File ReleaseFile(const std::string& path); |
| 48 | 48 |
| 49 base::File GetICUFile(); | |
| 50 | |
| 51 bool loaded() const { return loaded_; } | 49 bool loaded() const { return loaded_; } |
| 52 | 50 |
| 53 private: | 51 private: |
| 54 using ResourceMap = std::map<std::string, scoped_ptr<base::File>>; | 52 using ResourceMap = std::map<std::string, scoped_ptr<base::File>>; |
| 55 | 53 |
| 56 // Callback when resources have loaded. | 54 // Callback when resources have loaded. |
| 57 void OnGotResources(const std::vector<std::string>& paths, | 55 void OnGotResources(const std::vector<std::string>& paths, |
| 58 mojo::Array<mojo::ScopedHandle> resources); | 56 mojo::Array<mojo::ScopedHandle> resources); |
| 59 void OnGotICU(base::File* file, mojo::ScopedHandle handle); | |
| 60 | 57 |
| 61 ResourceProviderPtr resource_provider_; | 58 ResourceProviderPtr resource_provider_; |
| 62 | 59 |
| 63 ResourceMap resource_map_; | 60 ResourceMap resource_map_; |
| 64 | 61 |
| 65 bool loaded_; | 62 bool loaded_; |
| 66 bool did_block_; | 63 bool did_block_; |
| 67 | 64 |
| 68 DISALLOW_COPY_AND_ASSIGN(ResourceLoader); | 65 DISALLOW_COPY_AND_ASSIGN(ResourceLoader); |
| 69 }; | 66 }; |
| 70 | 67 |
| 71 } // namespace resource_provider | 68 } // namespace resource_provider |
| 72 | 69 |
| 73 #endif // COMPONENTS_RESOURCE_PROVIDER_PUBLIC_CPP_RESOURCE_LOADER_H_ | 70 #endif // COMPONENTS_RESOURCE_PROVIDER_PUBLIC_CPP_RESOURCE_LOADER_H_ |
| OLD | NEW |