OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_SEARCH_PROVIDER_LOGOS_LOGO_TRACKER_H_ | 5 #ifndef COMPONENTS_SEARCH_PROVIDER_LOGOS_LOGO_TRACKER_H_ |
6 #define COMPONENTS_SEARCH_PROVIDER_LOGOS_LOGO_TRACKER_H_ | 6 #define COMPONENTS_SEARCH_PROVIDER_LOGOS_LOGO_TRACKER_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 | 185 |
186 // Updates the metadata for the logo already stored in the cache. | 186 // Updates the metadata for the logo already stored in the cache. |
187 void SetCachedMetadata(const LogoMetadata& metadata); | 187 void SetCachedMetadata(const LogoMetadata& metadata); |
188 | 188 |
189 // Starts fetching the current logo over the network. | 189 // Starts fetching the current logo over the network. |
190 void FetchLogo(); | 190 void FetchLogo(); |
191 | 191 |
192 // Called when the logo has been downloaded and parsed. |logo| will be NULL | 192 // Called when the logo has been downloaded and parsed. |logo| will be NULL |
193 // if the server's response was invalid. | 193 // if the server's response was invalid. |
194 void OnFreshLogoParsed(bool* parsing_failed, | 194 void OnFreshLogoParsed(bool* parsing_failed, |
| 195 bool from_http_cache, |
195 std::unique_ptr<EncodedLogo> logo); | 196 std::unique_ptr<EncodedLogo> logo); |
196 | 197 |
197 // Called when the fresh logo has been decoded into an SkBitmap. |image| will | 198 // Called when the fresh logo has been decoded into an SkBitmap. |image| will |
198 // be NULL if decoding failed. | 199 // be NULL if decoding failed. |
199 void OnFreshLogoAvailable(std::unique_ptr<EncodedLogo> logo, | 200 void OnFreshLogoAvailable(std::unique_ptr<EncodedLogo> logo, |
200 bool parsing_failed, | 201 bool parsing_failed, |
| 202 bool from_http_cache, |
201 const SkBitmap& image); | 203 const SkBitmap& image); |
202 | 204 |
203 // net::URLFetcherDelegate: | 205 // net::URLFetcherDelegate: |
204 void OnURLFetchComplete(const net::URLFetcher* source) override; | 206 void OnURLFetchComplete(const net::URLFetcher* source) override; |
205 void OnURLFetchDownloadProgress(const net::URLFetcher* source, | 207 void OnURLFetchDownloadProgress(const net::URLFetcher* source, |
206 int64_t current, | 208 int64_t current, |
207 int64_t total, | 209 int64_t total, |
208 int64_t current_network_bytes) override; | 210 int64_t current_network_bytes) override; |
209 | 211 |
210 // The URL from which the logo is fetched. | 212 // The URL from which the logo is fetched. |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 scoped_refptr<net::URLRequestContextGetter> request_context_getter_; | 266 scoped_refptr<net::URLRequestContextGetter> request_context_getter_; |
265 | 267 |
266 base::WeakPtrFactory<LogoTracker> weak_ptr_factory_; | 268 base::WeakPtrFactory<LogoTracker> weak_ptr_factory_; |
267 | 269 |
268 DISALLOW_COPY_AND_ASSIGN(LogoTracker); | 270 DISALLOW_COPY_AND_ASSIGN(LogoTracker); |
269 }; | 271 }; |
270 | 272 |
271 } // namespace search_provider_logos | 273 } // namespace search_provider_logos |
272 | 274 |
273 #endif // COMPONENTS_SEARCH_PROVIDER_LOGOS_LOGO_TRACKER_H_ | 275 #endif // COMPONENTS_SEARCH_PROVIDER_LOGOS_LOGO_TRACKER_H_ |
OLD | NEW |