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_RENDERER_SEARCHBOX_SEARCHBOX_H_ | 5 #ifndef CHROME_RENDERER_SEARCHBOX_SEARCHBOX_H_ |
6 #define CHROME_RENDERER_SEARCHBOX_SEARCHBOX_H_ | 6 #define CHROME_RENDERER_SEARCHBOX_SEARCHBOX_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/string16.h" | 11 #include "base/string16.h" |
12 #include "chrome/common/instant_restricted_id_cache.h" | 12 #include "chrome/common/instant_restricted_id_cache.h" |
13 #include "chrome/common/instant_types.h" | 13 #include "chrome/common/instant_types.h" |
| 14 #include "chrome/common/omnibox_focus_state.h" |
14 #include "chrome/common/search_types.h" | 15 #include "chrome/common/search_types.h" |
15 #include "content/public/common/page_transition_types.h" | 16 #include "content/public/common/page_transition_types.h" |
16 #include "content/public/renderer/render_view_observer.h" | 17 #include "content/public/renderer/render_view_observer.h" |
17 #include "content/public/renderer/render_view_observer_tracker.h" | 18 #include "content/public/renderer/render_view_observer_tracker.h" |
18 #include "ui/base/window_open_disposition.h" | 19 #include "ui/base/window_open_disposition.h" |
19 #include "ui/gfx/rect.h" | 20 #include "ui/gfx/rect.h" |
20 | 21 |
21 namespace content { | 22 namespace content { |
22 class RenderView; | 23 class RenderView; |
23 } | 24 } |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 | 59 |
59 // Hides any attached bars. When the bars are hidden, the "onbarshidden" | 60 // Hides any attached bars. When the bars are hidden, the "onbarshidden" |
60 // event is fired to notify the page. | 61 // event is fired to notify the page. |
61 void HideBars(); | 62 void HideBars(); |
62 | 63 |
63 const string16& query() const { return query_; } | 64 const string16& query() const { return query_; } |
64 bool verbatim() const { return verbatim_; } | 65 bool verbatim() const { return verbatim_; } |
65 bool query_is_restricted() const { return query_is_restricted_; } | 66 bool query_is_restricted() const { return query_is_restricted_; } |
66 size_t selection_start() const { return selection_start_; } | 67 size_t selection_start() const { return selection_start_; } |
67 size_t selection_end() const { return selection_end_; } | 68 size_t selection_end() const { return selection_end_; } |
| 69 bool is_focused() const { return is_focused_; } |
68 bool is_key_capture_enabled() const { return is_key_capture_enabled_; } | 70 bool is_key_capture_enabled() const { return is_key_capture_enabled_; } |
69 bool display_instant_results() const { return display_instant_results_; } | 71 bool display_instant_results() const { return display_instant_results_; } |
70 const string16& omnibox_font() const { return omnibox_font_; } | 72 const string16& omnibox_font() const { return omnibox_font_; } |
71 size_t omnibox_font_size() const { return omnibox_font_size_; } | 73 size_t omnibox_font_size() const { return omnibox_font_size_; } |
72 | 74 |
73 // In extended Instant, returns the start-edge margin of the location bar in | 75 // In extended Instant, returns the start-edge margin of the location bar in |
74 // screen pixels. | 76 // screen pixels. |
75 int GetStartMargin() const; | 77 int GetStartMargin() const; |
76 | 78 |
77 // Returns the bounds of the omnibox popup in screen coordinates. | 79 // Returns the bounds of the omnibox popup in screen coordinates. |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 void OnBarsHidden(); | 129 void OnBarsHidden(); |
128 void OnDetermineIfPageSupportsInstant(); | 130 void OnDetermineIfPageSupportsInstant(); |
129 void OnAutocompleteResults( | 131 void OnAutocompleteResults( |
130 const std::vector<InstantAutocompleteResult>& results); | 132 const std::vector<InstantAutocompleteResult>& results); |
131 void OnUpOrDownKeyPressed(int count); | 133 void OnUpOrDownKeyPressed(int count); |
132 void OnEscKeyPressed(); | 134 void OnEscKeyPressed(); |
133 void OnCancelSelection(const string16& query, | 135 void OnCancelSelection(const string16& query, |
134 bool verbatim, | 136 bool verbatim, |
135 size_t selection_start, | 137 size_t selection_start, |
136 size_t selection_end); | 138 size_t selection_end); |
137 void OnKeyCaptureChange(bool is_key_capture_enabled); | 139 void OnFocusChange(OmniboxFocusState new_focus_state, |
| 140 OmniboxFocusChangeReason reason); |
138 void OnSetDisplayInstantResults(bool display_instant_results); | 141 void OnSetDisplayInstantResults(bool display_instant_results); |
139 void OnThemeChanged(const ThemeBackgroundInfo& theme_info); | 142 void OnThemeChanged(const ThemeBackgroundInfo& theme_info); |
140 void OnThemeAreaHeightChanged(int height); | 143 void OnThemeAreaHeightChanged(int height); |
141 void OnFontInformationReceived(const string16& omnibox_font, | 144 void OnFontInformationReceived(const string16& omnibox_font, |
142 size_t omnibox_font_size); | 145 size_t omnibox_font_size); |
143 void OnMostVisitedChanged( | 146 void OnMostVisitedChanged( |
144 const std::vector<InstantMostVisitedItemIDPair>& items); | 147 const std::vector<InstantMostVisitedItemIDPair>& items); |
145 | 148 |
146 // Returns the current zoom factor of the render view or 1 on failure. | 149 // Returns the current zoom factor of the render view or 1 on failure. |
147 double GetZoom() const; | 150 double GetZoom() const; |
148 | 151 |
149 // Sets the searchbox values to their initial value. | 152 // Sets the searchbox values to their initial value. |
150 void Reset(); | 153 void Reset(); |
151 | 154 |
152 // Sets the query to a new value. | 155 // Sets the query to a new value. |
153 void SetQuery(const string16& query, bool verbatim); | 156 void SetQuery(const string16& query, bool verbatim); |
154 | 157 |
155 string16 query_; | 158 string16 query_; |
156 bool verbatim_; | 159 bool verbatim_; |
157 bool query_is_restricted_; | 160 bool query_is_restricted_; |
158 size_t selection_start_; | 161 size_t selection_start_; |
159 size_t selection_end_; | 162 size_t selection_end_; |
160 int start_margin_; | 163 int start_margin_; |
161 gfx::Rect popup_bounds_; | 164 gfx::Rect popup_bounds_; |
| 165 bool is_focused_; |
162 bool is_key_capture_enabled_; | 166 bool is_key_capture_enabled_; |
163 ThemeBackgroundInfo theme_info_; | 167 ThemeBackgroundInfo theme_info_; |
164 bool display_instant_results_; | 168 bool display_instant_results_; |
165 string16 omnibox_font_; | 169 string16 omnibox_font_; |
166 size_t omnibox_font_size_; | 170 size_t omnibox_font_size_; |
167 InstantRestrictedIDCache<InstantAutocompleteResult> | 171 InstantRestrictedIDCache<InstantAutocompleteResult> |
168 autocomplete_results_cache_; | 172 autocomplete_results_cache_; |
169 InstantRestrictedIDCache<InstantMostVisitedItem> most_visited_items_cache_; | 173 InstantRestrictedIDCache<InstantMostVisitedItem> most_visited_items_cache_; |
170 | 174 |
171 DISALLOW_COPY_AND_ASSIGN(SearchBox); | 175 DISALLOW_COPY_AND_ASSIGN(SearchBox); |
172 }; | 176 }; |
173 | 177 |
174 #endif // CHROME_RENDERER_SEARCHBOX_SEARCHBOX_H_ | 178 #endif // CHROME_RENDERER_SEARCHBOX_SEARCHBOX_H_ |
OLD | NEW |