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

Side by Side Diff: chrome/browser/autocomplete/autocomplete_input.cc

Issue 22364007: AutocompleteInput::PageClassification -> AutocompleteInput::OmniboxContext. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 4 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 "chrome/browser/autocomplete/autocomplete_input.h" 5 #include "chrome/browser/autocomplete/autocomplete_input.h"
6 6
7 #include "base/strings/string_util.h" 7 #include "base/strings/string_util.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "chrome/browser/external_protocol/external_protocol_handler.h" 9 #include "chrome/browser/external_protocol/external_protocol_handler.h"
10 #include "chrome/browser/profiles/profile_io_data.h" 10 #include "chrome/browser/profiles/profile_io_data.h"
(...skipping 12 matching lines...) Expand all
23 if (num_leading_chars_removed < *cursor_position) 23 if (num_leading_chars_removed < *cursor_position)
24 *cursor_position -= num_leading_chars_removed; 24 *cursor_position -= num_leading_chars_removed;
25 else 25 else
26 *cursor_position = 0; 26 *cursor_position = 0;
27 } 27 }
28 28
29 } // namespace 29 } // namespace
30 30
31 AutocompleteInput::AutocompleteInput() 31 AutocompleteInput::AutocompleteInput()
32 : cursor_position_(string16::npos), 32 : cursor_position_(string16::npos),
33 current_page_classification_(AutocompleteInput::INVALID_SPEC), 33 omnibox_context_(AutocompleteInput::INVALID_SPEC),
34 type_(INVALID), 34 type_(INVALID),
35 prevent_inline_autocomplete_(false), 35 prevent_inline_autocomplete_(false),
36 prefer_keyword_(false), 36 prefer_keyword_(false),
37 allow_exact_keyword_match_(true), 37 allow_exact_keyword_match_(true),
38 matches_requested_(ALL_MATCHES) { 38 matches_requested_(ALL_MATCHES) {
39 } 39 }
40 40
41 AutocompleteInput::AutocompleteInput( 41 AutocompleteInput::AutocompleteInput(
42 const string16& text, 42 const string16& text,
43 size_t cursor_position, 43 size_t cursor_position,
44 const string16& desired_tld, 44 const string16& desired_tld,
45 const GURL& current_url, 45 const GURL& current_url,
46 AutocompleteInput::PageClassification current_page_classification, 46 AutocompleteInput::OmniboxContext omnibox_context,
47 bool prevent_inline_autocomplete, 47 bool prevent_inline_autocomplete,
48 bool prefer_keyword, 48 bool prefer_keyword,
49 bool allow_exact_keyword_match, 49 bool allow_exact_keyword_match,
50 MatchesRequested matches_requested) 50 MatchesRequested matches_requested)
51 : cursor_position_(cursor_position), 51 : cursor_position_(cursor_position),
52 current_url_(current_url), 52 current_url_(current_url),
53 current_page_classification_(current_page_classification), 53 omnibox_context_(omnibox_context),
54 prevent_inline_autocomplete_(prevent_inline_autocomplete), 54 prevent_inline_autocomplete_(prevent_inline_autocomplete),
55 prefer_keyword_(prefer_keyword), 55 prefer_keyword_(prefer_keyword),
56 allow_exact_keyword_match_(allow_exact_keyword_match), 56 allow_exact_keyword_match_(allow_exact_keyword_match),
57 matches_requested_(matches_requested) { 57 matches_requested_(matches_requested) {
58 DCHECK(cursor_position <= text.length() || cursor_position == string16::npos) 58 DCHECK(cursor_position <= text.length() || cursor_position == string16::npos)
59 << "Text: '" << text << "', cp: " << cursor_position; 59 << "Text: '" << text << "', cp: " << cursor_position;
60 // None of the providers care about leading white space so we always trim it. 60 // None of the providers care about leading white space so we always trim it.
61 // Providers that care about trailing white space handle trimming themselves. 61 // Providers that care about trailing white space handle trimming themselves.
62 if ((TrimWhitespace(text, TRIM_LEADING, &text_) & TRIM_LEADING) != 0) 62 if ((TrimWhitespace(text, TRIM_LEADING, &text_) & TRIM_LEADING) != 0)
63 AdjustCursorPositionIfNecessary(text.length() - text_.length(), 63 AdjustCursorPositionIfNecessary(text.length() - text_.length(),
(...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after
504 << "Text: '" << text << "', cp: " << cursor_position; 504 << "Text: '" << text << "', cp: " << cursor_position;
505 text_ = text; 505 text_ = text;
506 cursor_position_ = cursor_position; 506 cursor_position_ = cursor_position;
507 parts_ = parts; 507 parts_ = parts;
508 } 508 }
509 509
510 void AutocompleteInput::Clear() { 510 void AutocompleteInput::Clear() {
511 text_.clear(); 511 text_.clear();
512 cursor_position_ = string16::npos; 512 cursor_position_ = string16::npos;
513 current_url_ = GURL(); 513 current_url_ = GURL();
514 current_page_classification_ = AutocompleteInput::INVALID_SPEC; 514 omnibox_context_ = AutocompleteInput::INVALID_SPEC;
515 type_ = INVALID; 515 type_ = INVALID;
516 parts_ = url_parse::Parsed(); 516 parts_ = url_parse::Parsed();
517 scheme_.clear(); 517 scheme_.clear();
518 canonicalized_url_ = GURL(); 518 canonicalized_url_ = GURL();
519 prevent_inline_autocomplete_ = false; 519 prevent_inline_autocomplete_ = false;
520 prefer_keyword_ = false; 520 prefer_keyword_ = false;
521 allow_exact_keyword_match_ = false; 521 allow_exact_keyword_match_ = false;
522 matches_requested_ = ALL_MATCHES; 522 matches_requested_ = ALL_MATCHES;
523 } 523 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698