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

Side by Side Diff: chrome/browser/ui/omnibox/omnibox_edit_model.cc

Issue 10879043: Centralize logic around Instant modes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix tests Created 8 years, 4 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) 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/ui/omnibox/omnibox_edit_model.h" 5 #include "chrome/browser/ui/omnibox/omnibox_edit_model.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/format_macros.h" 9 #include "base/format_macros.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after
423 423
424 void OmniboxEditModel::StartAutocomplete( 424 void OmniboxEditModel::StartAutocomplete(
425 bool has_selected_text, 425 bool has_selected_text,
426 bool prevent_inline_autocomplete) const { 426 bool prevent_inline_autocomplete) const {
427 ClearPopupKeywordMode(); 427 ClearPopupKeywordMode();
428 428
429 bool keyword_is_selected = KeywordIsSelected(); 429 bool keyword_is_selected = KeywordIsSelected();
430 popup_->SetHoveredLine(OmniboxPopupModel::kNoMatch); 430 popup_->SetHoveredLine(OmniboxPopupModel::kNoMatch);
431 // We don't explicitly clear OmniboxPopupModel::manually_selected_match, as 431 // We don't explicitly clear OmniboxPopupModel::manually_selected_match, as
432 // Start ends up invoking OmniboxPopupModel::OnResultChanged which clears it. 432 // Start ends up invoking OmniboxPopupModel::OnResultChanged which clears it.
433 SearchProvider* search_provider = autocomplete_controller_->search_provider();
Peter Kasting 2012/08/24 22:29:52 This seems like a strange place for this code. It
sreeram 2012/08/24 23:18:12 The Instant mode changes happen at the chrome/ui/b
Peter Kasting 2012/08/24 23:25:44 What about having the SearchProvider reach out and
sreeram 2012/08/24 23:38:58 That's exactly what I had done in patchset 1. Scot
434 if (search_provider) {
435 search_provider->set_instant_suggest_enabled(controller_->GetInstant() &&
436 controller_->GetInstant()->IsSuggestEnabled());
437 }
433 autocomplete_controller_->Start( 438 autocomplete_controller_->Start(
434 user_text_, GetDesiredTLD(), 439 user_text_, GetDesiredTLD(),
435 prevent_inline_autocomplete || just_deleted_text_ || 440 prevent_inline_autocomplete || just_deleted_text_ ||
436 (has_selected_text && inline_autocomplete_text_.empty()) || 441 (has_selected_text && inline_autocomplete_text_.empty()) ||
437 (paste_state_ != NONE), keyword_is_selected, 442 (paste_state_ != NONE), keyword_is_selected,
438 keyword_is_selected || allow_exact_keyword_match_, 443 keyword_is_selected || allow_exact_keyword_match_,
439 AutocompleteInput::ALL_MATCHES); 444 AutocompleteInput::ALL_MATCHES);
440 } 445 }
441 446
442 void OmniboxEditModel::StopAutocomplete() { 447 void OmniboxEditModel::StopAutocomplete() {
(...skipping 773 matching lines...) Expand 10 before | Expand all | Expand 10 after
1216 } 1221 }
1217 1222
1218 void OmniboxEditModel::ClassifyStringForPasteAndGo( 1223 void OmniboxEditModel::ClassifyStringForPasteAndGo(
1219 const string16& text, 1224 const string16& text,
1220 AutocompleteMatch* match, 1225 AutocompleteMatch* match,
1221 GURL* alternate_nav_url) const { 1226 GURL* alternate_nav_url) const {
1222 DCHECK(match); 1227 DCHECK(match);
1223 AutocompleteClassifierFactory::GetForProfile(profile_)->Classify(text, 1228 AutocompleteClassifierFactory::GetForProfile(profile_)->Classify(text,
1224 string16(), false, false, match, alternate_nav_url); 1229 string16(), false, false, match, alternate_nav_url);
1225 } 1230 }
OLDNEW
« chrome/browser/instant/instant_controller.h ('K') | « chrome/browser/instant/instant_controller.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698