OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "chrome/browser/net/sdch_dictionary_fetcher.h" | 5 #include "chrome/browser/net/sdch_dictionary_fetcher.h" |
| 6 |
6 #include "chrome/browser/profile.h" | 7 #include "chrome/browser/profile.h" |
| 8 #include "net/url_request/url_request_status.h" |
7 | 9 |
8 void SdchDictionaryFetcher::Schedule(const GURL& dictionary_url) { | 10 void SdchDictionaryFetcher::Schedule(const GURL& dictionary_url) { |
9 // Avoid pushing duplicate copy onto queue. We may fetch this url again later | 11 // Avoid pushing duplicate copy onto queue. We may fetch this url again later |
10 // and get a different dictionary, but there is no reason to have it in the | 12 // and get a different dictionary, but there is no reason to have it in the |
11 // queue twice at one time. | 13 // queue twice at one time. |
12 if (!fetch_queue_.empty() && fetch_queue_.back() == dictionary_url) { | 14 if (!fetch_queue_.empty() && fetch_queue_.back() == dictionary_url) { |
13 SdchManager::SdchErrorRecovery( | 15 SdchManager::SdchErrorRecovery( |
14 SdchManager::DICTIONARY_ALREADY_SCHEDULED_TO_DOWNLOAD); | 16 SdchManager::DICTIONARY_ALREADY_SCHEDULED_TO_DOWNLOAD); |
15 return; | 17 return; |
16 } | 18 } |
(...skipping 25 matching lines...) Expand all Loading... |
42 const GURL& url, | 44 const GURL& url, |
43 const URLRequestStatus& status, | 45 const URLRequestStatus& status, |
44 int response_code, | 46 int response_code, |
45 const ResponseCookies& cookies, | 47 const ResponseCookies& cookies, |
46 const std::string& data) { | 48 const std::string& data) { |
47 if ((200 == response_code) && (status.status() == URLRequestStatus::SUCCESS)) | 49 if ((200 == response_code) && (status.status() == URLRequestStatus::SUCCESS)) |
48 SdchManager::Global()->AddSdchDictionary(data, url); | 50 SdchManager::Global()->AddSdchDictionary(data, url); |
49 current_fetch_.reset(NULL); | 51 current_fetch_.reset(NULL); |
50 ScheduleDelayedRun(); | 52 ScheduleDelayedRun(); |
51 } | 53 } |
OLD | NEW |