OLD | NEW |
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 #ifndef CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_INPUT_H_ | 5 #ifndef CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_INPUT_H_ |
6 #define CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_INPUT_H_ | 6 #define CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_INPUT_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 // function with the URL and its formatted string, and it will return a | 176 // function with the URL and its formatted string, and it will return a |
177 // formatted string with the same meaning as the original URL (i.e. it will | 177 // formatted string with the same meaning as the original URL (i.e. it will |
178 // re-append a slash if necessary). | 178 // re-append a slash if necessary). |
179 static string16 FormattedStringWithEquivalentMeaning( | 179 static string16 FormattedStringWithEquivalentMeaning( |
180 const GURL& url, | 180 const GURL& url, |
181 const string16& formatted_url); | 181 const string16& formatted_url); |
182 | 182 |
183 // Returns the number of non-empty components in |parts| besides the host. | 183 // Returns the number of non-empty components in |parts| besides the host. |
184 static int NumNonHostComponents(const url_parse::Parsed& parts); | 184 static int NumNonHostComponents(const url_parse::Parsed& parts); |
185 | 185 |
| 186 // Returns whether |text| begins "http:" or "view-source:http:". |
| 187 static bool HasHTTPScheme(const string16& text); |
| 188 |
186 // User-provided text to be completed. | 189 // User-provided text to be completed. |
187 const string16& text() const { return text_; } | 190 const string16& text() const { return text_; } |
188 | 191 |
189 // Returns 0-based cursor position within |text_| or string16::npos if not | 192 // Returns 0-based cursor position within |text_| or string16::npos if not |
190 // used. | 193 // used. |
191 size_t cursor_position() const { return cursor_position_; } | 194 size_t cursor_position() const { return cursor_position_; } |
192 | 195 |
193 // Use of this setter is risky, since no other internal state is updated | 196 // Use of this setter is risky, since no other internal state is updated |
194 // besides |text_|, |cursor_position_| and |parts_|. Only callers who know | 197 // besides |text_|, |cursor_position_| and |parts_|. Only callers who know |
195 // that they're not changing the type/scheme/etc. should use this. | 198 // that they're not changing the type/scheme/etc. should use this. |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 url_parse::Parsed parts_; | 255 url_parse::Parsed parts_; |
253 string16 scheme_; | 256 string16 scheme_; |
254 GURL canonicalized_url_; | 257 GURL canonicalized_url_; |
255 bool prevent_inline_autocomplete_; | 258 bool prevent_inline_autocomplete_; |
256 bool prefer_keyword_; | 259 bool prefer_keyword_; |
257 bool allow_exact_keyword_match_; | 260 bool allow_exact_keyword_match_; |
258 MatchesRequested matches_requested_; | 261 MatchesRequested matches_requested_; |
259 }; | 262 }; |
260 | 263 |
261 #endif // CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_INPUT_H_ | 264 #endif // CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_INPUT_H_ |
OLD | NEW |