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

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

Issue 7607007: Add confidence to AutocompleteMatch. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Response to pkasting Created 9 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) 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_edit.h" 5 #include "chrome/browser/autocomplete/autocomplete_edit.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 197
198 FinalizeInstantQuery(view_->GetText(), suggestion, skip_inline_autocomplete); 198 FinalizeInstantQuery(view_->GetText(), suggestion, skip_inline_autocomplete);
199 return true; 199 return true;
200 } 200 }
201 201
202 bool AutocompleteEditModel::AcceptCurrentInstantPreview() { 202 bool AutocompleteEditModel::AcceptCurrentInstantPreview() {
203 return InstantController::CommitIfCurrent(controller_->GetInstant()); 203 return InstantController::CommitIfCurrent(controller_->GetInstant());
204 } 204 }
205 205
206 void AutocompleteEditModel::OnChanged() { 206 void AutocompleteEditModel::OnChanged() {
207 UMA_HISTOGRAM_COUNTS_100("Autocomplete.Confidence",
208 CurrentMatch().confidence * 100);
207 InstantController* instant = controller_->GetInstant(); 209 InstantController* instant = controller_->GetInstant();
208 string16 suggested_text; 210 string16 suggested_text;
209 TabContentsWrapper* tab = controller_->GetTabContentsWrapper(); 211 TabContentsWrapper* tab = controller_->GetTabContentsWrapper();
210 bool might_support_instant = false; 212 bool might_support_instant = false;
211 if (!in_revert_ && tab) { 213 if (!in_revert_ && tab) {
212 if (instant) { 214 if (instant) {
213 if (user_input_in_progress() && popup_->IsOpen()) { 215 if (user_input_in_progress() && popup_->IsOpen()) {
214 AutocompleteMatch current_match = CurrentMatch(); 216 AutocompleteMatch current_match = CurrentMatch();
215 if (current_match.destination_url == PermanentURL()) { 217 if (current_match.destination_url == PermanentURL()) {
216 // The destination is the same as the current url. This typically 218 // The destination is the same as the current url. This typically
(...skipping 793 matching lines...) Expand 10 before | Expand all | Expand 10 after
1010 // static 1012 // static
1011 bool AutocompleteEditModel::IsSpaceCharForAcceptingKeyword(wchar_t c) { 1013 bool AutocompleteEditModel::IsSpaceCharForAcceptingKeyword(wchar_t c) {
1012 switch (c) { 1014 switch (c) {
1013 case 0x0020: // Space 1015 case 0x0020: // Space
1014 case 0x3000: // Ideographic Space 1016 case 0x3000: // Ideographic Space
1015 return true; 1017 return true;
1016 default: 1018 default:
1017 return false; 1019 return false;
1018 } 1020 }
1019 } 1021 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698