| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 CHROME_BROWSER_WEB_RESOURCE_WEB_RESOURCE_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_WEB_RESOURCE_WEB_RESOURCE_SERVICE_H_ |
| 6 #define CHROME_BROWSER_WEB_RESOURCE_WEB_RESOURCE_SERVICE_H_ | 6 #define CHROME_BROWSER_WEB_RESOURCE_WEB_RESOURCE_SERVICE_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 // Set |in_fetch_| to false, clean up temp directories (in the future). | 72 // Set |in_fetch_| to false, clean up temp directories (in the future). |
| 73 void EndFetch(); | 73 void EndFetch(); |
| 74 | 74 |
| 75 // So that we can delay our start so as not to affect start-up time; also, | 75 // So that we can delay our start so as not to affect start-up time; also, |
| 76 // so that we can schedule future cache updates. | 76 // so that we can schedule future cache updates. |
| 77 base::WeakPtrFactory<WebResourceService> weak_ptr_factory_; | 77 base::WeakPtrFactory<WebResourceService> weak_ptr_factory_; |
| 78 | 78 |
| 79 // The tool that fetches the url data from the server. | 79 // The tool that fetches the url data from the server. |
| 80 scoped_ptr<net::URLFetcher> url_fetcher_; | 80 scoped_ptr<net::URLFetcher> url_fetcher_; |
| 81 | 81 |
| 82 // The tool that parses and transform the json data. Weak reference as it | 82 // The tool that parses and transforms the json data. Weak reference as it |
| 83 // deletes itself once the unpack is done. | 83 // deletes itself once the unpack is done. |
| 84 JSONAsynchronousUnpacker* json_unpacker_; | 84 JSONAsynchronousUnpacker* json_unpacker_; |
| 85 | 85 |
| 86 // True if we are currently fetching or unpacking data. If we are asked to | 86 // True if we are currently fetching or unpacking data. If we are asked to |
| 87 // start a fetch when we are still fetching resource data, schedule another | 87 // start a fetch when we are still fetching resource data, schedule another |
| 88 // one in |cache_update_delay_ms_| time, and silently exit. | 88 // one in |cache_update_delay_ms_| time, and silently exit. |
| 89 bool in_fetch_; | 89 bool in_fetch_; |
| 90 | 90 |
| 91 // URL that hosts the web resource. | 91 // URL that hosts the web resource. |
| 92 GURL web_resource_server_; | 92 GURL web_resource_server_; |
| 93 | 93 |
| 94 // Indicates whether we should append locale to the web resource server URL. | 94 // Indicates whether we should append locale to the web resource server URL. |
| 95 bool apply_locale_to_url_; | 95 bool apply_locale_to_url_; |
| 96 | 96 |
| 97 // Pref name to store the last update's time. | 97 // Pref name to store the last update's time. |
| 98 const char* last_update_time_pref_name_; | 98 const char* last_update_time_pref_name_; |
| 99 | 99 |
| 100 // Delay on first fetch so we don't interfere with startup. | 100 // Delay on first fetch so we don't interfere with startup. |
| 101 int start_fetch_delay_ms_; | 101 int start_fetch_delay_ms_; |
| 102 | 102 |
| 103 // Delay between calls to update the web resource cache. This delay may be | 103 // Delay between calls to update the web resource cache. This delay may be |
| 104 // different for different builds of Chrome. | 104 // different for different builds of Chrome. |
| 105 int cache_update_delay_ms_; | 105 int cache_update_delay_ms_; |
| 106 | 106 |
| 107 DISALLOW_COPY_AND_ASSIGN(WebResourceService); | 107 DISALLOW_COPY_AND_ASSIGN(WebResourceService); |
| 108 }; | 108 }; |
| 109 | 109 |
| 110 #endif // CHROME_BROWSER_WEB_RESOURCE_WEB_RESOURCE_SERVICE_H_ | 110 #endif // CHROME_BROWSER_WEB_RESOURCE_WEB_RESOURCE_SERVICE_H_ |
| OLD | NEW |