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

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

Issue 11316057: Omnibox: Log Elapsed Time Since Last Time The Default Match Changed (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Feedback comments. Created 8 years, 1 month 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 523 matching lines...) Expand 10 before | Expand all | Expand 10 after
534 OmniboxPopupModel::kNoMatch); 534 OmniboxPopupModel::kNoMatch);
535 } 535 }
536 536
537 void OmniboxEditModel::OpenMatch(const AutocompleteMatch& match, 537 void OmniboxEditModel::OpenMatch(const AutocompleteMatch& match,
538 WindowOpenDisposition disposition, 538 WindowOpenDisposition disposition,
539 const GURL& alternate_nav_url, 539 const GURL& alternate_nav_url,
540 size_t index) { 540 size_t index) {
541 // We only care about cases where there is a selection (i.e. the popup is 541 // We only care about cases where there is a selection (i.e. the popup is
542 // open). 542 // open).
543 if (popup_->IsOpen()) { 543 if (popup_->IsOpen()) {
544 const base::TimeTicks& now(base::TimeTicks::Now());
544 // TODO(sreeram): Handle is_temporary_text_set_by_instant_ correctly. 545 // TODO(sreeram): Handle is_temporary_text_set_by_instant_ correctly.
545 AutocompleteLog log( 546 AutocompleteLog log(
546 autocomplete_controller_->input().text(), 547 autocomplete_controller_->input().text(),
547 just_deleted_text_, 548 just_deleted_text_,
548 autocomplete_controller_->input().type(), 549 autocomplete_controller_->input().type(),
549 popup_->selected_line(), 550 popup_->selected_line(),
550 -1, // don't yet know tab ID; set later if appropriate 551 -1, // don't yet know tab ID; set later if appropriate
551 ClassifyPage(controller_->GetTabContents()-> 552 ClassifyPage(controller_->GetTabContents()->
552 web_contents()->GetURL()), 553 web_contents()->GetURL()),
553 base::TimeTicks::Now() - time_user_first_modified_omnibox_, 554 now - time_user_first_modified_omnibox_,
554 string16::npos, // inline autocomplete length; possibly set later 555 string16::npos, // inline autocomplete length; possibly set later
556 now - autocomplete_controller_->last_time_default_match_changed(),
555 result()); 557 result());
556 DCHECK(user_input_in_progress_ || 558 DCHECK(user_input_in_progress_ ||
557 match.provider->type() == AutocompleteProvider::TYPE_ZERO_SUGGEST) 559 match.provider->type() == AutocompleteProvider::TYPE_ZERO_SUGGEST)
558 << "We didn't get here through the expected series of calls. " 560 << "We didn't get here through the expected series of calls. "
559 << "time_user_first_modified_omnibox_ is not set correctly and other " 561 << "time_user_first_modified_omnibox_ is not set correctly and other "
560 << "things may be wrong. Match provider: " << match.provider->GetName(); 562 << "things may be wrong. Match provider: " << match.provider->GetName();
563 DCHECK(log.elapsed_time_since_user_first_modified_omnibox >=
564 log.elapsed_time_since_last_change_to_default_match)
565 << "We should've got the notification that the user modified the "
566 << "omnibox text at same time or before the most recent time the "
567 << "default match changed.";
561 if (index != OmniboxPopupModel::kNoMatch) 568 if (index != OmniboxPopupModel::kNoMatch)
562 log.selected_index = index; 569 log.selected_index = index;
563 else if (!has_temporary_text_) 570 else if (!has_temporary_text_)
564 log.inline_autocompleted_length = inline_autocomplete_text_.length(); 571 log.inline_autocompleted_length = inline_autocomplete_text_.length();
565 if (disposition == CURRENT_TAB) { 572 if (disposition == CURRENT_TAB) {
566 // If we know the destination is being opened in the current tab, 573 // If we know the destination is being opened in the current tab,
567 // we can easily get the tab ID. (If it's being opened in a new 574 // we can easily get the tab ID. (If it's being opened in a new
568 // tab, we don't know the tab ID yet.) 575 // tab, we don't know the tab ID yet.)
569 log.tab_id = SessionTabHelper::FromWebContents( 576 log.tab_id = SessionTabHelper::FromWebContents(
570 controller_->GetTabContents()->web_contents())->session_id().id(); 577 controller_->GetTabContents()->web_contents())->session_id().id();
(...skipping 717 matching lines...) Expand 10 before | Expand all | Expand 10 after
1288 } 1295 }
1289 1296
1290 void OmniboxEditModel::ClassifyStringForPasteAndGo( 1297 void OmniboxEditModel::ClassifyStringForPasteAndGo(
1291 const string16& text, 1298 const string16& text,
1292 AutocompleteMatch* match, 1299 AutocompleteMatch* match,
1293 GURL* alternate_nav_url) const { 1300 GURL* alternate_nav_url) const {
1294 DCHECK(match); 1301 DCHECK(match);
1295 AutocompleteClassifierFactory::GetForProfile(profile_)->Classify(text, 1302 AutocompleteClassifierFactory::GetForProfile(profile_)->Classify(text,
1296 string16(), false, false, match, alternate_nav_url); 1303 string16(), false, false, match, alternate_nav_url);
1297 } 1304 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698