OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 COMPONENTS_WEB_RESOURCE_WEB_RESOURCE_SERVICE_H_ | 5 #ifndef COMPONENTS_WEB_RESOURCE_WEB_RESOURCE_SERVICE_H_ |
6 #define COMPONENTS_WEB_RESOURCE_WEB_RESOURCE_SERVICE_H_ | 6 #define COMPONENTS_WEB_RESOURCE_WEB_RESOURCE_SERVICE_H_ |
7 | 7 |
| 8 #include <stdint.h> |
| 9 |
8 #include <string> | 10 #include <string> |
9 | 11 |
10 #include "base/callback_forward.h" | 12 #include "base/callback_forward.h" |
| 13 #include "base/macros.h" |
11 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
12 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
13 #include "base/memory/weak_ptr.h" | 16 #include "base/memory/weak_ptr.h" |
14 #include "components/web_resource/resource_request_allowed_notifier.h" | 17 #include "components/web_resource/resource_request_allowed_notifier.h" |
15 #include "net/url_request/url_fetcher_delegate.h" | 18 #include "net/url_request/url_fetcher_delegate.h" |
16 #include "url/gurl.h" | 19 #include "url/gurl.h" |
17 | 20 |
18 class PrefService; | 21 class PrefService; |
19 | 22 |
20 namespace base { | 23 namespace base { |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 PrefService* prefs_; | 68 PrefService* prefs_; |
66 | 69 |
67 private: | 70 private: |
68 // For the subclasses to process the result of a fetch. | 71 // For the subclasses to process the result of a fetch. |
69 virtual void Unpack(const base::DictionaryValue& parsed_json) = 0; | 72 virtual void Unpack(const base::DictionaryValue& parsed_json) = 0; |
70 | 73 |
71 // net::URLFetcherDelegate implementation: | 74 // net::URLFetcherDelegate implementation: |
72 void OnURLFetchComplete(const net::URLFetcher* source) override; | 75 void OnURLFetchComplete(const net::URLFetcher* source) override; |
73 | 76 |
74 // Schedules a fetch after |delay_ms| milliseconds. | 77 // Schedules a fetch after |delay_ms| milliseconds. |
75 void ScheduleFetch(int64 delay_ms); | 78 void ScheduleFetch(int64_t delay_ms); |
76 | 79 |
77 // Starts fetching data from the server. | 80 // Starts fetching data from the server. |
78 void StartFetch(); | 81 void StartFetch(); |
79 | 82 |
80 // Set |in_fetch_| to false, clean up temp directories (in the future). | 83 // Set |in_fetch_| to false, clean up temp directories (in the future). |
81 void EndFetch(); | 84 void EndFetch(); |
82 | 85 |
83 // Callbacks from the JSON parser. | 86 // Callbacks from the JSON parser. |
84 void OnUnpackFinished(scoped_ptr<base::Value> value); | 87 void OnUnpackFinished(scoped_ptr<base::Value> value); |
85 void OnUnpackError(const std::string& error_message); | 88 void OnUnpackError(const std::string& error_message); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 // So that we can delay our start so as not to affect start-up time; also, | 127 // So that we can delay our start so as not to affect start-up time; also, |
125 // so that we can schedule future cache updates. | 128 // so that we can schedule future cache updates. |
126 base::WeakPtrFactory<WebResourceService> weak_ptr_factory_; | 129 base::WeakPtrFactory<WebResourceService> weak_ptr_factory_; |
127 | 130 |
128 DISALLOW_COPY_AND_ASSIGN(WebResourceService); | 131 DISALLOW_COPY_AND_ASSIGN(WebResourceService); |
129 }; | 132 }; |
130 | 133 |
131 } // namespace web_resource | 134 } // namespace web_resource |
132 | 135 |
133 #endif // COMPONENTS_WEB_RESOURCE_WEB_RESOURCE_SERVICE_H_ | 136 #endif // COMPONENTS_WEB_RESOURCE_WEB_RESOURCE_SERVICE_H_ |
OLD | NEW |