| 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 | 45 |
| 46 // If delay_ms is positive, schedule notification with the delay. | 46 // If delay_ms is positive, schedule notification with the delay. |
| 47 // If delay_ms is 0, notify immediately by calling WebResourceStateChange(). | 47 // If delay_ms is 0, notify immediately by calling WebResourceStateChange(). |
| 48 // If delay_ms is negative, do nothing. | 48 // If delay_ms is negative, do nothing. |
| 49 void PostNotification(int64 delay_ms); | 49 void PostNotification(int64 delay_ms); |
| 50 | 50 |
| 51 // We need to be able to load parsed resource data into preferences file, | 51 // We need to be able to load parsed resource data into preferences file, |
| 52 // and get proper install directory. | 52 // and get proper install directory. |
| 53 PrefService* prefs_; | 53 PrefService* prefs_; |
| 54 | 54 |
| 55 Profile* profile_; |
| 56 |
| 55 private: | 57 private: |
| 56 class WebResourceFetcher; | 58 class WebResourceFetcher; |
| 57 friend class WebResourceFetcher; | 59 friend class WebResourceFetcher; |
| 58 | 60 |
| 59 class UnpackerClient; | 61 class UnpackerClient; |
| 60 | 62 |
| 61 // Set in_fetch_ to false, clean up temp directories (in the future). | 63 // Set in_fetch_ to false, clean up temp directories (in the future). |
| 62 void EndFetch(); | 64 void EndFetch(); |
| 63 | 65 |
| 64 // Puts parsed json data in the right places, and writes to prefs file. | 66 // Puts parsed json data in the right places, and writes to prefs file. |
| 65 void OnWebResourceUnpacked(const DictionaryValue& parsed_json); | 67 void OnWebResourceUnpacked(const DictionaryValue& parsed_json); |
| 66 | 68 |
| 67 // Notify listeners that the state of a web resource has changed. | 69 // Notify listeners that the state of a web resource has changed. |
| 68 void WebResourceStateChange(); | 70 void WebResourceStateChange(); |
| 69 | 71 |
| 70 Profile* profile_; | |
| 71 | |
| 72 scoped_ptr<WebResourceFetcher> web_resource_fetcher_; | 72 scoped_ptr<WebResourceFetcher> web_resource_fetcher_; |
| 73 | 73 |
| 74 ResourceDispatcherHost* resource_dispatcher_host_; | 74 ResourceDispatcherHost* resource_dispatcher_host_; |
| 75 | 75 |
| 76 // Allows the creation of tasks to send a WEB_RESOURCE_STATE_CHANGED | 76 // Allows the creation of tasks to send a WEB_RESOURCE_STATE_CHANGED |
| 77 // notification. This allows the WebResourceService to notify the New Tab | 77 // notification. This allows the WebResourceService to notify the New Tab |
| 78 // Page immediately when a new web resource should be shown or removed. | 78 // Page immediately when a new web resource should be shown or removed. |
| 79 ScopedRunnableMethodFactory<WebResourceService> service_factory_; | 79 ScopedRunnableMethodFactory<WebResourceService> service_factory_; |
| 80 | 80 |
| 81 // True if we are currently mid-fetch. If we are asked to start a fetch | 81 // True if we are currently mid-fetch. If we are asked to start a fetch |
| (...skipping 21 matching lines...) Expand all Loading... |
| 103 int cache_update_delay_; | 103 int cache_update_delay_; |
| 104 | 104 |
| 105 // True if a task has been set to update the cache when a new web resource | 105 // True if a task has been set to update the cache when a new web resource |
| 106 // becomes available. | 106 // becomes available. |
| 107 bool web_resource_update_scheduled_; | 107 bool web_resource_update_scheduled_; |
| 108 | 108 |
| 109 DISALLOW_COPY_AND_ASSIGN(WebResourceService); | 109 DISALLOW_COPY_AND_ASSIGN(WebResourceService); |
| 110 }; | 110 }; |
| 111 | 111 |
| 112 #endif // CHROME_BROWSER_WEB_RESOURCE_WEB_RESOURCE_SERVICE_H_ | 112 #endif // CHROME_BROWSER_WEB_RESOURCE_WEB_RESOURCE_SERVICE_H_ |
| OLD | NEW |