OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "chrome/browser/utility_process_host.h" | 10 #include "chrome/browser/utility_process_host.h" |
11 #include "chrome/common/pref_service.h" | 11 #include "chrome/common/pref_service.h" |
12 #include "chrome/common/web_resource/web_resource_unpacker.h" | 12 #include "chrome/common/web_resource/web_resource_unpacker.h" |
13 | 13 |
14 class Profile; | 14 class Profile; |
15 | 15 |
16 class WebResourceService | 16 class WebResourceService |
17 : public UtilityProcessHost::Client { | 17 : public UtilityProcessHost::Client { |
18 public: | 18 public: |
19 explicit WebResourceService(Profile* profile); | 19 explicit WebResourceService(Profile* profile); |
20 | 20 |
21 // Sleep until cache needs to be updated, but always for at least 5 seconds | 21 // Sleep until cache needs to be updated, but always for at least 5 seconds |
22 // so we don't interfere with startup. Then begin updating resources. | 22 // so we don't interfere with startup. Then begin updating resources. |
23 void StartAfterDelay(); | 23 void StartAfterDelay(); |
24 | 24 |
25 // We have successfully pulled data from a resource server; now launch | 25 // We have successfully pulled data from a resource server; now launch |
26 // the process that will parse the JSON, and then update the cache. | 26 // the process that will parse the JSON, and then update the cache. |
27 void UpdateResourceCache(const std::string& json_data); | 27 void UpdateResourceCache(const std::string& json_data); |
28 | 28 |
29 // Get the language appropriate for delivery of the web resources. | |
30 static std::wstring GetWebResourceLanguage(PrefService* prefs); | |
31 | |
32 static const wchar_t* kTipDictionaryPrefName; | 29 static const wchar_t* kTipDictionaryPrefName; |
33 static const wchar_t* kCurrentTipPrefName; | 30 static const wchar_t* kCurrentTipPrefName; |
34 static const wchar_t* kTipCachePrefName; | 31 static const wchar_t* kTipCachePrefName; |
35 | 32 |
36 // Default server from which to gather resources. | 33 // Default server from which to gather resources. |
37 static const wchar_t* kDefaultResourceServer; | 34 static const wchar_t* kDefaultResourceServer; |
38 | 35 |
39 private: | 36 private: |
40 class WebResourceFetcher; | 37 class WebResourceFetcher; |
41 friend class WebResourceFetcher; | 38 friend class WebResourceFetcher; |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 | 82 |
86 // Name of directory inside the profile where we will store resource-related | 83 // Name of directory inside the profile where we will store resource-related |
87 // data (for now, thumbnail images). | 84 // data (for now, thumbnail images). |
88 static const char* kResourceDirectoryName; | 85 static const char* kResourceDirectoryName; |
89 | 86 |
90 DISALLOW_COPY_AND_ASSIGN(WebResourceService); | 87 DISALLOW_COPY_AND_ASSIGN(WebResourceService); |
91 }; | 88 }; |
92 | 89 |
93 #endif // CHROME_BROWSER_WEB_RESOURCE_WEB_RESOURCE_SERVICE_H_ | 90 #endif // CHROME_BROWSER_WEB_RESOURCE_WEB_RESOURCE_SERVICE_H_ |
94 | 91 |
OLD | NEW |