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 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 bool for_drop); | 184 bool for_drop); |
185 | 185 |
186 // Asks the browser to load the item at |index|, with the given properties. | 186 // Asks the browser to load the item at |index|, with the given properties. |
187 void OpenMatch(const AutocompleteMatch& match, | 187 void OpenMatch(const AutocompleteMatch& match, |
188 WindowOpenDisposition disposition, | 188 WindowOpenDisposition disposition, |
189 const GURL& alternate_nav_url, | 189 const GURL& alternate_nav_url, |
190 size_t index); | 190 size_t index); |
191 | 191 |
192 bool has_focus() const { return has_focus_; } | 192 bool has_focus() const { return has_focus_; } |
193 | 193 |
| 194 bool is_focus_visible() const { return is_focus_visible_; } |
| 195 |
194 // Accessors for keyword-related state (see comments on keyword_ and | 196 // Accessors for keyword-related state (see comments on keyword_ and |
195 // is_keyword_hint_). | 197 // is_keyword_hint_). |
196 const string16& keyword() const { return keyword_; } | 198 const string16& keyword() const { return keyword_; } |
197 bool is_keyword_hint() const { return is_keyword_hint_; } | 199 bool is_keyword_hint() const { return is_keyword_hint_; } |
198 | 200 |
199 // Accepts the current keyword hint as a keyword. It always returns true for | 201 // Accepts the current keyword hint as a keyword. It always returns true for |
200 // caller convenience. | 202 // caller convenience. |
201 bool AcceptKeyword(); | 203 bool AcceptKeyword(); |
202 | 204 |
203 // Clears the current keyword. |visible_text| is the (non-keyword) text | 205 // Clears the current keyword. |visible_text| is the (non-keyword) text |
204 // currently visible in the edit. | 206 // currently visible in the edit. |
205 void ClearKeyword(const string16& visible_text); | 207 void ClearKeyword(const string16& visible_text); |
206 | 208 |
207 // Returns the current autocomplete result. This logic should in the future | 209 // Returns the current autocomplete result. This logic should in the future |
208 // live in AutocompleteController but resides here for now. This method is | 210 // live in AutocompleteController but resides here for now. This method is |
209 // used by AutomationProvider::AutocompleteEditGetMatches. | 211 // used by AutomationProvider::AutocompleteEditGetMatches. |
210 const AutocompleteResult& result() const; | 212 const AutocompleteResult& result() const; |
211 | 213 |
212 // Called when the view is gaining focus. |control_down| is whether the | 214 // Called when the view is gaining focus. |control_down| is whether the |
213 // control key is down (at the time we're gaining focus). | 215 // control key is down (at the time we're gaining focus). |
214 void OnSetFocus(bool control_down); | 216 void OnSetFocus(bool control_down); |
215 | 217 |
| 218 // Called when we switch between using visible and invisible focus for the |
| 219 // omnibox. NOTE: this does NOT convey whether the view currently has focus; |
| 220 // only whether the focus will be visible when it does gain focus. |
| 221 void OnFocusVisibilityChange(bool visible_focus); |
| 222 |
216 // Sent before |OnKillFocus| and before the popup is closed. | 223 // Sent before |OnKillFocus| and before the popup is closed. |
217 void OnWillKillFocus(gfx::NativeView view_gaining_focus); | 224 void OnWillKillFocus(gfx::NativeView view_gaining_focus); |
218 | 225 |
219 // Called when the view is losing focus. Resets some state. | 226 // Called when the view is losing focus. Resets some state. |
220 void OnKillFocus(); | 227 void OnKillFocus(); |
221 | 228 |
222 // Called when the user presses the escape key. Decides what, if anything, to | 229 // Called when the user presses the escape key. Decides what, if anything, to |
223 // revert about any current edits. Returns whether the key was handled. | 230 // revert about any current edits. Returns whether the key was handled. |
224 bool OnEscapeKeyPressed(); | 231 bool OnEscapeKeyPressed(); |
225 | 232 |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
397 | 404 |
398 OmniboxView* view_; | 405 OmniboxView* view_; |
399 | 406 |
400 OmniboxPopupModel* popup_; | 407 OmniboxPopupModel* popup_; |
401 | 408 |
402 OmniboxEditController* controller_; | 409 OmniboxEditController* controller_; |
403 | 410 |
404 // Whether the edit has focus. | 411 // Whether the edit has focus. |
405 bool has_focus_; | 412 bool has_focus_; |
406 | 413 |
| 414 // Will the focus be visible? |
| 415 bool is_focus_visible_; |
| 416 |
407 // The URL of the currently displayed page. | 417 // The URL of the currently displayed page. |
408 string16 permanent_text_; | 418 string16 permanent_text_; |
409 | 419 |
410 // This flag is true when the user has modified the contents of the edit, but | 420 // This flag is true when the user has modified the contents of the edit, but |
411 // not yet accepted them. We use this to determine when we need to save | 421 // not yet accepted them. We use this to determine when we need to save |
412 // state (on switching tabs) and whether changes to the page URL should be | 422 // state (on switching tabs) and whether changes to the page URL should be |
413 // immediately displayed. | 423 // immediately displayed. |
414 // This flag will be true in a superset of the cases where the popup is open. | 424 // This flag will be true in a superset of the cases where the popup is open. |
415 bool user_input_in_progress_; | 425 bool user_input_in_progress_; |
416 | 426 |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
504 // an exact keyword match. If this is true then keyword mode will be | 514 // an exact keyword match. If this is true then keyword mode will be |
505 // triggered automatically if the input is "<keyword> <search string>". We | 515 // triggered automatically if the input is "<keyword> <search string>". We |
506 // allow this when CreatedKeywordSearchByInsertingSpaceInMiddle() is true. | 516 // allow this when CreatedKeywordSearchByInsertingSpaceInMiddle() is true. |
507 // This has no effect if we're already in keyword mode. | 517 // This has no effect if we're already in keyword mode. |
508 bool allow_exact_keyword_match_; | 518 bool allow_exact_keyword_match_; |
509 | 519 |
510 DISALLOW_COPY_AND_ASSIGN(OmniboxEditModel); | 520 DISALLOW_COPY_AND_ASSIGN(OmniboxEditModel); |
511 }; | 521 }; |
512 | 522 |
513 #endif // CHROME_BROWSER_UI_OMNIBOX_OMNIBOX_EDIT_MODEL_H_ | 523 #endif // CHROME_BROWSER_UI_OMNIBOX_OMNIBOX_EDIT_MODEL_H_ |
OLD | NEW |