| 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 #include "components/search_provider_logos/logo_tracker.h" | 5 #include "components/search_provider_logos/logo_tracker.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/task_runner_util.h" | 10 #include "base/task_runner_util.h" |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 DCHECK(!is_idle_); | 201 DCHECK(!is_idle_); |
| 202 | 202 |
| 203 GURL url; | 203 GURL url; |
| 204 std::string fingerprint; | 204 std::string fingerprint; |
| 205 if (cached_logo_ && !cached_logo_->metadata.fingerprint.empty() && | 205 if (cached_logo_ && !cached_logo_->metadata.fingerprint.empty() && |
| 206 cached_logo_->metadata.expiration_time >= clock_->Now()) { | 206 cached_logo_->metadata.expiration_time >= clock_->Now()) { |
| 207 fingerprint = cached_logo_->metadata.fingerprint; | 207 fingerprint = cached_logo_->metadata.fingerprint; |
| 208 } | 208 } |
| 209 url = append_queryparams_func_.Run(logo_url_, fingerprint, wants_cta_); | 209 url = append_queryparams_func_.Run(logo_url_, fingerprint, wants_cta_); |
| 210 | 210 |
| 211 fetcher_.reset(net::URLFetcher::Create(url, net::URLFetcher::GET, this)); | 211 fetcher_ = net::URLFetcher::Create(url, net::URLFetcher::GET, this); |
| 212 fetcher_->SetRequestContext(request_context_getter_.get()); | 212 fetcher_->SetRequestContext(request_context_getter_.get()); |
| 213 fetcher_->Start(); | 213 fetcher_->Start(); |
| 214 } | 214 } |
| 215 | 215 |
| 216 void LogoTracker::OnFreshLogoParsed(scoped_ptr<EncodedLogo> logo) { | 216 void LogoTracker::OnFreshLogoParsed(scoped_ptr<EncodedLogo> logo) { |
| 217 DCHECK(!is_idle_); | 217 DCHECK(!is_idle_); |
| 218 | 218 |
| 219 if (logo) | 219 if (logo) |
| 220 logo->metadata.source_url = logo_url_.spec(); | 220 logo->metadata.source_url = logo_url_.spec(); |
| 221 | 221 |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 296 void LogoTracker::OnURLFetchDownloadProgress(const net::URLFetcher* source, | 296 void LogoTracker::OnURLFetchDownloadProgress(const net::URLFetcher* source, |
| 297 int64 current, | 297 int64 current, |
| 298 int64 total) { | 298 int64 total) { |
| 299 if (total > kMaxDownloadBytes || current > kMaxDownloadBytes) { | 299 if (total > kMaxDownloadBytes || current > kMaxDownloadBytes) { |
| 300 LOG(WARNING) << "Search provider logo exceeded download size limit"; | 300 LOG(WARNING) << "Search provider logo exceeded download size limit"; |
| 301 ReturnToIdle(); | 301 ReturnToIdle(); |
| 302 } | 302 } |
| 303 } | 303 } |
| 304 | 304 |
| 305 } // namespace search_provider_logos | 305 } // namespace search_provider_logos |
| OLD | NEW |