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

Unified Diff: components/omnibox/browser/clipboard_url_provider.cc

Issue 2738003002: Add title to current page in zero suggest. (Closed)
Patch Set: Remove debugging info. 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 side-by-side diff with in-line comments
Download patch
Index: components/omnibox/browser/clipboard_url_provider.cc
diff --git a/components/omnibox/browser/clipboard_url_provider.cc b/components/omnibox/browser/clipboard_url_provider.cc
index 27babb71d130dcf80aef7b851c515011c36b5d78..3fe1074966161124158d27f699cfd3e4a9a5e553 100644
--- a/components/omnibox/browser/clipboard_url_provider.cc
+++ b/components/omnibox/browser/clipboard_url_provider.cc
@@ -4,11 +4,13 @@
#include "components/omnibox/browser/clipboard_url_provider.h"
+#include "base/feature_list.h"
#include "base/logging.h"
#include "base/metrics/histogram_macros.h"
#include "base/strings/utf_string_conversions.h"
#include "components/omnibox/browser/autocomplete_input.h"
#include "components/omnibox/browser/autocomplete_provider_client.h"
+#include "components/omnibox/browser/omnibox_field_trial.h"
#include "components/omnibox/browser/verbatim_match.h"
#include "components/open_from_clipboard/clipboard_recent_content.h"
#include "components/strings/grit/components_strings.h"
@@ -47,8 +49,13 @@ void ClipboardURLProvider::Start(const AutocompleteInput& input,
// If the omnibox is not empty, add a default match.
// This match will be opened when the user presses "Enter".
if (!input.text().empty()) {
- AutocompleteMatch verbatim_match = VerbatimMatchForURL(
- client_, input, input.current_url(), history_url_provider_, -1);
+ const base::string16 description =
+ (base::FeatureList::IsEnabled(omnibox::kDisplayTitleForCurrentUrl))
+ ? input.current_title()
+ : base::string16();
+ AutocompleteMatch verbatim_match =
+ VerbatimMatchForURL(client_, input, input.current_url(), description,
+ history_url_provider_, -1);
matches_.push_back(verbatim_match);
}
UMA_HISTOGRAM_BOOLEAN("Omnibox.ClipboardSuggestionShownWithCurrentURL",
« no previous file with comments | « components/omnibox/browser/builtin_provider_unittest.cc ('k') | components/omnibox/browser/clipboard_url_provider_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698