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 <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 // | 98 // |
99 // |request_context_getter| is the URLRequestContextGetter used to download | 99 // |request_context_getter| is the URLRequestContextGetter used to download |
100 // the logo. | 100 // the logo. |
101 explicit LogoTracker( | 101 explicit LogoTracker( |
102 base::FilePath cached_logo_directory, | 102 base::FilePath cached_logo_directory, |
103 scoped_refptr<base::SequencedTaskRunner> file_task_runner, | 103 scoped_refptr<base::SequencedTaskRunner> file_task_runner, |
104 scoped_refptr<base::TaskRunner> background_task_runner, | 104 scoped_refptr<base::TaskRunner> background_task_runner, |
105 scoped_refptr<net::URLRequestContextGetter> request_context_getter, | 105 scoped_refptr<net::URLRequestContextGetter> request_context_getter, |
106 scoped_ptr<LogoDelegate> delegate); | 106 scoped_ptr<LogoDelegate> delegate); |
107 | 107 |
108 virtual ~LogoTracker(); | 108 ~LogoTracker() override; |
109 | 109 |
110 // Defines the server API for downloading and parsing the logo. This must be | 110 // Defines the server API for downloading and parsing the logo. This must be |
111 // called at least once before calling GetLogo(). | 111 // called at least once before calling GetLogo(). |
112 // | 112 // |
113 // |logo_url| is the URL from which the logo will be downloaded. If |logo_url| | 113 // |logo_url| is the URL from which the logo will be downloaded. If |logo_url| |
114 // is different than the current logo URL, any pending LogoObservers will be | 114 // is different than the current logo URL, any pending LogoObservers will be |
115 // canceled. | 115 // canceled. |
116 // | 116 // |
117 // |parse_logo_response_func| is a callback that will be used to parse the | 117 // |parse_logo_response_func| is a callback that will be used to parse the |
118 // server's response into a EncodedLogo object. |append_fingerprint_func| is a | 118 // server's response into a EncodedLogo object. |append_fingerprint_func| is a |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 // Called when the logo has been downloaded and parsed. |logo| will be NULL | 165 // Called when the logo has been downloaded and parsed. |logo| will be NULL |
166 // if the server's response was invalid. | 166 // if the server's response was invalid. |
167 void OnFreshLogoParsed(scoped_ptr<EncodedLogo> logo); | 167 void OnFreshLogoParsed(scoped_ptr<EncodedLogo> logo); |
168 | 168 |
169 // Called when the fresh logo has been decoded into an SkBitmap. |image| will | 169 // Called when the fresh logo has been decoded into an SkBitmap. |image| will |
170 // be NULL if decoding failed. | 170 // be NULL if decoding failed. |
171 void OnFreshLogoAvailable(scoped_ptr<EncodedLogo> logo, | 171 void OnFreshLogoAvailable(scoped_ptr<EncodedLogo> logo, |
172 const SkBitmap& image); | 172 const SkBitmap& image); |
173 | 173 |
174 // net::URLFetcherDelegate: | 174 // net::URLFetcherDelegate: |
175 virtual void OnURLFetchComplete(const net::URLFetcher* source) override; | 175 void OnURLFetchComplete(const net::URLFetcher* source) override; |
176 virtual void OnURLFetchDownloadProgress(const net::URLFetcher* source, | 176 void OnURLFetchDownloadProgress(const net::URLFetcher* source, |
177 int64 current, | 177 int64 current, |
178 int64 total) override; | 178 int64 total) override; |
179 | 179 |
180 // The URL from which the logo is fetched. | 180 // The URL from which the logo is fetched. |
181 GURL logo_url_; | 181 GURL logo_url_; |
182 | 182 |
183 // The function used to parse the logo response from the server. | 183 // The function used to parse the logo response from the server. |
184 ParseLogoResponse parse_logo_response_func_; | 184 ParseLogoResponse parse_logo_response_func_; |
185 | 185 |
186 // The function used to include the cached logo's fingerprint in the logo URL. | 186 // The function used to include the cached logo's fingerprint in the logo URL. |
187 AppendFingerprintToLogoURL append_fingerprint_func_; | 187 AppendFingerprintToLogoURL append_fingerprint_func_; |
188 | 188 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 scoped_refptr<net::URLRequestContextGetter> request_context_getter_; | 224 scoped_refptr<net::URLRequestContextGetter> request_context_getter_; |
225 | 225 |
226 base::WeakPtrFactory<LogoTracker> weak_ptr_factory_; | 226 base::WeakPtrFactory<LogoTracker> weak_ptr_factory_; |
227 | 227 |
228 DISALLOW_COPY_AND_ASSIGN(LogoTracker); | 228 DISALLOW_COPY_AND_ASSIGN(LogoTracker); |
229 }; | 229 }; |
230 | 230 |
231 } // namespace search_provider_logos | 231 } // namespace search_provider_logos |
232 | 232 |
233 #endif // COMPONENTS_SEARCH_PROVIDER_LOGOS_LOGO_TRACKER_H_ | 233 #endif // COMPONENTS_SEARCH_PROVIDER_LOGOS_LOGO_TRACKER_H_ |
OLD | NEW |