OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_EDIT_H_ | 5 #ifndef CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_EDIT_H_ |
6 #define CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_EDIT_H_ | 6 #define CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_EDIT_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/string16.h" | 10 #include "base/string16.h" |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 const string16& keyword); | 256 const string16& keyword); |
257 | 257 |
258 bool has_focus() const { return has_focus_; } | 258 bool has_focus() const { return has_focus_; } |
259 | 259 |
260 // Accessors for keyword-related state (see comments on keyword_ and | 260 // Accessors for keyword-related state (see comments on keyword_ and |
261 // is_keyword_hint_). | 261 // is_keyword_hint_). |
262 const string16& keyword() const { return keyword_; } | 262 const string16& keyword() const { return keyword_; } |
263 bool is_keyword_hint() const { return is_keyword_hint_; } | 263 bool is_keyword_hint() const { return is_keyword_hint_; } |
264 | 264 |
265 // Accepts the current keyword hint as a keyword. It always returns true for | 265 // Accepts the current keyword hint as a keyword. It always returns true for |
266 // caller convenience. | 266 // caller convenience. |update_result| should be false to accept the |
267 bool AcceptKeyword(); | 267 // keyword in place without updating the result. |
| 268 bool AcceptKeyword(bool update_result); |
268 | 269 |
269 // Clears the current keyword. |visible_text| is the (non-keyword) text | 270 // Clears the current keyword. |visible_text| is the (non-keyword) text |
270 // currently visible in the edit. | 271 // currently visible in the edit. |
271 void ClearKeyword(const string16& visible_text); | 272 void ClearKeyword(const string16& visible_text); |
272 | 273 |
273 // Returns the current autocomplete result. This logic should in the future | 274 // Returns the current autocomplete result. This logic should in the future |
274 // live in AutocompleteController but resides here for now. This method is | 275 // live in AutocompleteController but resides here for now. This method is |
275 // used by AutomationProvider::AutocompleteEditGetMatches. | 276 // used by AutomationProvider::AutocompleteEditGetMatches. |
276 const AutocompleteResult& result() const; | 277 const AutocompleteResult& result() const; |
277 | 278 |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
511 // selected keyword, or just some input text that looks like a keyword (so we | 512 // selected keyword, or just some input text that looks like a keyword (so we |
512 // can show a hint to press <tab>). This is the keyword in either case; | 513 // can show a hint to press <tab>). This is the keyword in either case; |
513 // is_keyword_hint_ (below) distinguishes the two cases. | 514 // is_keyword_hint_ (below) distinguishes the two cases. |
514 string16 keyword_; | 515 string16 keyword_; |
515 | 516 |
516 // True if the keyword associated with this match is merely a hint, i.e. the | 517 // True if the keyword associated with this match is merely a hint, i.e. the |
517 // user hasn't actually selected a keyword yet. When this is true, we can use | 518 // user hasn't actually selected a keyword yet. When this is true, we can use |
518 // keyword_ to show a "Press <tab> to search" sort of hint. | 519 // keyword_ to show a "Press <tab> to search" sort of hint. |
519 bool is_keyword_hint_; | 520 bool is_keyword_hint_; |
520 | 521 |
| 522 // True if the current possible change shouldn't change results |
| 523 bool result_frozen_; |
| 524 |
521 // Paste And Go-related state. See CanPasteAndGo(). | 525 // Paste And Go-related state. See CanPasteAndGo(). |
522 mutable GURL paste_and_go_url_; | 526 mutable GURL paste_and_go_url_; |
523 mutable PageTransition::Type paste_and_go_transition_; | 527 mutable PageTransition::Type paste_and_go_transition_; |
524 mutable GURL paste_and_go_alternate_nav_url_; | 528 mutable GURL paste_and_go_alternate_nav_url_; |
525 | 529 |
526 Profile* profile_; | 530 Profile* profile_; |
527 | 531 |
528 // Should instant be updated? This is needed as prior to accepting the current | 532 // Should instant be updated? This is needed as prior to accepting the current |
529 // text the model is reverted, which triggers resetting instant. We don't want | 533 // text the model is reverted, which triggers resetting instant. We don't want |
530 // to update instant in this case, so we use the flag to determine if this is | 534 // to update instant in this case, so we use the flag to determine if this is |
531 // happening. | 535 // happening. |
532 bool update_instant_; | 536 bool update_instant_; |
533 | 537 |
534 // Last value of InstantCompleteBehavior supplied to |SetSuggestedText|. | 538 // Last value of InstantCompleteBehavior supplied to |SetSuggestedText|. |
535 InstantCompleteBehavior instant_complete_behavior_; | 539 InstantCompleteBehavior instant_complete_behavior_; |
536 | 540 |
537 DISALLOW_COPY_AND_ASSIGN(AutocompleteEditModel); | 541 DISALLOW_COPY_AND_ASSIGN(AutocompleteEditModel); |
538 }; | 542 }; |
539 | 543 |
540 #endif // CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_EDIT_H_ | 544 #endif // CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_EDIT_H_ |
OLD | NEW |