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

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

Issue 2738003002: Add title to current page in zero suggest. (Closed)
Patch Set: Fix comments and add title in verbatim_match.cc 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
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/verbatim_match.h" 5 #include "components/omnibox/browser/verbatim_match.h"
6 6
7 #include "base/feature_list.h"
7 #include "base/logging.h" 8 #include "base/logging.h"
8 #include "components/omnibox/browser/autocomplete_classifier.h" 9 #include "components/omnibox/browser/autocomplete_classifier.h"
9 #include "components/omnibox/browser/autocomplete_input.h" 10 #include "components/omnibox/browser/autocomplete_input.h"
10 #include "components/omnibox/browser/autocomplete_provider_client.h" 11 #include "components/omnibox/browser/autocomplete_provider_client.h"
11 #include "components/omnibox/browser/history_url_provider.h" 12 #include "components/omnibox/browser/history_url_provider.h"
12 #include "url/gurl.h" 13 #include "url/gurl.h"
13 14
14 AutocompleteMatch VerbatimMatchForURL( 15 AutocompleteMatch VerbatimMatchForURL(
15 AutocompleteProviderClient* client, 16 AutocompleteProviderClient* client,
16 const AutocompleteInput& input, 17 const AutocompleteInput& input,
(...skipping 15 matching lines...) Expand all
32 } else { 33 } else {
33 client->Classify(input.text(), false, true, 34 client->Classify(input.text(), false, true,
34 input.current_page_classification(), &match, nullptr); 35 input.current_page_classification(), &match, nullptr);
35 } 36 }
36 match.allowed_to_be_default_match = true; 37 match.allowed_to_be_default_match = true;
37 // The default relevance to use for relevance match. Should be greater than 38 // The default relevance to use for relevance match. Should be greater than
38 // all relevance matches returned by the ZeroSuggest server. 39 // all relevance matches returned by the ZeroSuggest server.
39 const int kDefaultVerbatimRelevance = 1300; 40 const int kDefaultVerbatimRelevance = 1300;
40 match.relevance = 41 match.relevance =
41 verbatim_relevance >= 0 ? verbatim_relevance : kDefaultVerbatimRelevance; 42 verbatim_relevance >= 0 ? verbatim_relevance : kDefaultVerbatimRelevance;
43 if (base::FeatureList::IsEnabled(omnibox::kDisplayTitleForCurrentUrl)) {
Mark P 2017/04/12 17:58:46 nit: include-what-you-use (omnibox_field_trial.h d
gcomanici 2017/04/12 19:25:00 I couldn't find it there. Could you be more specif
Mark P 2017/04/12 19:38:01 Please include components/omnibox/browser/omnibox_
gcomanici 2017/04/12 20:48:22 Done.
44 match.description = input.current_title();
Mark P 2017/04/12 17:58:46 |destination_url| does not necessarily correspond
gcomanici 2017/04/12 19:25:00 I made a change based on your suggestion but witho
Mark P 2017/04/12 19:38:01 No, we want the description to be the title. That'
gcomanici 2017/04/12 20:48:22 Got it. Added a check on destination_url.
Mark P 2017/04/12 21:16:57 I was more thinking that you have callers pass in
gcomanici 2017/04/13 16:38:38 Makes sense. Done.
45 AutocompleteMatch::ClassifyLocationInString(
46 base::string16::npos, 0, match.description.length(),
47 ACMatchClassification::NONE, &match.description_class);
48 }
42 return match; 49 return match;
43 } 50 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698