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

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

Issue 1098843004: Omnibox - Do Not Allow HTTP/HTTPS Equivalence if User Explicitly Entered A Scheme (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: possible fix for mac code (cannot compile mac code myself) Created 5 years, 6 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_controller.h" 5 #include "chrome/browser/autocomplete/autocomplete_controller.h"
6 6
7 #include <set> 7 #include <set>
8 #include <string> 8 #include <string>
9 9
10 #include "base/format_macros.h" 10 #include "base/format_macros.h"
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 AutocompleteController::AutocompleteController( 163 AutocompleteController::AutocompleteController(
164 scoped_ptr<AutocompleteProviderClient> provider_client, 164 scoped_ptr<AutocompleteProviderClient> provider_client,
165 AutocompleteControllerDelegate* delegate, 165 AutocompleteControllerDelegate* delegate,
166 int provider_types) 166 int provider_types)
167 : delegate_(delegate), 167 : delegate_(delegate),
168 provider_client_(provider_client.Pass()), 168 provider_client_(provider_client.Pass()),
169 history_url_provider_(NULL), 169 history_url_provider_(NULL),
170 keyword_provider_(NULL), 170 keyword_provider_(NULL),
171 search_provider_(NULL), 171 search_provider_(NULL),
172 zero_suggest_provider_(NULL), 172 zero_suggest_provider_(NULL),
173 result_(provider_client_.get()),
173 stop_timer_duration_(OmniboxFieldTrial::StopTimerFieldTrialDuration()), 174 stop_timer_duration_(OmniboxFieldTrial::StopTimerFieldTrialDuration()),
174 done_(true), 175 done_(true),
175 in_start_(false), 176 in_start_(false),
176 template_url_service_(provider_client_->GetTemplateURLService()) { 177 template_url_service_(provider_client_->GetTemplateURLService()) {
177 provider_types &= ~OmniboxFieldTrial::GetDisabledProviderTypes(); 178 provider_types &= ~OmniboxFieldTrial::GetDisabledProviderTypes();
178 if (provider_types & AutocompleteProvider::TYPE_BOOKMARK) 179 if (provider_types & AutocompleteProvider::TYPE_BOOKMARK)
179 providers_.push_back(new BookmarkProvider(provider_client_.get())); 180 providers_.push_back(new BookmarkProvider(provider_client_.get()));
180 if (provider_types & AutocompleteProvider::TYPE_BUILTIN) 181 if (provider_types & AutocompleteProvider::TYPE_BUILTIN)
181 providers_.push_back(new BuiltinProvider(provider_client_.get())); 182 providers_.push_back(new BuiltinProvider(provider_client_.get()));
182 if (provider_types & AutocompleteProvider::TYPE_HISTORY_QUICK) 183 if (provider_types & AutocompleteProvider::TYPE_HISTORY_QUICK)
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
392 last_default_fill_into_edit = result_.default_match()->fill_into_edit; 393 last_default_fill_into_edit = result_.default_match()->fill_into_edit;
393 last_default_keyword = result_.default_match()->keyword; 394 last_default_keyword = result_.default_match()->keyword;
394 if (result_.default_match()->associated_keyword != NULL) 395 if (result_.default_match()->associated_keyword != NULL)
395 last_default_associated_keyword = 396 last_default_associated_keyword =
396 result_.default_match()->associated_keyword->keyword; 397 result_.default_match()->associated_keyword->keyword;
397 } 398 }
398 399
399 if (regenerate_result) 400 if (regenerate_result)
400 result_.Reset(); 401 result_.Reset();
401 402
402 AutocompleteResult last_result; 403 AutocompleteResult last_result(provider_client_.get());
403 last_result.Swap(&result_); 404 last_result.Swap(&result_);
404 405
405 for (Providers::const_iterator i(providers_.begin()); 406 for (Providers::const_iterator i(providers_.begin());
406 i != providers_.end(); ++i) 407 i != providers_.end(); ++i)
407 result_.AppendMatches(input_, (*i)->matches()); 408 result_.AppendMatches(input_, (*i)->matches());
408 409
409 // Sort the matches and trim to a small number of "best" matches. 410 // Sort the matches and trim to a small number of "best" matches.
410 result_.SortAndCull(input_, template_url_service_); 411 result_.SortAndCull(input_, template_url_service_);
411 412
412 // Need to validate before invoking CopyOldMatches as the old matches are not 413 // Need to validate before invoking CopyOldMatches as the old matches are not
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
638 expire_timer_.Stop(); 639 expire_timer_.Stop();
639 stop_timer_.Stop(); 640 stop_timer_.Stop();
640 done_ = true; 641 done_ = true;
641 if (clear_result && !result_.empty()) { 642 if (clear_result && !result_.empty()) {
642 result_.Reset(); 643 result_.Reset();
643 // NOTE: We pass in false since we're trying to only clear the popup, not 644 // NOTE: We pass in false since we're trying to only clear the popup, not
644 // touch the edit... this is all a mess and should be cleaned up :( 645 // touch the edit... this is all a mess and should be cleaned up :(
645 NotifyChanged(false); 646 NotifyChanged(false);
646 } 647 }
647 } 648 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698