| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_PNACL_RESOURCES_H_ | 5 #ifndef NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_PNACL_RESOURCES_H_ |
| 6 #define NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_PNACL_RESOURCES_H_ | 6 #define NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_PNACL_RESOURCES_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 : plugin_(plugin), | 28 : plugin_(plugin), |
| 29 coordinator_(coordinator), | 29 coordinator_(coordinator), |
| 30 all_loaded_(true), | 30 all_loaded_(true), |
| 31 client_callback_is_valid_(false) | 31 client_callback_is_valid_(false) |
| 32 { } | 32 { } |
| 33 | 33 |
| 34 virtual ~PnaclResources(); | 34 virtual ~PnaclResources(); |
| 35 | 35 |
| 36 void Initialize(); | 36 void Initialize(); |
| 37 | 37 |
| 38 // URLs are all relative to the coordinator's resource_base_url(). |
| 39 |
| 40 // Get the wrapper for the downloaded resource. |
| 38 nacl::DescWrapper* WrapperForUrl(const nacl::string& url) { | 41 nacl::DescWrapper* WrapperForUrl(const nacl::string& url) { |
| 39 return resource_wrappers_[url]; | 42 return resource_wrappers_[url]; |
| 40 } | 43 } |
| 41 | 44 |
| 42 // Add an URL for download. | 45 // Add an URL for download. |
| 43 void AddResourceUrl(const nacl::string& url); | 46 void AddResourceUrl(const nacl::string& url); |
| 44 // Start fetching the URLs. | 47 // Start fetching the URLs. |
| 45 void StartDownloads(); | 48 void StartDownloads(); |
| 46 // Set the callback for what to do when all the resources are available. | 49 // Set the callback for what to do when all the resources are available. |
| 47 void RunWhenAllLoaded(pp::CompletionCallback& client_callback); | 50 void RunWhenAllLoaded(pp::CompletionCallback& client_callback); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 69 // If RunWhenAllLoaded was called before all resources have been loaded, | 72 // If RunWhenAllLoaded was called before all resources have been loaded, |
| 70 // this indicates that the registered client callback should be used when | 73 // this indicates that the registered client callback should be used when |
| 71 // the last resource arrives. | 74 // the last resource arrives. |
| 72 bool client_callback_is_valid_; | 75 bool client_callback_is_valid_; |
| 73 // Factory for ready callbacks, etc. | 76 // Factory for ready callbacks, etc. |
| 74 pp::CompletionCallbackFactory<PnaclResources> callback_factory_; | 77 pp::CompletionCallbackFactory<PnaclResources> callback_factory_; |
| 75 }; | 78 }; |
| 76 | 79 |
| 77 } // namespace plugin; | 80 } // namespace plugin; |
| 78 #endif // NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_PNACL_RESOURCES_H_ | 81 #endif // NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_PNACL_RESOURCES_H_ |
| OLD | NEW |