OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/instant_types.h" | 15 #include "chrome/common/instant_types.h" |
16 #include "chrome/common/metrics/proto/omnibox_event.pb.h" | 16 #include "chrome/common/metrics/proto/omnibox_event.pb.h" |
17 #include "content/public/common/page_transition_types.h" | 17 #include "content/public/common/page_transition_types.h" |
18 #include "googleurl/src/gurl.h" | 18 #include "googleurl/src/gurl.h" |
19 #include "ui/gfx/native_widget_types.h" | 19 #include "ui/gfx/native_widget_types.h" |
20 #include "webkit/glue/window_open_disposition.h" | 20 #include "webkit/glue/window_open_disposition.h" |
21 | 21 |
22 class AutocompleteController; | 22 class AutocompleteController; |
23 class AutocompleteResult; | 23 class AutocompleteResult; |
24 class OmniboxEditController; | 24 class OmniboxEditController; |
25 class OmniboxPopupModel; | 25 class OmniboxPopupModel; |
26 class OmniboxView; | 26 class OmniboxView; |
27 class Profile; | 27 class Profile; |
28 class SkBitmap; | |
29 | 28 |
30 namespace gfx { | 29 namespace gfx { |
| 30 class Image; |
31 class Rect; | 31 class Rect; |
32 } | 32 } |
33 | 33 |
34 class OmniboxEditModel : public AutocompleteControllerDelegate { | 34 class OmniboxEditModel : public AutocompleteControllerDelegate { |
35 public: | 35 public: |
36 struct State { | 36 struct State { |
37 State(bool user_input_in_progress, | 37 State(bool user_input_in_progress, |
38 const string16& user_text, | 38 const string16& user_text, |
39 const string16& keyword, | 39 const string16& keyword, |
40 bool is_keyword_hint); | 40 bool is_keyword_hint); |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 | 73 |
74 // Restores local state from the saved |state|. | 74 // Restores local state from the saved |state|. |
75 void RestoreState(const State& state); | 75 void RestoreState(const State& state); |
76 | 76 |
77 // Returns the match for the current text. If the user has not edited the text | 77 // Returns the match for the current text. If the user has not edited the text |
78 // this is the match corresponding to the permanent text. | 78 // this is the match corresponding to the permanent text. |
79 AutocompleteMatch CurrentMatch(); | 79 AutocompleteMatch CurrentMatch(); |
80 | 80 |
81 // Called when the user wants to export the entire current text as a URL. | 81 // Called when the user wants to export the entire current text as a URL. |
82 // Sets the url, and if known, the title and favicon. | 82 // Sets the url, and if known, the title and favicon. |
83 void GetDataForURLExport(GURL* url, string16* title, SkBitmap* favicon); | 83 void GetDataForURLExport(GURL* url, string16* title, gfx::Image* favicon); |
84 | 84 |
85 // Returns true if a verbatim query should be used for Instant. A verbatim | 85 // Returns true if a verbatim query should be used for Instant. A verbatim |
86 // query is forced in certain situations, such as pressing delete at the end | 86 // query is forced in certain situations, such as pressing delete at the end |
87 // of the edit. | 87 // of the edit. |
88 bool UseVerbatimInstant(); | 88 bool UseVerbatimInstant(); |
89 | 89 |
90 // If the user presses ctrl-enter, it means "add .com to the the end". The | 90 // If the user presses ctrl-enter, it means "add .com to the the end". The |
91 // desired TLD is the TLD the user desires to add to the end of the current | 91 // desired TLD is the TLD the user desires to add to the end of the current |
92 // input, if any, based on their control key state and any other actions | 92 // input, if any, based on their control key state and any other actions |
93 // they've taken. | 93 // they've taken. |
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
502 // an exact keyword match. If this is true then keyword mode will be | 502 // an exact keyword match. If this is true then keyword mode will be |
503 // triggered automatically if the input is "<keyword> <search string>". We | 503 // triggered automatically if the input is "<keyword> <search string>". We |
504 // allow this when CreatedKeywordSearchByInsertingSpaceInMiddle() is true. | 504 // allow this when CreatedKeywordSearchByInsertingSpaceInMiddle() is true. |
505 // This has no effect if we're already in keyword mode. | 505 // This has no effect if we're already in keyword mode. |
506 bool allow_exact_keyword_match_; | 506 bool allow_exact_keyword_match_; |
507 | 507 |
508 DISALLOW_COPY_AND_ASSIGN(OmniboxEditModel); | 508 DISALLOW_COPY_AND_ASSIGN(OmniboxEditModel); |
509 }; | 509 }; |
510 | 510 |
511 #endif // CHROME_BROWSER_UI_OMNIBOX_OMNIBOX_EDIT_MODEL_H_ | 511 #endif // CHROME_BROWSER_UI_OMNIBOX_OMNIBOX_EDIT_MODEL_H_ |
OLD | NEW |