Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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_UI_OMNIBOX_OMNIBOX_EDIT_MODEL_H_ | 5 #ifndef CHROME_BROWSER_UI_OMNIBOX_OMNIBOX_EDIT_MODEL_H_ |
| 6 #define CHROME_BROWSER_UI_OMNIBOX_OMNIBOX_EDIT_MODEL_H_ | 6 #define CHROME_BROWSER_UI_OMNIBOX_OMNIBOX_EDIT_MODEL_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 43 }; | 43 }; |
| 44 | 44 |
| 45 class OmniboxEditModel { | 45 class OmniboxEditModel { |
| 46 public: | 46 public: |
| 47 struct State { | 47 struct State { |
| 48 State(bool user_input_in_progress, | 48 State(bool user_input_in_progress, |
| 49 const string16& user_text, | 49 const string16& user_text, |
| 50 const string16& gray_text, | 50 const string16& gray_text, |
| 51 const string16& keyword, | 51 const string16& keyword, |
| 52 bool is_keyword_hint, | 52 bool is_keyword_hint, |
| 53 OmniboxFocusState focus_state); | 53 OmniboxFocusState focus_state, |
| 54 OmniboxFocusState focus_state_for_input); | |
| 54 ~State(); | 55 ~State(); |
| 55 | 56 |
| 56 bool user_input_in_progress; | 57 bool user_input_in_progress; |
| 57 const string16 user_text; | 58 const string16 user_text; |
| 58 const string16 gray_text; | 59 const string16 gray_text; |
| 59 const string16 keyword; | 60 const string16 keyword; |
| 60 const bool is_keyword_hint; | 61 const bool is_keyword_hint; |
| 61 OmniboxFocusState focus_state; | 62 OmniboxFocusState focus_state; |
| 63 OmniboxFocusState focus_state_for_input; | |
| 62 }; | 64 }; |
| 63 | 65 |
| 64 OmniboxEditModel(OmniboxView* view, | 66 OmniboxEditModel(OmniboxView* view, |
| 65 OmniboxEditController* controller, | 67 OmniboxEditController* controller, |
| 66 Profile* profile); | 68 Profile* profile); |
| 67 virtual ~OmniboxEditModel(); | 69 virtual ~OmniboxEditModel(); |
| 68 | 70 |
| 69 // TODO(beaudoin): Remove this accessor when the AutocompleteController has | 71 // TODO(beaudoin): Remove this accessor when the AutocompleteController has |
| 70 // completely moved to OmniboxController. | 72 // completely moved to OmniboxController. |
| 71 AutocompleteController* autocomplete_controller() const { | 73 AutocompleteController* autocomplete_controller() const { |
| (...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 404 scoped_ptr<OmniboxController> omnibox_controller_; | 406 scoped_ptr<OmniboxController> omnibox_controller_; |
| 405 | 407 |
| 406 OmniboxView* view_; | 408 OmniboxView* view_; |
| 407 | 409 |
| 408 OmniboxEditController* controller_; | 410 OmniboxEditController* controller_; |
| 409 | 411 |
| 410 scoped_ptr<OmniboxCurrentPageDelegate> delegate_; | 412 scoped_ptr<OmniboxCurrentPageDelegate> delegate_; |
| 411 | 413 |
| 412 OmniboxFocusState focus_state_; | 414 OmniboxFocusState focus_state_; |
| 413 | 415 |
| 416 // The focus state when the user initiated input in the omnibox. Only a valid | |
| 417 // value, OMNIBOX_FOCUS_{VISIBLE,INVISIBLE}, while user input is in progress | |
| 418 // and the ommnibox has focus. | |
| 419 OmniboxFocusState focus_state_for_input_; | |
|
Peter Kasting
2013/07/26 23:22:34
The name of this seems unclear, and the type might
samarth
2013/07/29 18:55:35
So when I initially wrote the code around invisibl
| |
| 420 | |
| 414 // The URL of the currently displayed page. | 421 // The URL of the currently displayed page. |
| 415 string16 permanent_text_; | 422 string16 permanent_text_; |
| 416 | 423 |
| 417 // This flag is true when the user has modified the contents of the edit, but | 424 // This flag is true when the user has modified the contents of the edit, but |
| 418 // not yet accepted them. We use this to determine when we need to save | 425 // not yet accepted them. We use this to determine when we need to save |
| 419 // state (on switching tabs) and whether changes to the page URL should be | 426 // state (on switching tabs) and whether changes to the page URL should be |
| 420 // immediately displayed. | 427 // immediately displayed. |
| 421 // This flag will be true in a superset of the cases where the popup is open. | 428 // This flag will be true in a superset of the cases where the popup is open. |
| 422 bool user_input_in_progress_; | 429 bool user_input_in_progress_; |
| 423 | 430 |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 508 // an exact keyword match. If this is true then keyword mode will be | 515 // an exact keyword match. If this is true then keyword mode will be |
| 509 // triggered automatically if the input is "<keyword> <search string>". We | 516 // triggered automatically if the input is "<keyword> <search string>". We |
| 510 // allow this when CreatedKeywordSearchByInsertingSpaceInMiddle() is true. | 517 // allow this when CreatedKeywordSearchByInsertingSpaceInMiddle() is true. |
| 511 // This has no effect if we're already in keyword mode. | 518 // This has no effect if we're already in keyword mode. |
| 512 bool allow_exact_keyword_match_; | 519 bool allow_exact_keyword_match_; |
| 513 | 520 |
| 514 DISALLOW_COPY_AND_ASSIGN(OmniboxEditModel); | 521 DISALLOW_COPY_AND_ASSIGN(OmniboxEditModel); |
| 515 }; | 522 }; |
| 516 | 523 |
| 517 #endif // CHROME_BROWSER_UI_OMNIBOX_OMNIBOX_EDIT_MODEL_H_ | 524 #endif // CHROME_BROWSER_UI_OMNIBOX_OMNIBOX_EDIT_MODEL_H_ |
| OLD | NEW |