Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(224)

Side by Side Diff: chrome/browser/autocomplete/autocomplete.cc

Issue 7321001: Changes SearchProvider to set the description of the first consecutive (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix DCHECK Created 9 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/autocomplete.h" 5 #include "chrome/browser/autocomplete/autocomplete.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after
499 profile_ = profile; 499 profile_ = profile;
500 } 500 }
501 501
502 void AutocompleteProvider::Stop() { 502 void AutocompleteProvider::Stop() {
503 done_ = true; 503 done_ = true;
504 } 504 }
505 505
506 void AutocompleteProvider::DeleteMatch(const AutocompleteMatch& match) { 506 void AutocompleteProvider::DeleteMatch(const AutocompleteMatch& match) {
507 } 507 }
508 508
509 void AutocompleteProvider::PostProcessResult(AutocompleteResult* result) {
510 }
511
509 AutocompleteProvider::~AutocompleteProvider() { 512 AutocompleteProvider::~AutocompleteProvider() {
510 Stop(); 513 Stop();
511 } 514 }
512 515
513 // static 516 // static
514 bool AutocompleteProvider::HasHTTPScheme(const string16& input) { 517 bool AutocompleteProvider::HasHTTPScheme(const string16& input) {
515 std::string utf8_input(UTF16ToUTF8(input)); 518 std::string utf8_input(UTF16ToUTF8(input));
516 url_parse::Component scheme; 519 url_parse::Component scheme;
517 if (url_util::FindAndCompareScheme(utf8_input, chrome::kViewSourceScheme, 520 if (url_util::FindAndCompareScheme(utf8_input, chrome::kViewSourceScheme,
518 &scheme)) 521 &scheme))
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after
942 #ifndef NDEBUG 945 #ifndef NDEBUG
943 result_.Validate(); 946 result_.Validate();
944 #endif 947 #endif
945 948
946 if (!done_) { 949 if (!done_) {
947 // This conditional needs to match the conditional in Start that invokes 950 // This conditional needs to match the conditional in Start that invokes
948 // StartExpireTimer. 951 // StartExpireTimer.
949 result_.CopyOldMatches(input_, last_result); 952 result_.CopyOldMatches(input_, last_result);
950 } 953 }
951 954
955 size_t start_size = result_.size();
956 for (ACProviders::const_iterator i(providers_.begin()); i != providers_.end();
957 ++i)
958 (*i)->PostProcessResult(&result_);
959 // Providers should not alter the number of matches, otherwise it's very
960 // likely the matches are no longer sorted.
961 DCHECK_EQ(start_size, result_.size());
962
952 bool notify_default_match = is_synchronous_pass; 963 bool notify_default_match = is_synchronous_pass;
953 if (!is_synchronous_pass) { 964 if (!is_synchronous_pass) {
954 const bool last_default_was_valid = 965 const bool last_default_was_valid =
955 last_result.default_match() != last_result.end(); 966 last_result.default_match() != last_result.end();
956 const bool default_is_valid = result_.default_match() != result_.end(); 967 const bool default_is_valid = result_.default_match() != result_.end();
957 // We've gotten async results. Send notification that the default match 968 // We've gotten async results. Send notification that the default match
958 // updated if fill_into_edit differs. We don't check the URL as that may 969 // updated if fill_into_edit differs. We don't check the URL as that may
959 // change for the default match even though the fill into edit hasn't 970 // change for the default match even though the fill into edit hasn't
960 // changed (see SearchProvider for one case of this). 971 // changed (see SearchProvider for one case of this).
961 notify_default_match = 972 notify_default_match =
(...skipping 26 matching lines...) Expand all
988 } 999 }
989 } 1000 }
990 done_ = true; 1001 done_ = true;
991 } 1002 }
992 1003
993 void AutocompleteController::StartExpireTimer() { 1004 void AutocompleteController::StartExpireTimer() {
994 if (result_.HasCopiedMatches()) 1005 if (result_.HasCopiedMatches())
995 expire_timer_.Start(base::TimeDelta::FromMilliseconds(kExpireTimeMS), 1006 expire_timer_.Start(base::TimeDelta::FromMilliseconds(kExpireTimeMS),
996 this, &AutocompleteController::ExpireCopiedEntries); 1007 this, &AutocompleteController::ExpireCopiedEntries);
997 } 1008 }
OLDNEW
« no previous file with comments | « chrome/browser/autocomplete/autocomplete.h ('k') | chrome/browser/autocomplete/autocomplete_edit.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698