| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/autocomplete/search_provider.h" | 5 #include "chrome/browser/autocomplete/search_provider.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <cmath> | 8 #include <cmath> |
| 9 | 9 |
| 10 #include "app/l10n_util.h" | 10 #include "app/l10n_util.h" |
| 11 #include "base/callback.h" | 11 #include "base/callback.h" |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 } | 221 } |
| 222 | 222 |
| 223 void SearchProvider::Stop() { | 223 void SearchProvider::Stop() { |
| 224 StopSuggest(); | 224 StopSuggest(); |
| 225 done_ = true; | 225 done_ = true; |
| 226 default_provider_suggest_text_.clear(); | 226 default_provider_suggest_text_.clear(); |
| 227 } | 227 } |
| 228 | 228 |
| 229 void SearchProvider::OnURLFetchComplete(const URLFetcher* source, | 229 void SearchProvider::OnURLFetchComplete(const URLFetcher* source, |
| 230 const GURL& url, | 230 const GURL& url, |
| 231 const URLRequestStatus& status, | 231 const net::URLRequestStatus& status, |
| 232 int response_code, | 232 int response_code, |
| 233 const ResponseCookies& cookie, | 233 const ResponseCookies& cookie, |
| 234 const std::string& data) { | 234 const std::string& data) { |
| 235 DCHECK(!done_); | 235 DCHECK(!done_); |
| 236 suggest_results_pending_--; | 236 suggest_results_pending_--; |
| 237 DCHECK_GE(suggest_results_pending_, 0); // Should never go negative. | 237 DCHECK_GE(suggest_results_pending_, 0); // Should never go negative. |
| 238 const net::HttpResponseHeaders* const response_headers = | 238 const net::HttpResponseHeaders* const response_headers = |
| 239 source->response_headers(); | 239 source->response_headers(); |
| 240 std::string json_data(data); | 240 std::string json_data(data); |
| 241 // JSON is supposed to be UTF-8, but some suggest service providers send JSON | 241 // JSON is supposed to be UTF-8, but some suggest service providers send JSON |
| (...skipping 635 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 877 match.description_class.push_back( | 877 match.description_class.push_back( |
| 878 ACMatchClassification(0, ACMatchClassification::DIM)); | 878 ACMatchClassification(0, ACMatchClassification::DIM)); |
| 879 // Only the first search match gets a description. | 879 // Only the first search match gets a description. |
| 880 return; | 880 return; |
| 881 | 881 |
| 882 default: | 882 default: |
| 883 break; | 883 break; |
| 884 } | 884 } |
| 885 } | 885 } |
| 886 } | 886 } |
| OLD | NEW |