| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "components/omnibox/browser/omnibox_edit_model.h" | 5 #include "components/omnibox/browser/omnibox_edit_model.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 // keyword hint mode and via what method. The possible values are listed | 73 // keyword hint mode and via what method. The possible values are listed |
| 74 // in the KeywordModeEntryMethod enum which is defined in the .h file. | 74 // in the KeywordModeEntryMethod enum which is defined in the .h file. |
| 75 const char kEnteredKeywordModeHistogram[] = "Omnibox.EnteredKeywordMode"; | 75 const char kEnteredKeywordModeHistogram[] = "Omnibox.EnteredKeywordMode"; |
| 76 | 76 |
| 77 // Histogram name which counts the number of milliseconds a user takes | 77 // Histogram name which counts the number of milliseconds a user takes |
| 78 // between focusing and editing the omnibox. | 78 // between focusing and editing the omnibox. |
| 79 const char kFocusToEditTimeHistogram[] = "Omnibox.FocusToEditTime"; | 79 const char kFocusToEditTimeHistogram[] = "Omnibox.FocusToEditTime"; |
| 80 | 80 |
| 81 // Histogram name which counts the number of milliseconds a user takes | 81 // Histogram name which counts the number of milliseconds a user takes |
| 82 // between focusing and opening an omnibox match. | 82 // between focusing and opening an omnibox match. |
| 83 const char kFocusToOpenTimeHistogram[] = "Omnibox.FocusToOpenTimeAnyPopupState"; | 83 const char kFocusToOpenTimeHistogram[] = |
| 84 "Omnibox.FocusToOpenTimeAnyPopupState2"; |
| 84 | 85 |
| 85 // Split the percentage match histograms into buckets based on the width of the | 86 // Split the percentage match histograms into buckets based on the width of the |
| 86 // omnibox. | 87 // omnibox. |
| 87 const int kPercentageMatchHistogramWidthBuckets[] = { 400, 700, 1200 }; | 88 const int kPercentageMatchHistogramWidthBuckets[] = { 400, 700, 1200 }; |
| 88 | 89 |
| 89 void RecordPercentageMatchHistogram(const base::string16& old_text, | 90 void RecordPercentageMatchHistogram(const base::string16& old_text, |
| 90 const base::string16& new_text, | 91 const base::string16& new_text, |
| 91 bool url_replacement_active, | 92 bool url_replacement_active, |
| 92 ui::PageTransition transition, | 93 ui::PageTransition transition, |
| 93 int omnibox_width) { | 94 int omnibox_width) { |
| (...skipping 630 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 724 if ((disposition == CURRENT_TAB) && client_->CurrentPageExists()) { | 725 if ((disposition == CURRENT_TAB) && client_->CurrentPageExists()) { |
| 725 // If we know the destination is being opened in the current tab, | 726 // If we know the destination is being opened in the current tab, |
| 726 // we can easily get the tab ID. (If it's being opened in a new | 727 // we can easily get the tab ID. (If it's being opened in a new |
| 727 // tab, we don't know the tab ID yet.) | 728 // tab, we don't know the tab ID yet.) |
| 728 log.tab_id = client_->GetSessionID().id(); | 729 log.tab_id = client_->GetSessionID().id(); |
| 729 } | 730 } |
| 730 autocomplete_controller()->AddProvidersInfo(&log.providers_info); | 731 autocomplete_controller()->AddProvidersInfo(&log.providers_info); |
| 731 client_->OnURLOpenedFromOmnibox(&log); | 732 client_->OnURLOpenedFromOmnibox(&log); |
| 732 OmniboxEventGlobalTracker::GetInstance()->OnURLOpened(&log); | 733 OmniboxEventGlobalTracker::GetInstance()->OnURLOpened(&log); |
| 733 LOCAL_HISTOGRAM_BOOLEAN("Omnibox.EventCount", true); | 734 LOCAL_HISTOGRAM_BOOLEAN("Omnibox.EventCount", true); |
| 734 DCHECK(!last_omnibox_focus_.is_null()) | 735 if (!last_omnibox_focus_.is_null()) { |
| 735 << "An omnibox focus should have occurred before opening a match."; | 736 // Only record focus to open time when a focus actually happened (as |
| 736 UMA_HISTOGRAM_TIMES(kFocusToOpenTimeHistogram, now - last_omnibox_focus_); | 737 // opposed to, say, dragging a link onto the omnibox). |
| 738 UMA_HISTOGRAM_TIMES(kFocusToOpenTimeHistogram, now - last_omnibox_focus_); |
| 739 } |
| 737 | 740 |
| 738 TemplateURLService* service = client_->GetTemplateURLService(); | 741 TemplateURLService* service = client_->GetTemplateURLService(); |
| 739 TemplateURL* template_url = match.GetTemplateURL(service, false); | 742 TemplateURL* template_url = match.GetTemplateURL(service, false); |
| 740 if (template_url) { | 743 if (template_url) { |
| 741 if (ui::PageTransitionTypeIncludingQualifiersIs( | 744 if (ui::PageTransitionTypeIncludingQualifiersIs( |
| 742 match.transition, ui::PAGE_TRANSITION_KEYWORD)) { | 745 match.transition, ui::PAGE_TRANSITION_KEYWORD)) { |
| 743 // The user is using a non-substituting keyword or is explicitly in | 746 // The user is using a non-substituting keyword or is explicitly in |
| 744 // keyword mode. | 747 // keyword mode. |
| 745 | 748 |
| 746 // Don't increment usage count for extension keywords. | 749 // Don't increment usage count for extension keywords. |
| (...skipping 786 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1533 // Update state and notify view if the omnibox has focus and the caret | 1536 // Update state and notify view if the omnibox has focus and the caret |
| 1534 // visibility changed. | 1537 // visibility changed. |
| 1535 const bool was_caret_visible = is_caret_visible(); | 1538 const bool was_caret_visible = is_caret_visible(); |
| 1536 focus_state_ = state; | 1539 focus_state_ = state; |
| 1537 if (focus_state_ != OMNIBOX_FOCUS_NONE && | 1540 if (focus_state_ != OMNIBOX_FOCUS_NONE && |
| 1538 is_caret_visible() != was_caret_visible) | 1541 is_caret_visible() != was_caret_visible) |
| 1539 view_->ApplyCaretVisibility(); | 1542 view_->ApplyCaretVisibility(); |
| 1540 | 1543 |
| 1541 client_->OnFocusChanged(focus_state_, reason); | 1544 client_->OnFocusChanged(focus_state_, reason); |
| 1542 } | 1545 } |
| OLD | NEW |