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

Side by Side Diff: components/omnibox/browser/clipboard_url_provider.cc

Issue 2792173004: Omnibox Metrics - Record Age of Clipboard Suggestions Shown (Closed)
Patch Set: clarified histograms Created 3 years, 8 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
« no previous file with comments | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/clipboard_url_provider.h" 5 #include "components/omnibox/browser/clipboard_url_provider.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/metrics/histogram_macros.h" 8 #include "base/metrics/histogram_macros.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "components/omnibox/browser/autocomplete_input.h" 10 #include "components/omnibox/browser/autocomplete_input.h"
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 DCHECK(url.is_valid()); 46 DCHECK(url.is_valid());
47 // If the omnibox is not empty, add a default match. 47 // If the omnibox is not empty, add a default match.
48 // This match will be opened when the user presses "Enter". 48 // This match will be opened when the user presses "Enter".
49 if (!input.text().empty()) { 49 if (!input.text().empty()) {
50 AutocompleteMatch verbatim_match = VerbatimMatchForURL( 50 AutocompleteMatch verbatim_match = VerbatimMatchForURL(
51 client_, input, input.current_url(), history_url_provider_, -1); 51 client_, input, input.current_url(), history_url_provider_, -1);
52 matches_.push_back(verbatim_match); 52 matches_.push_back(verbatim_match);
53 } 53 }
54 UMA_HISTOGRAM_BOOLEAN("Omnibox.ClipboardSuggestionShownWithCurrentURL", 54 UMA_HISTOGRAM_BOOLEAN("Omnibox.ClipboardSuggestionShownWithCurrentURL",
55 !matches_.empty()); 55 !matches_.empty());
56 UMA_HISTOGRAM_LONG_TIMES_100("Omnibox.ClipboardSuggestionShownAge",
57 clipboard_content_->GetClipboardContentAge());
56 58
57 // Add the clipboard match. The relevance is 800 to beat ZeroSuggest results. 59 // Add the clipboard match. The relevance is 800 to beat ZeroSuggest results.
58 AutocompleteMatch match(this, 800, false, AutocompleteMatchType::CLIPBOARD); 60 AutocompleteMatch match(this, 800, false, AutocompleteMatchType::CLIPBOARD);
59 match.destination_url = url; 61 match.destination_url = url;
60 match.contents.assign(url_formatter::FormatUrl( 62 match.contents.assign(url_formatter::FormatUrl(
61 url, url_formatter::kFormatUrlOmitAll, net::UnescapeRule::SPACES, 63 url, url_formatter::kFormatUrlOmitAll, net::UnescapeRule::SPACES,
62 nullptr, nullptr, nullptr)); 64 nullptr, nullptr, nullptr));
63 AutocompleteMatch::ClassifyLocationInString( 65 AutocompleteMatch::ClassifyLocationInString(
64 base::string16::npos, 0, match.contents.length(), 66 base::string16::npos, 0, match.contents.length(),
65 ACMatchClassification::URL, &match.contents_class); 67 ACMatchClassification::URL, &match.contents_class);
66 68
67 match.description.assign(l10n_util::GetStringUTF16(IDS_LINK_FROM_CLIPBOARD)); 69 match.description.assign(l10n_util::GetStringUTF16(IDS_LINK_FROM_CLIPBOARD));
68 AutocompleteMatch::ClassifyLocationInString( 70 AutocompleteMatch::ClassifyLocationInString(
69 base::string16::npos, 0, match.description.length(), 71 base::string16::npos, 0, match.description.length(),
70 ACMatchClassification::NONE, &match.description_class); 72 ACMatchClassification::NONE, &match.description_class);
71 73
72 matches_.push_back(match); 74 matches_.push_back(match);
73 } 75 }
OLDNEW
« no previous file with comments | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698