1116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch// Copyright 2014 The Chromium Authors. All rights reserved.
25821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be
35821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// found in the LICENSE file.
45821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
55f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)#ifndef COMPONENTS_OMNIBOX_AUTOCOMPLETE_INPUT_H_
65f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)#define COMPONENTS_OMNIBOX_AUTOCOMPLETE_INPUT_H_
75821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
85821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include <string>
95821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "base/basictypes.h"
11ba5b9a6411cb1792fd21f0a078d7a25cd1ceec16Ben Murdoch#include "base/gtest_prod_util.h"
12868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)#include "base/strings/string16.h"
136d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles)#include "components/metrics/proto/omnibox_event.pb.h"
14f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)#include "components/metrics/proto/omnibox_input_type.pb.h"
15eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch#include "url/gurl.h"
16eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch#include "url/url_parse.h"
175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
18116680a4aac90f2aa7413d9095a592090648e557Ben Murdochclass AutocompleteSchemeClassifier;
19116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch
205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// The user input for an autocomplete query.  Allows copying.
215821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class AutocompleteInput {
225821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) public:
235821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  AutocompleteInput();
242a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  // |text| and |cursor_position| represent the input query and location of
252a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  // the cursor with the query respectively.  |cursor_position| may be set to
26a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  // base::string16::npos if the input |text| doesn't come directly from the
27a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  // user's typing.
282a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  //
292a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  // |desired_tld| is the user's desired TLD, if one is not already present in
302a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  // the text to autocomplete.  When this is non-empty, it also implies that
312a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  // "www." should be prepended to the domain where possible. The |desired_tld|
322a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  // should not contain a leading '.' (use "com" instead of ".com").
332a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  //
342a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  // If |current_url| is set to a valid search result page URL, providers can
352a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  // use it to perform query refinement. For example, if it is set to an image
362a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  // search result page, the search provider may generate an image search URL.
372a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  // Query refinement is only used by mobile ports, so only these set
382a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  // |current_url| to a non-empty string.
392a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  //
40d3868032626d59662ff73b372b5d584c1d144c53Ben Murdoch  // |current_page_classification| represents the type of page the user is
41d3868032626d59662ff73b372b5d584c1d144c53Ben Murdoch  // viewing and manner in which the user is accessing the omnibox; it's
42d3868032626d59662ff73b372b5d584c1d144c53Ben Murdoch  // more than simply the URL.  It includes, for example, whether the page
43d3868032626d59662ff73b372b5d584c1d144c53Ben Murdoch  // is a search result page doing search term replacement or not.
44d3868032626d59662ff73b372b5d584c1d144c53Ben Murdoch  //
452a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  // |prevent_inline_autocomplete| is true if the generated result set should
462a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  // not require inline autocomplete for the default match.  This is difficult
472a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  // to explain in the abstract; the practical use case is that after the user
482a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  // deletes text in the edit, the HistoryURLProvider should make sure not to
492a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  // promote a match requiring inline autocomplete too highly.
502a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  //
512a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  // |prefer_keyword| should be true when the keyword UI is onscreen; this will
522a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  // bias the autocomplete result set toward the keyword provider when the input
532a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  // string is a bare keyword.
542a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  //
552a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  // |allow_exact_keyword_match| should be false when triggering keyword mode on
562a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  // the input string would be surprising or wrong, e.g. when highlighting text
572a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  // in a page and telling the browser to search for it or navigate to it. This
582a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  // parameter only applies to substituting keywords.
59d3868032626d59662ff73b372b5d584c1d144c53Ben Murdoch  //
60116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch  // If |want_asynchronous_matches| is false the controller asks the providers
61116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch  // to only return matches which are synchronously available, which should mean
62116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch  // that all providers will be done immediately.
63116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch  //
64116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch  // |scheme_classifier| is passed to Parse() to help determine the type of
65116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch  // input this is; see comments there.
66a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  AutocompleteInput(const base::string16& text,
672a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)                    size_t cursor_position,
68a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)                    const base::string16& desired_tld,
692a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)                    const GURL& current_url,
706d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles)                    metrics::OmniboxEventProto::PageClassification
716d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles)                        current_page_classification,
725821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)                    bool prevent_inline_autocomplete,
735821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)                    bool prefer_keyword,
745821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)                    bool allow_exact_keyword_match,
75116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch                    bool want_asynchronous_matches,
76116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch                    const AutocompleteSchemeClassifier& scheme_classifier);
775821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  ~AutocompleteInput();
785821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
795821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // If type is |FORCED_QUERY| and |text| starts with '?', it is removed.
802a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  // Returns number of leading characters removed.
816d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles)  static size_t RemoveForcedQueryStringIfNecessary(
826d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles)      metrics::OmniboxInputType::Type type,
836d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles)      base::string16* text);
845821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
855821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Converts |type| to a string representation.  Used in logging.
866d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles)  static std::string TypeToString(metrics::OmniboxInputType::Type type);
875821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
88116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch  // Parses |text| (including an optional |desired_tld|) and returns the type of
89116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch  // input this will be interpreted as.  |scheme_classifier| is used to check
90116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch  // the scheme in |text| is known and registered in the current environment.
915821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // The components of the input are stored in the output parameter |parts|, if
925821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // it is non-NULL. The scheme is stored in |scheme| if it is non-NULL. The
935821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // canonicalized URL is stored in |canonicalized_url|; however, this URL is
945821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // not guaranteed to be valid, especially if the parsed type is, e.g., QUERY.
956d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles)  static metrics::OmniboxInputType::Type Parse(
966d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles)      const base::string16& text,
976d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles)      const base::string16& desired_tld,
98116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch      const AutocompleteSchemeClassifier& scheme_classifier,
996d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles)      url::Parsed* parts,
1006d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles)      base::string16* scheme,
1016d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles)      GURL* canonicalized_url);
1025821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1035821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Parses |text| and fill |scheme| and |host| by the positions of them.
1045821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // The results are almost as same as the result of Parse(), but if the scheme
1055821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // is view-source, this function returns the positions of scheme and host
1065821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // in the URL qualified by "view-source:" prefix.
107116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch  static void ParseForEmphasizeComponents(
108116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch      const base::string16& text,
109116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch      const AutocompleteSchemeClassifier& scheme_classifier,
110116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch      url::Component* scheme,
111116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch      url::Component* host);
1125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Code that wants to format URLs with a format flag including
1145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // net::kFormatUrlOmitTrailingSlashOnBareHostname risk changing the meaning if
1155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // the result is then parsed as AutocompleteInput.  Such code can call this
1165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // function with the URL and its formatted string, and it will return a
1175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // formatted string with the same meaning as the original URL (i.e. it will
118116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch  // re-append a slash if necessary).  Because this uses Parse() under the hood
119116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch  // to determine the meaning of the different strings, callers need to supply a
120116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch  // |scheme_classifier| to pass to Parse().
121a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  static base::string16 FormattedStringWithEquivalentMeaning(
1225821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      const GURL& url,
123116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch      const base::string16& formatted_url,
124116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch      const AutocompleteSchemeClassifier& scheme_classifier);
1255821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1265821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Returns the number of non-empty components in |parts| besides the host.
1275c02ac1a9c1b504631c0a3d2b6e737b5d738bae1Bo Liu  static int NumNonHostComponents(const url::Parsed& parts);
1285821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1290f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)  // Returns whether |text| begins "http:" or "view-source:http:".
130a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  static bool HasHTTPScheme(const base::string16& text);
1310f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)
1325821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // User-provided text to be completed.
133a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  const base::string16& text() const { return text_; }
1345821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
135a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  // Returns 0-based cursor position within |text_| or base::string16::npos if
136a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  // not used.
1372a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  size_t cursor_position() const { return cursor_position_; }
1382a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
1395821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Use of this setter is risky, since no other internal state is updated
1402a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  // besides |text_|, |cursor_position_| and |parts_|.  Only callers who know
1412a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  // that they're not changing the type/scheme/etc. should use this.
142a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  void UpdateText(const base::string16& text,
1432a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)                  size_t cursor_position,
1445c02ac1a9c1b504631c0a3d2b6e737b5d738bae1Bo Liu                  const url::Parsed& parts);
1455821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1462a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  // The current URL, or an invalid GURL if query refinement is not desired.
1472a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  const GURL& current_url() const { return current_url_; }
1485821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
149d3868032626d59662ff73b372b5d584c1d144c53Ben Murdoch  // The type of page that is currently behind displayed and how it is
150d3868032626d59662ff73b372b5d584c1d144c53Ben Murdoch  // displayed (e.g., with search term replacement or without).
1516d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles)  metrics::OmniboxEventProto::PageClassification current_page_classification()
1526d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles)      const {
153d3868032626d59662ff73b372b5d584c1d144c53Ben Murdoch    return current_page_classification_;
154d3868032626d59662ff73b372b5d584c1d144c53Ben Murdoch  }
155d3868032626d59662ff73b372b5d584c1d144c53Ben Murdoch
1565821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // The type of input supplied.
1576d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles)  metrics::OmniboxInputType::Type type() const { return type_; }
1585821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1595821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Returns parsed URL components.
1605c02ac1a9c1b504631c0a3d2b6e737b5d738bae1Bo Liu  const url::Parsed& parts() const { return parts_; }
1615821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1625821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // The scheme parsed from the provided text; only meaningful when type_ is
1635821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // URL.
164a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  const base::string16& scheme() const { return scheme_; }
1655821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1665821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // The input as an URL to navigate to, if possible.
1675821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  const GURL& canonicalized_url() const { return canonicalized_url_; }
1685821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1695821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Returns whether inline autocompletion should be prevented.
1705821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  bool prevent_inline_autocomplete() const {
1715821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    return prevent_inline_autocomplete_;
1725821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  }
1735821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1745821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Returns whether, given an input string consisting solely of a substituting
1755821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // keyword, we should score it like a non-substituting keyword.
1765821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  bool prefer_keyword() const { return prefer_keyword_; }
1775821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1785821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Returns whether this input is allowed to be treated as an exact
1795821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // keyword match.  If not, the default result is guaranteed not to be a
1805821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // keyword search, even if the input is "<keyword> <search string>".
1815821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  bool allow_exact_keyword_match() const { return allow_exact_keyword_match_; }
1825821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1830529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch  // Returns whether providers should be allowed to make asynchronous requests
1840529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch  // when processing this input.
1850529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch  bool want_asynchronous_matches() const { return want_asynchronous_matches_; }
1865821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1875821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Resets all internal variables to the null-constructed state.
1885821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void Clear();
1895821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1905821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) private:
191ba5b9a6411cb1792fd21f0a078d7a25cd1ceec16Ben Murdoch  FRIEND_TEST_ALL_PREFIXES(AutocompleteProviderTest, GetDestinationURL);
192ba5b9a6411cb1792fd21f0a078d7a25cd1ceec16Ben Murdoch
1932a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  // NOTE: Whenever adding a new field here, please make sure to update Clear()
1942a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  // method.
195a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  base::string16 text_;
1962a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  size_t cursor_position_;
1972a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  GURL current_url_;
1986d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles)  metrics::OmniboxEventProto::PageClassification current_page_classification_;
1996d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles)  metrics::OmniboxInputType::Type type_;
2005c02ac1a9c1b504631c0a3d2b6e737b5d738bae1Bo Liu  url::Parsed parts_;
201a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  base::string16 scheme_;
2025821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  GURL canonicalized_url_;
2035821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  bool prevent_inline_autocomplete_;
2045821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  bool prefer_keyword_;
2055821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  bool allow_exact_keyword_match_;
2060529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch  bool want_asynchronous_matches_;
2075821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)};
2085821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2095f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)#endif  // COMPONENTS_OMNIBOX_AUTOCOMPLETE_INPUT_H_
210