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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/string16.h" | 9 #include "base/string16.h" |
10 #include "chrome/browser/autocomplete/autocomplete_match.h" | 10 #include "chrome/browser/autocomplete/autocomplete_match.h" |
(...skipping 26 matching lines...) Expand all Loading... |
37 public: | 37 public: |
38 // Sent when the autocomplete popup is about to close. | 38 // Sent when the autocomplete popup is about to close. |
39 virtual void OnAutocompleteWillClosePopup() = 0; | 39 virtual void OnAutocompleteWillClosePopup() = 0; |
40 | 40 |
41 // Sent when the edit is losing focus. |view_gaining_focus| is the view | 41 // Sent when the edit is losing focus. |view_gaining_focus| is the view |
42 // gaining focus and may be null. | 42 // gaining focus and may be null. |
43 virtual void OnAutocompleteLosingFocus( | 43 virtual void OnAutocompleteLosingFocus( |
44 gfx::NativeView view_gaining_focus) = 0; | 44 gfx::NativeView view_gaining_focus) = 0; |
45 | 45 |
46 // Sent prior to OnAutoCompleteAccept and before the model has been reverted. | 46 // Sent prior to OnAutoCompleteAccept and before the model has been reverted. |
| 47 // This is only invoked if the popup is closed before invoking |
| 48 // OnAutoCompleteAccept. |
47 virtual void OnAutocompleteWillAccept() = 0; | 49 virtual void OnAutocompleteWillAccept() = 0; |
48 | 50 |
49 // Commits the suggested text. |typed_text| is the current text showing in the | 51 // Commits the suggested text. |typed_text| is the current text showing in the |
50 // autocomplete. Returns true if the text was committed. | 52 // autocomplete. Returns true if the text was committed. |
51 virtual bool OnCommitSuggestedText(const std::wstring& typed_text) = 0; | 53 virtual bool OnCommitSuggestedText(const std::wstring& typed_text) = 0; |
52 | 54 |
53 // Accepts the currently showing instant preview, if any, and returns true. | 55 // Accepts the currently showing instant preview, if any, and returns true. |
54 // Returns false if there is no instant preview showing. | 56 // Returns false if there is no instant preview showing. |
55 virtual bool AcceptCurrentInstantPreview() = 0; | 57 virtual bool AcceptCurrentInstantPreview() = 0; |
56 | 58 |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 const KeywordUIState keyword_ui_state; | 133 const KeywordUIState keyword_ui_state; |
132 }; | 134 }; |
133 | 135 |
134 AutocompleteEditModel(AutocompleteEditView* view, | 136 AutocompleteEditModel(AutocompleteEditView* view, |
135 AutocompleteEditController* controller, | 137 AutocompleteEditController* controller, |
136 Profile* profile); | 138 Profile* profile); |
137 ~AutocompleteEditModel(); | 139 ~AutocompleteEditModel(); |
138 | 140 |
139 void SetPopupModel(AutocompletePopupModel* popup_model); | 141 void SetPopupModel(AutocompletePopupModel* popup_model); |
140 | 142 |
141 // It should only be used by testing code. | 143 // TODO: The edit and popup should be siblings owned by the LocationBarView, |
| 144 // making this accessor unnecessary. |
142 AutocompletePopupModel* popup_model() const { return popup_; } | 145 AutocompletePopupModel* popup_model() const { return popup_; } |
143 | 146 |
144 // Invoked when the profile has changed. | 147 // Invoked when the profile has changed. |
145 void SetProfile(Profile* profile); | 148 void SetProfile(Profile* profile); |
146 | 149 |
147 Profile* profile() const { return profile_; } | 150 Profile* profile() const { return profile_; } |
148 | 151 |
149 // Returns the current state. This assumes we are switching tabs, and changes | 152 // Returns the current state. This assumes we are switching tabs, and changes |
150 // the internal state appropriately. | 153 // the internal state appropriately. |
151 const State GetStateForTabSwitch(); | 154 const State GetStateForTabSwitch(); |
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
494 mutable GURL paste_and_go_url_; | 497 mutable GURL paste_and_go_url_; |
495 mutable PageTransition::Type paste_and_go_transition_; | 498 mutable PageTransition::Type paste_and_go_transition_; |
496 mutable GURL paste_and_go_alternate_nav_url_; | 499 mutable GURL paste_and_go_alternate_nav_url_; |
497 | 500 |
498 Profile* profile_; | 501 Profile* profile_; |
499 | 502 |
500 DISALLOW_COPY_AND_ASSIGN(AutocompleteEditModel); | 503 DISALLOW_COPY_AND_ASSIGN(AutocompleteEditModel); |
501 }; | 504 }; |
502 | 505 |
503 #endif // CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_EDIT_H_ | 506 #endif // CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_EDIT_H_ |
OLD | NEW |