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

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

Issue 10909130: autocomplete: Add AutocompleteProvider::Type enum. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: update comments Created 8 years, 3 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"
11 #include "base/string_util.h" 11 #include "base/string_util.h"
12 #include "base/stringprintf.h" 12 #include "base/stringprintf.h"
13 #include "base/utf_string_conversions.h" 13 #include "base/utf_string_conversions.h"
14 #include "chrome/app/chrome_command_ids.h" 14 #include "chrome/app/chrome_command_ids.h"
15 #include "chrome/browser/autocomplete/autocomplete_classifier.h" 15 #include "chrome/browser/autocomplete/autocomplete_classifier.h"
16 #include "chrome/browser/autocomplete/autocomplete_classifier_factory.h" 16 #include "chrome/browser/autocomplete/autocomplete_classifier_factory.h"
17 #include "chrome/browser/autocomplete/autocomplete_input.h" 17 #include "chrome/browser/autocomplete/autocomplete_input.h"
18 #include "chrome/browser/autocomplete/autocomplete_log.h" 18 #include "chrome/browser/autocomplete/autocomplete_log.h"
19 #include "chrome/browser/autocomplete/autocomplete_provider.h"
19 #include "chrome/browser/autocomplete/extension_app_provider.h" 20 #include "chrome/browser/autocomplete/extension_app_provider.h"
20 #include "chrome/browser/autocomplete/keyword_provider.h" 21 #include "chrome/browser/autocomplete/keyword_provider.h"
21 #include "chrome/browser/autocomplete/search_provider.h" 22 #include "chrome/browser/autocomplete/search_provider.h"
22 #include "chrome/browser/bookmarks/bookmark_utils.h" 23 #include "chrome/browser/bookmarks/bookmark_utils.h"
23 #include "chrome/browser/command_updater.h" 24 #include "chrome/browser/command_updater.h"
24 #include "chrome/browser/extensions/api/omnibox/omnibox_api.h" 25 #include "chrome/browser/extensions/api/omnibox/omnibox_api.h"
25 #include "chrome/browser/google/google_url_tracker.h" 26 #include "chrome/browser/google/google_url_tracker.h"
26 #include "chrome/browser/instant/instant_controller.h" 27 #include "chrome/browser/instant/instant_controller.h"
27 #include "chrome/browser/net/predictor.h" 28 #include "chrome/browser/net/predictor.h"
28 #include "chrome/browser/net/url_fixer_upper.h" 29 #include "chrome/browser/net/url_fixer_upper.h"
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 77
77 OmniboxEditModel::State::~State() { 78 OmniboxEditModel::State::~State() {
78 } 79 }
79 80
80 /////////////////////////////////////////////////////////////////////////////// 81 ///////////////////////////////////////////////////////////////////////////////
81 // OmniboxEditModel 82 // OmniboxEditModel
82 83
83 OmniboxEditModel::OmniboxEditModel(OmniboxView* view, 84 OmniboxEditModel::OmniboxEditModel(OmniboxView* view,
84 OmniboxEditController* controller, 85 OmniboxEditController* controller,
85 Profile* profile) 86 Profile* profile)
86 : ALLOW_THIS_IN_INITIALIZER_LIST( 87 : ALLOW_THIS_IN_INITIALIZER_LIST(
Peter Kasting 2012/09/07 23:23:02 Nit: How about reducing the vertical whitespace sl
Daniel Erat 2012/09/08 16:37:36 Done (although this will never look non-broken to
87 autocomplete_controller_(new AutocompleteController(profile, this))), 88 autocomplete_controller_(
89 new AutocompleteController(
90 profile,
91 this,
92 AutocompleteClassifier::kDefaultOmniboxProviders))),
88 view_(view), 93 view_(view),
89 popup_(NULL), 94 popup_(NULL),
90 controller_(controller), 95 controller_(controller),
91 has_focus_(false), 96 has_focus_(false),
92 user_input_in_progress_(false), 97 user_input_in_progress_(false),
93 just_deleted_text_(false), 98 just_deleted_text_(false),
94 has_temporary_text_(false), 99 has_temporary_text_(false),
95 paste_state_(NONE), 100 paste_state_(NONE),
96 control_key_state_(UP), 101 control_key_state_(UP),
97 is_keyword_hint_(false), 102 is_keyword_hint_(false),
(...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after
519 autocomplete_controller_->input().text(), 524 autocomplete_controller_->input().text(),
520 just_deleted_text_, 525 just_deleted_text_,
521 autocomplete_controller_->input().type(), 526 autocomplete_controller_->input().type(),
522 popup_->selected_line(), 527 popup_->selected_line(),
523 -1, // don't yet know tab ID; set later if appropriate 528 -1, // don't yet know tab ID; set later if appropriate
524 ClassifyPage(controller_->GetTabContents()-> 529 ClassifyPage(controller_->GetTabContents()->
525 web_contents()->GetURL()), 530 web_contents()->GetURL()),
526 base::TimeTicks::Now() - time_user_first_modified_omnibox_, 531 base::TimeTicks::Now() - time_user_first_modified_omnibox_,
527 0, // inline autocomplete length; possibly set later 532 0, // inline autocomplete length; possibly set later
528 result()); 533 result());
529 DCHECK(user_input_in_progress_ || match.provider->name() == "ZeroSuggest") 534 DCHECK(user_input_in_progress_ ||
535 match.provider->type() == AutocompleteProvider::TYPE_ZERO_SUGGEST)
530 << "We didn't get here through the expected series of calls. " 536 << "We didn't get here through the expected series of calls. "
531 << "time_user_first_modified_omnibox_ is not set correctly and other " 537 << "time_user_first_modified_omnibox_ is not set correctly and other "
532 << "things may be wrong. Match provider: " << match.provider->name(); 538 << "things may be wrong. Match provider: " << match.provider->name();
533 if (index != OmniboxPopupModel::kNoMatch) 539 if (index != OmniboxPopupModel::kNoMatch)
534 log.selected_index = index; 540 log.selected_index = index;
535 else if (!has_temporary_text_) 541 else if (!has_temporary_text_)
536 log.inline_autocompleted_length = inline_autocomplete_text_.length(); 542 log.inline_autocompleted_length = inline_autocomplete_text_.length();
537 if (disposition == CURRENT_TAB) { 543 if (disposition == CURRENT_TAB) {
538 // If we know the destination is being opened in the current tab, 544 // If we know the destination is being opened in the current tab,
539 // we can easily get the tab ID. (If it's being opened in a new 545 // we can easily get the tab ID. (If it's being opened in a new
(...skipping 681 matching lines...) Expand 10 before | Expand all | Expand 10 after
1221 } 1227 }
1222 1228
1223 void OmniboxEditModel::ClassifyStringForPasteAndGo( 1229 void OmniboxEditModel::ClassifyStringForPasteAndGo(
1224 const string16& text, 1230 const string16& text,
1225 AutocompleteMatch* match, 1231 AutocompleteMatch* match,
1226 GURL* alternate_nav_url) const { 1232 GURL* alternate_nav_url) const {
1227 DCHECK(match); 1233 DCHECK(match);
1228 AutocompleteClassifierFactory::GetForProfile(profile_)->Classify(text, 1234 AutocompleteClassifierFactory::GetForProfile(profile_)->Classify(text,
1229 string16(), false, false, match, alternate_nav_url); 1235 string16(), false, false, match, alternate_nav_url);
1230 } 1236 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698