OLD | NEW |
---|---|
1 // Copyright (c) 2011 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 "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
342 // really are. | 342 // really are. |
343 suggest_results_pending_ = 1; | 343 suggest_results_pending_ = 1; |
344 | 344 |
345 // Kick off a timer that will start the URL fetch if it completes before | 345 // Kick off a timer that will start the URL fetch if it completes before |
346 // the user types another character. | 346 // the user types another character. |
347 int delay = query_suggest_immediately_ ? 0 : kQueryDelayMs; | 347 int delay = query_suggest_immediately_ ? 0 : kQueryDelayMs; |
348 timer_.Start(TimeDelta::FromMilliseconds(delay), this, &SearchProvider::Run); | 348 timer_.Start(TimeDelta::FromMilliseconds(delay), this, &SearchProvider::Run); |
349 } | 349 } |
350 | 350 |
351 bool SearchProvider::IsQuerySuitableForSuggest() const { | 351 bool SearchProvider::IsQuerySuitableForSuggest() const { |
352 // Don't run Suggest when off the record, the engine doesn't support it, or | 352 // Don't run Suggest when incognito, the engine doesn't support it, or |
akalin
2011/03/08 03:07:47
maybe "when incognito" -> "in incognito mode"?
| |
353 // the user has disabled it. | 353 // the user has disabled it. |
354 if (profile_->IsOffTheRecord() || | 354 if (profile_->IsOffTheRecord() || |
355 (!providers_.valid_suggest_for_keyword_provider() && | 355 (!providers_.valid_suggest_for_keyword_provider() && |
356 !providers_.valid_suggest_for_default_provider()) || | 356 !providers_.valid_suggest_for_default_provider()) || |
357 !profile_->GetPrefs()->GetBoolean(prefs::kSearchSuggestEnabled)) | 357 !profile_->GetPrefs()->GetBoolean(prefs::kSearchSuggestEnabled)) |
358 return false; | 358 return false; |
359 | 359 |
360 // If the input type might be a URL, we take extra care so that private data | 360 // If the input type might be a URL, we take extra care so that private data |
361 // isn't sent to the server. | 361 // isn't sent to the server. |
362 | 362 |
(...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
880 match.description_class.push_back( | 880 match.description_class.push_back( |
881 ACMatchClassification(0, ACMatchClassification::DIM)); | 881 ACMatchClassification(0, ACMatchClassification::DIM)); |
882 // Only the first search match gets a description. | 882 // Only the first search match gets a description. |
883 return; | 883 return; |
884 | 884 |
885 default: | 885 default: |
886 break; | 886 break; |
887 } | 887 } |
888 } | 888 } |
889 } | 889 } |
OLD | NEW |