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 16 matching lines...) Expand all Loading... |
27 // thse resources. All URLs in relative to resource_base_url_. | 27 // thse resources. All URLs in relative to resource_base_url_. |
28 class PnaclResources { | 28 class PnaclResources { |
29 public: | 29 public: |
30 PnaclResources(Plugin* plugin, | 30 PnaclResources(Plugin* plugin, |
31 PnaclCoordinator* coordinator, | 31 PnaclCoordinator* coordinator, |
32 const nacl::string& resource_base_url, | 32 const nacl::string& resource_base_url, |
33 const std::vector<nacl::string>& resource_urls, | 33 const std::vector<nacl::string>& resource_urls, |
34 const pp::CompletionCallback& all_loaded_callback) | 34 const pp::CompletionCallback& all_loaded_callback) |
35 : plugin_(plugin), | 35 : plugin_(plugin), |
36 coordinator_(coordinator), | 36 coordinator_(coordinator), |
| 37 resource_base_url_(resource_base_url), |
37 resource_urls_(resource_urls), | 38 resource_urls_(resource_urls), |
38 all_loaded_callback_(all_loaded_callback), | 39 all_loaded_callback_(all_loaded_callback) { |
39 resource_base_url_(resource_base_url) { | |
40 callback_factory_.Initialize(this); | 40 callback_factory_.Initialize(this); |
41 } | 41 } |
42 | 42 |
43 virtual ~PnaclResources(); | 43 virtual ~PnaclResources(); |
44 | 44 |
45 // Start fetching the URLs. After construction, this is the first step. | 45 // Start fetching the URLs. After construction, this is the first step. |
46 void StartDownloads(); | 46 void StartDownloads(); |
47 // Get the wrapper for the downloaded resource. | 47 // Get the wrapper for the downloaded resource. |
48 // Only valid after all_loaded_callback_ has been run. | 48 // Only valid after all_loaded_callback_ has been run. |
49 nacl::DescWrapper* WrapperForUrl(const nacl::string& url) { | 49 nacl::DescWrapper* WrapperForUrl(const nacl::string& url) { |
(...skipping 24 matching lines...) Expand all Loading... |
74 // Because we may be loading multiple resources, we need a callback that | 74 // Because we may be loading multiple resources, we need a callback that |
75 // is invoked each time a resource arrives, and finally invokes | 75 // is invoked each time a resource arrives, and finally invokes |
76 // all_loaded_callback_ when done. | 76 // all_loaded_callback_ when done. |
77 nacl::scoped_ptr<DelayedCallback> delayed_callback_; | 77 nacl::scoped_ptr<DelayedCallback> delayed_callback_; |
78 // Factory for ready callbacks, etc. | 78 // Factory for ready callbacks, etc. |
79 pp::CompletionCallbackFactory<PnaclResources> callback_factory_; | 79 pp::CompletionCallbackFactory<PnaclResources> callback_factory_; |
80 }; | 80 }; |
81 | 81 |
82 } // namespace plugin; | 82 } // namespace plugin; |
83 #endif // NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_PNACL_RESOURCES_H_ | 83 #endif // NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_PNACL_RESOURCES_H_ |
OLD | NEW |