| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 | 7 |
| 8 #include "chrome/browser/autocomplete/autocomplete.h" | 8 #include "chrome/browser/autocomplete/autocomplete.h" |
| 9 #include "chrome/common/notification_registrar.h" | 9 #include "chrome/common/notification_registrar.h" |
| 10 #include "chrome/common/page_transition_types.h" | 10 #include "chrome/common/page_transition_types.h" |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 // Called whenever the autocomplete edit gets focused. | 54 // Called whenever the autocomplete edit gets focused. |
| 55 virtual void OnSetFocus() = 0; | 55 virtual void OnSetFocus() = 0; |
| 56 | 56 |
| 57 // Returns the favicon of the current page. | 57 // Returns the favicon of the current page. |
| 58 virtual SkBitmap GetFavIcon() const = 0; | 58 virtual SkBitmap GetFavIcon() const = 0; |
| 59 | 59 |
| 60 // Returns the title of the current page. | 60 // Returns the title of the current page. |
| 61 virtual std::wstring GetTitle() const = 0; | 61 virtual std::wstring GetTitle() const = 0; |
| 62 | 62 |
| 63 protected: | 63 protected: |
| 64 virtual ~AutocompleteEditController() {} | 64 virtual ~AutocompleteEditController(); |
| 65 }; | 65 }; |
| 66 | 66 |
| 67 class AutocompleteEditModel : public NotificationObserver { | 67 class AutocompleteEditModel : public NotificationObserver { |
| 68 public: | 68 public: |
| 69 enum KeywordUIState { | 69 enum KeywordUIState { |
| 70 // The user is typing normally. | 70 // The user is typing normally. |
| 71 NORMAL, | 71 NORMAL, |
| 72 // The user is editing in the middle of the input string. Even if the | 72 // The user is editing in the middle of the input string. Even if the |
| 73 // input looks like a keyword, don't display the keyword UI, as to not | 73 // input looks like a keyword, don't display the keyword UI, as to not |
| 74 // interfere with the user's editing. | 74 // interfere with the user's editing. |
| 75 NO_KEYWORD, | 75 NO_KEYWORD, |
| 76 // The user has triggered the keyword UI. Until it disappears, bias | 76 // The user has triggered the keyword UI. Until it disappears, bias |
| 77 // autocomplete results so that input strings of the keyword alone default | 77 // autocomplete results so that input strings of the keyword alone default |
| 78 // to the keyword provider, not a normal navigation or search. | 78 // to the keyword provider, not a normal navigation or search. |
| 79 KEYWORD, | 79 KEYWORD, |
| 80 }; | 80 }; |
| 81 | 81 |
| 82 struct State { | 82 struct State { |
| 83 State(bool user_input_in_progress, | 83 State(bool user_input_in_progress, |
| 84 const std::wstring& user_text, | 84 const std::wstring& user_text, |
| 85 const std::wstring& keyword, | 85 const std::wstring& keyword, |
| 86 bool is_keyword_hint, | 86 bool is_keyword_hint, |
| 87 KeywordUIState keyword_ui_state) | 87 KeywordUIState keyword_ui_state); |
| 88 : user_input_in_progress(user_input_in_progress), | 88 ~State(); |
| 89 user_text(user_text), | |
| 90 keyword(keyword), | |
| 91 is_keyword_hint(is_keyword_hint), | |
| 92 keyword_ui_state(keyword_ui_state) { | |
| 93 } | |
| 94 | 89 |
| 95 bool user_input_in_progress; | 90 bool user_input_in_progress; |
| 96 const std::wstring user_text; | 91 const std::wstring user_text; |
| 97 const std::wstring keyword; | 92 const std::wstring keyword; |
| 98 const bool is_keyword_hint; | 93 const bool is_keyword_hint; |
| 99 const KeywordUIState keyword_ui_state; | 94 const KeywordUIState keyword_ui_state; |
| 100 }; | 95 }; |
| 101 | 96 |
| 102 AutocompleteEditModel(AutocompleteEditView* view, | 97 AutocompleteEditModel(AutocompleteEditView* view, |
| 103 AutocompleteEditController* controller, | 98 AutocompleteEditController* controller, |
| 104 Profile* profile); | 99 Profile* profile); |
| 105 ~AutocompleteEditModel() {} | 100 ~AutocompleteEditModel(); |
| 106 | 101 |
| 107 void SetPopupModel(AutocompletePopupModel* popup_model); | 102 void SetPopupModel(AutocompletePopupModel* popup_model); |
| 108 | 103 |
| 109 #ifdef UNIT_TEST | 104 #ifdef UNIT_TEST |
| 110 // It should only be used by testing code. | 105 // It should only be used by testing code. |
| 111 AutocompletePopupModel* popup_model() const { return popup_; } | 106 AutocompletePopupModel* popup_model() const { return popup_; } |
| 112 #endif | 107 #endif |
| 113 | 108 |
| 114 // Invoked when the profile has changed. | 109 // Invoked when the profile has changed. |
| 115 void SetProfile(Profile* profile); | 110 void SetProfile(Profile* profile); |
| (...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 437 mutable GURL paste_and_go_url_; | 432 mutable GURL paste_and_go_url_; |
| 438 mutable PageTransition::Type paste_and_go_transition_; | 433 mutable PageTransition::Type paste_and_go_transition_; |
| 439 mutable GURL paste_and_go_alternate_nav_url_; | 434 mutable GURL paste_and_go_alternate_nav_url_; |
| 440 | 435 |
| 441 Profile* profile_; | 436 Profile* profile_; |
| 442 | 437 |
| 443 DISALLOW_COPY_AND_ASSIGN(AutocompleteEditModel); | 438 DISALLOW_COPY_AND_ASSIGN(AutocompleteEditModel); |
| 444 }; | 439 }; |
| 445 | 440 |
| 446 #endif // CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_EDIT_H_ | 441 #endif // CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_EDIT_H_ |
| OLD | NEW |