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

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

Issue 10829068: Add query formulation time to aqs (assisted query stats) parameter (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
10 #include "base/string_util.h" 11 #include "base/string_util.h"
12 #include "base/stringprintf.h"
11 #include "base/utf_string_conversions.h" 13 #include "base/utf_string_conversions.h"
12 #include "chrome/app/chrome_command_ids.h" 14 #include "chrome/app/chrome_command_ids.h"
13 #include "chrome/browser/autocomplete/autocomplete_classifier.h" 15 #include "chrome/browser/autocomplete/autocomplete_classifier.h"
14 #include "chrome/browser/autocomplete/autocomplete_classifier_factory.h" 16 #include "chrome/browser/autocomplete/autocomplete_classifier_factory.h"
15 #include "chrome/browser/autocomplete/autocomplete_input.h" 17 #include "chrome/browser/autocomplete/autocomplete_input.h"
16 #include "chrome/browser/autocomplete/autocomplete_log.h" 18 #include "chrome/browser/autocomplete/autocomplete_log.h"
17 #include "chrome/browser/autocomplete/extension_app_provider.h" 19 #include "chrome/browser/autocomplete/extension_app_provider.h"
18 #include "chrome/browser/autocomplete/keyword_provider.h" 20 #include "chrome/browser/autocomplete/keyword_provider.h"
19 #include "chrome/browser/autocomplete/search_provider.h" 21 #include "chrome/browser/autocomplete/search_provider.h"
20 #include "chrome/browser/bookmarks/bookmark_utils.h" 22 #include "chrome/browser/bookmarks/bookmark_utils.h"
(...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after
596 } 598 }
597 599
598 if (disposition != NEW_BACKGROUND_TAB) { 600 if (disposition != NEW_BACKGROUND_TAB) {
599 in_revert_ = true; 601 in_revert_ = true;
600 view_->RevertAll(); // Revert the box to its unedited state 602 view_->RevertAll(); // Revert the box to its unedited state
601 } 603 }
602 604
603 if (match.type == AutocompleteMatch::EXTENSION_APP) { 605 if (match.type == AutocompleteMatch::EXTENSION_APP) {
604 ExtensionAppProvider::LaunchAppFromOmnibox(match, profile_, disposition); 606 ExtensionAppProvider::LaunchAppFromOmnibox(match, profile_, disposition);
605 } else { 607 } else {
606 controller_->OnAutocompleteAccept(match.destination_url, disposition, 608 GURL destination_url(match.destination_url);
609 // Append the query formulation time (time from when the user first typed a
610 // character into the omnibox to when the user selected a query) to the AQS
611 // parameter if other AQS parameters were already populated.
612 if (template_url && match.search_terms_args.get() &&
613 !match.search_terms_args->assisted_query_stats.empty()) {
614 base::TimeDelta query_formulation_time =
615 base::TimeTicks::Now() - time_user_first_modified_omnibox_;
616 TemplateURLRef::SearchTermsArgs search_terms_args(
617 *match.search_terms_args);
618 search_terms_args.assisted_query_stats +=
619 base::StringPrintf(".%" PRId64,
620 query_formulation_time.InMilliseconds());
621 destination_url = GURL(template_url->url_ref().
622 ReplaceSearchTerms(search_terms_args));
623 }
624 controller_->OnAutocompleteAccept(destination_url, disposition,
607 match.transition, alternate_nav_url); 625 match.transition, alternate_nav_url);
608 } 626 }
609 627
610 if (match.starred) 628 if (match.starred)
611 bookmark_utils::RecordBookmarkLaunch(bookmark_utils::LAUNCH_OMNIBOX); 629 bookmark_utils::RecordBookmarkLaunch(bookmark_utils::LAUNCH_OMNIBOX);
612 630
613 InstantController* instant = controller_->GetInstant(); 631 InstantController* instant = controller_->GetInstant();
614 if (instant && !popup_->IsOpen()) 632 if (instant && !popup_->IsOpen())
615 instant->DestroyPreviewContents(); 633 instant->DestroyPreviewContents();
616 in_revert_ = false; 634 in_revert_ = false;
(...skipping 556 matching lines...) Expand 10 before | Expand all | Expand 10 after
1173 } 1191 }
1174 1192
1175 void OmniboxEditModel::ClassifyStringForPasteAndGo( 1193 void OmniboxEditModel::ClassifyStringForPasteAndGo(
1176 const string16& text, 1194 const string16& text,
1177 AutocompleteMatch* match, 1195 AutocompleteMatch* match,
1178 GURL* alternate_nav_url) const { 1196 GURL* alternate_nav_url) const {
1179 DCHECK(match); 1197 DCHECK(match);
1180 AutocompleteClassifierFactory::GetForProfile(profile_)->Classify(text, 1198 AutocompleteClassifierFactory::GetForProfile(profile_)->Classify(text,
1181 string16(), false, false, match, alternate_nav_url); 1199 string16(), false, false, match, alternate_nav_url);
1182 } 1200 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698