| 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" |
| 11 #include "base/string16.h" | 11 #include "base/string16.h" |
| 12 #include "base/time.h" | 12 #include "base/time.h" |
| 13 #include "chrome/browser/autocomplete/autocomplete_controller_delegate.h" | 13 #include "chrome/browser/autocomplete/autocomplete_controller_delegate.h" |
| 14 #include "chrome/browser/autocomplete/autocomplete_match.h" | 14 #include "chrome/browser/autocomplete/autocomplete_match.h" |
| 15 #include "chrome/common/metrics/proto/omnibox_event.pb.h" | 15 #include "chrome/common/metrics/proto/omnibox_event.pb.h" |
| 16 #include "chrome/common/omnibox_types.h" |
| 16 #include "content/public/common/page_transition_types.h" | 17 #include "content/public/common/page_transition_types.h" |
| 17 #include "googleurl/src/gurl.h" | 18 #include "googleurl/src/gurl.h" |
| 18 #include "ui/base/window_open_disposition.h" | 19 #include "ui/base/window_open_disposition.h" |
| 19 #include "ui/gfx/native_widget_types.h" | 20 #include "ui/gfx/native_widget_types.h" |
| 20 | 21 |
| 21 class AutocompleteController; | 22 class AutocompleteController; |
| 22 class AutocompleteResult; | 23 class AutocompleteResult; |
| 23 struct InstantSuggestion; | 24 struct InstantSuggestion; |
| 24 class OmniboxCurrentPageDelegate; | 25 class OmniboxCurrentPageDelegate; |
| 25 class OmniboxEditController; | 26 class OmniboxEditController; |
| 26 class OmniboxPopupModel; | 27 class OmniboxPopupModel; |
| 27 class OmniboxView; | 28 class OmniboxView; |
| 28 class Profile; | 29 class Profile; |
| 29 | 30 |
| 30 namespace gfx { | 31 namespace gfx { |
| 31 class Image; | 32 class Image; |
| 32 class Rect; | 33 class Rect; |
| 33 } | 34 } |
| 34 | 35 |
| 35 // Omnibox focus state. | |
| 36 enum OmniboxFocusState { | |
| 37 // Not focused. | |
| 38 OMNIBOX_FOCUS_NONE, | |
| 39 | |
| 40 // Visibly focused. | |
| 41 OMNIBOX_FOCUS_VISIBLE, | |
| 42 | |
| 43 // Invisibly focused, i.e. focused with a hidden caret. | |
| 44 OMNIBOX_FOCUS_INVISIBLE, | |
| 45 }; | |
| 46 | |
| 47 // Reasons why the Omnibox focus state could change. | |
| 48 enum OmniboxFocusChangeReason { | |
| 49 // Includes any explicit changes to focus. (e.g. user clicking to change | |
| 50 // focus, user tabbing to change focus, any explicit calls to SetFocus, | |
| 51 // etc.) | |
| 52 OMNIBOX_FOCUS_CHANGE_EXPLICIT, | |
| 53 | |
| 54 // Focus changed to restore state from a tab the user switched to. | |
| 55 OMNIBOX_FOCUS_CHANGE_TAB_SWITCH, | |
| 56 | |
| 57 // Focus changed because user started typing. This only happens when focus | |
| 58 // state is INVISIBLE (and this results in a change to VISIBLE). | |
| 59 OMNIBOX_FOCUS_CHANGE_TYPING, | |
| 60 }; | |
| 61 | |
| 62 class OmniboxEditModel : public AutocompleteControllerDelegate { | 36 class OmniboxEditModel : public AutocompleteControllerDelegate { |
| 63 public: | 37 public: |
| 64 struct State { | 38 struct State { |
| 65 State(bool user_input_in_progress, | 39 State(bool user_input_in_progress, |
| 66 const string16& user_text, | 40 const string16& user_text, |
| 67 const string16& keyword, | 41 const string16& keyword, |
| 68 bool is_keyword_hint, | 42 bool is_keyword_hint, |
| 69 OmniboxFocusState focus_state); | 43 OmniboxFocusState focus_state); |
| 70 ~State(); | 44 ~State(); |
| 71 | 45 |
| (...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 559 // an exact keyword match. If this is true then keyword mode will be | 533 // an exact keyword match. If this is true then keyword mode will be |
| 560 // triggered automatically if the input is "<keyword> <search string>". We | 534 // triggered automatically if the input is "<keyword> <search string>". We |
| 561 // allow this when CreatedKeywordSearchByInsertingSpaceInMiddle() is true. | 535 // allow this when CreatedKeywordSearchByInsertingSpaceInMiddle() is true. |
| 562 // This has no effect if we're already in keyword mode. | 536 // This has no effect if we're already in keyword mode. |
| 563 bool allow_exact_keyword_match_; | 537 bool allow_exact_keyword_match_; |
| 564 | 538 |
| 565 DISALLOW_COPY_AND_ASSIGN(OmniboxEditModel); | 539 DISALLOW_COPY_AND_ASSIGN(OmniboxEditModel); |
| 566 }; | 540 }; |
| 567 | 541 |
| 568 #endif // CHROME_BROWSER_UI_OMNIBOX_OMNIBOX_EDIT_MODEL_H_ | 542 #endif // CHROME_BROWSER_UI_OMNIBOX_OMNIBOX_EDIT_MODEL_H_ |
| OLD | NEW |