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 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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 20 matching lines...) Expand all Loading... |
31 bool apply_locale_to_url_, | 31 bool apply_locale_to_url_, |
32 const char* last_update_time_pref_name, | 32 const char* last_update_time_pref_name, |
33 int start_fetch_delay_ms, | 33 int start_fetch_delay_ms, |
34 int cache_update_delay_ms); | 34 int cache_update_delay_ms); |
35 | 35 |
36 // Sleep until cache needs to be updated, but always for at least | 36 // Sleep until cache needs to be updated, but always for at least |
37 // |start_fetch_delay_ms| so we don't interfere with startup. | 37 // |start_fetch_delay_ms| so we don't interfere with startup. |
38 // Then begin updating resources. | 38 // Then begin updating resources. |
39 void StartAfterDelay(); | 39 void StartAfterDelay(); |
40 | 40 |
| 41 void set_use_utility_process_for_testing(bool value) { |
| 42 use_utility_process_ = value; |
| 43 } |
| 44 |
41 protected: | 45 protected: |
42 virtual ~WebResourceService(); | 46 virtual ~WebResourceService(); |
43 | 47 |
44 virtual void Unpack(const base::DictionaryValue& parsed_json) = 0; | 48 virtual void Unpack(const base::DictionaryValue& parsed_json) = 0; |
45 | 49 |
46 PrefService* prefs_; | 50 PrefService* prefs_; |
47 | 51 |
48 private: | 52 private: |
49 class UnpackerClient; | 53 class UnpackerClient; |
50 friend class base::RefCountedThreadSafe<WebResourceService>; | 54 friend class base::RefCountedThreadSafe<WebResourceService>; |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 // Pref name to store the last update's time. | 86 // Pref name to store the last update's time. |
83 const char* last_update_time_pref_name_; | 87 const char* last_update_time_pref_name_; |
84 | 88 |
85 // Delay on first fetch so we don't interfere with startup. | 89 // Delay on first fetch so we don't interfere with startup. |
86 int start_fetch_delay_ms_; | 90 int start_fetch_delay_ms_; |
87 | 91 |
88 // Delay between calls to update the web resource cache. This delay may be | 92 // Delay between calls to update the web resource cache. This delay may be |
89 // different for different builds of Chrome. | 93 // different for different builds of Chrome. |
90 int cache_update_delay_ms_; | 94 int cache_update_delay_ms_; |
91 | 95 |
| 96 // Used by unittests to skip the utility process. |
| 97 bool use_utility_process_; |
| 98 |
92 DISALLOW_COPY_AND_ASSIGN(WebResourceService); | 99 DISALLOW_COPY_AND_ASSIGN(WebResourceService); |
93 }; | 100 }; |
94 | 101 |
95 #endif // CHROME_BROWSER_WEB_RESOURCE_WEB_RESOURCE_SERVICE_H_ | 102 #endif // CHROME_BROWSER_WEB_RESOURCE_WEB_RESOURCE_SERVICE_H_ |
OLD | NEW |