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