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

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

Issue 2738003002: Add title to current page in zero suggest. (Closed)
Patch Set: Change the place where the title is added and some suggested renaming. 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/autocomplete_input.h" 5 #include "components/omnibox/browser/autocomplete_input.h"
6 6
7 #include "base/macros.h" 7 #include "base/macros.h"
8 #include "base/strings/string_split.h" 8 #include "base/strings/string_split.h"
9 #include "base/strings/string_util.h" 9 #include "base/strings/string_util.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 allow_exact_keyword_match_(true), 73 allow_exact_keyword_match_(true),
74 want_asynchronous_matches_(true), 74 want_asynchronous_matches_(true),
75 from_omnibox_focus_(false) { 75 from_omnibox_focus_(false) {
76 } 76 }
77 77
78 AutocompleteInput::AutocompleteInput( 78 AutocompleteInput::AutocompleteInput(
79 const base::string16& text, 79 const base::string16& text,
80 size_t cursor_position, 80 size_t cursor_position,
81 const std::string& desired_tld, 81 const std::string& desired_tld,
82 const GURL& current_url, 82 const GURL& current_url,
83 const base::string16& current_title,
83 metrics::OmniboxEventProto::PageClassification current_page_classification, 84 metrics::OmniboxEventProto::PageClassification current_page_classification,
84 bool prevent_inline_autocomplete, 85 bool prevent_inline_autocomplete,
85 bool prefer_keyword, 86 bool prefer_keyword,
86 bool allow_exact_keyword_match, 87 bool allow_exact_keyword_match,
87 bool want_asynchronous_matches, 88 bool want_asynchronous_matches,
88 bool from_omnibox_focus, 89 bool from_omnibox_focus,
89 const AutocompleteSchemeClassifier& scheme_classifier) 90 const AutocompleteSchemeClassifier& scheme_classifier)
90 : cursor_position_(cursor_position), 91 : cursor_position_(cursor_position),
91 current_url_(current_url), 92 current_url_(current_url),
93 current_title_(current_title),
92 current_page_classification_(current_page_classification), 94 current_page_classification_(current_page_classification),
93 prevent_inline_autocomplete_(prevent_inline_autocomplete), 95 prevent_inline_autocomplete_(prevent_inline_autocomplete),
94 prefer_keyword_(prefer_keyword), 96 prefer_keyword_(prefer_keyword),
95 allow_exact_keyword_match_(allow_exact_keyword_match), 97 allow_exact_keyword_match_(allow_exact_keyword_match),
96 want_asynchronous_matches_(want_asynchronous_matches), 98 want_asynchronous_matches_(want_asynchronous_matches),
97 from_omnibox_focus_(from_omnibox_focus) { 99 from_omnibox_focus_(from_omnibox_focus) {
98 DCHECK(cursor_position <= text.length() || 100 DCHECK(cursor_position <= text.length() ||
99 cursor_position == base::string16::npos) 101 cursor_position == base::string16::npos)
100 << "Text: '" << text << "', cp: " << cursor_position; 102 << "Text: '" << text << "', cp: " << cursor_position;
101 // None of the providers care about leading white space so we always trim it. 103 // None of the providers care about leading white space so we always trim it.
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after
506 cursor_position == base::string16::npos) 508 cursor_position == base::string16::npos)
507 << "Text: '" << text << "', cp: " << cursor_position; 509 << "Text: '" << text << "', cp: " << cursor_position;
508 text_ = text; 510 text_ = text;
509 cursor_position_ = cursor_position; 511 cursor_position_ = cursor_position;
510 parts_ = parts; 512 parts_ = parts;
511 } 513 }
512 514
513 void AutocompleteInput::Clear() { 515 void AutocompleteInput::Clear() {
514 text_.clear(); 516 text_.clear();
515 cursor_position_ = base::string16::npos; 517 cursor_position_ = base::string16::npos;
516 current_url_ = GURL(); 518 current_url_ = GURL();
Mark P 2017/04/12 05:07:56 Please clear the title here too.
gcomanici 2017/04/12 16:16:30 Done.
517 current_page_classification_ = metrics::OmniboxEventProto::INVALID_SPEC; 519 current_page_classification_ = metrics::OmniboxEventProto::INVALID_SPEC;
518 type_ = metrics::OmniboxInputType::INVALID; 520 type_ = metrics::OmniboxInputType::INVALID;
519 parts_ = url::Parsed(); 521 parts_ = url::Parsed();
520 scheme_.clear(); 522 scheme_.clear();
521 canonicalized_url_ = GURL(); 523 canonicalized_url_ = GURL();
522 prevent_inline_autocomplete_ = false; 524 prevent_inline_autocomplete_ = false;
523 prefer_keyword_ = false; 525 prefer_keyword_ = false;
524 allow_exact_keyword_match_ = false; 526 allow_exact_keyword_match_ = false;
525 want_asynchronous_matches_ = true; 527 want_asynchronous_matches_ = true;
526 from_omnibox_focus_ = false; 528 from_omnibox_focus_ = false;
527 terms_prefixed_by_http_or_https_.clear(); 529 terms_prefixed_by_http_or_https_.clear();
528 } 530 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698