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 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
246 // Asks the browser to load the item at |index|, with the given properties. | 248 // Asks the browser to load the item at |index|, with the given properties. |
247 void OpenURL(const GURL& url, | 249 void OpenURL(const GURL& url, |
248 WindowOpenDisposition disposition, | 250 WindowOpenDisposition disposition, |
249 PageTransition::Type transition, | 251 PageTransition::Type transition, |
250 const GURL& alternate_nav_url, | 252 const GURL& alternate_nav_url, |
251 size_t index, | 253 size_t index, |
252 const std::wstring& keyword); | 254 const std::wstring& keyword); |
253 | 255 |
254 bool has_focus() const { return has_focus_; } | 256 bool has_focus() const { return has_focus_; } |
255 | 257 |
258 // Returns true if the popup is open. | |
259 bool IsPopupOpen() const; | |
Peter Kasting
2011/01/05 01:28:11
This makes me really sad.
We really need to make
| |
260 | |
256 // Accessors for keyword-related state (see comments on keyword_ and | 261 // Accessors for keyword-related state (see comments on keyword_ and |
257 // is_keyword_hint_). | 262 // is_keyword_hint_). |
258 std::wstring keyword() const { | 263 std::wstring keyword() const { |
259 return (is_keyword_hint_ || (keyword_ui_state_ != NO_KEYWORD)) ? | 264 return (is_keyword_hint_ || (keyword_ui_state_ != NO_KEYWORD)) ? |
260 keyword_ : std::wstring(); | 265 keyword_ : std::wstring(); |
261 } | 266 } |
262 bool is_keyword_hint() const { return is_keyword_hint_; } | 267 bool is_keyword_hint() const { return is_keyword_hint_; } |
263 | 268 |
264 // Accepts the current keyword hint as a keyword. | 269 // Accepts the current keyword hint as a keyword. |
265 void AcceptKeyword(); | 270 void AcceptKeyword(); |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
494 mutable GURL paste_and_go_url_; | 499 mutable GURL paste_and_go_url_; |
495 mutable PageTransition::Type paste_and_go_transition_; | 500 mutable PageTransition::Type paste_and_go_transition_; |
496 mutable GURL paste_and_go_alternate_nav_url_; | 501 mutable GURL paste_and_go_alternate_nav_url_; |
497 | 502 |
498 Profile* profile_; | 503 Profile* profile_; |
499 | 504 |
500 DISALLOW_COPY_AND_ASSIGN(AutocompleteEditModel); | 505 DISALLOW_COPY_AND_ASSIGN(AutocompleteEditModel); |
501 }; | 506 }; |
502 | 507 |
503 #endif // CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_EDIT_H_ | 508 #endif // CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_EDIT_H_ |
OLD | NEW |