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_; } |
68 bool is_key_capture_enabled() const { return is_key_capture_enabled_; } | |
69 bool display_instant_results() const { return display_instant_results_; } | 69 bool display_instant_results() const { return display_instant_results_; } |
70 const string16& omnibox_font() const { return omnibox_font_; } | 70 const string16& omnibox_font() const { return omnibox_font_; } |
71 size_t omnibox_font_size() const { return omnibox_font_size_; } | 71 size_t omnibox_font_size() const { return omnibox_font_size_; } |
72 | 72 |
| 73 // Returns whether the omnibox is focused. |
| 74 bool is_focused() const; |
| 75 |
| 76 // Returns whether key capturing is enabled. |
| 77 bool is_key_capture_enabled() const; |
| 78 |
73 // In extended Instant, returns the start-edge margin of the location bar in | 79 // In extended Instant, returns the start-edge margin of the location bar in |
74 // screen pixels. | 80 // screen pixels. |
75 int GetStartMargin() const; | 81 int GetStartMargin() const; |
76 | 82 |
77 // Returns the bounds of the omnibox popup in screen coordinates. | 83 // Returns the bounds of the omnibox popup in screen coordinates. |
78 gfx::Rect GetPopupBounds() const; | 84 gfx::Rect GetPopupBounds() const; |
79 | 85 |
80 const ThemeBackgroundInfo& GetThemeBackgroundInfo(); | 86 const ThemeBackgroundInfo& GetThemeBackgroundInfo(); |
81 | 87 |
82 // --- Autocomplete result APIs. | 88 // --- Autocomplete result APIs. |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 void OnBarsHidden(); | 133 void OnBarsHidden(); |
128 void OnDetermineIfPageSupportsInstant(); | 134 void OnDetermineIfPageSupportsInstant(); |
129 void OnAutocompleteResults( | 135 void OnAutocompleteResults( |
130 const std::vector<InstantAutocompleteResult>& results); | 136 const std::vector<InstantAutocompleteResult>& results); |
131 void OnUpOrDownKeyPressed(int count); | 137 void OnUpOrDownKeyPressed(int count); |
132 void OnEscKeyPressed(); | 138 void OnEscKeyPressed(); |
133 void OnCancelSelection(const string16& query, | 139 void OnCancelSelection(const string16& query, |
134 bool verbatim, | 140 bool verbatim, |
135 size_t selection_start, | 141 size_t selection_start, |
136 size_t selection_end); | 142 size_t selection_end); |
137 void OnKeyCaptureChange(bool is_key_capture_enabled); | 143 void OnKeyCaptureChange(OmniboxFocusState new_focus_state, |
| 144 OmniboxFocusChangeReason reason); |
138 void OnSetDisplayInstantResults(bool display_instant_results); | 145 void OnSetDisplayInstantResults(bool display_instant_results); |
139 void OnThemeChanged(const ThemeBackgroundInfo& theme_info); | 146 void OnThemeChanged(const ThemeBackgroundInfo& theme_info); |
140 void OnThemeAreaHeightChanged(int height); | 147 void OnThemeAreaHeightChanged(int height); |
141 void OnFontInformationReceived(const string16& omnibox_font, | 148 void OnFontInformationReceived(const string16& omnibox_font, |
142 size_t omnibox_font_size); | 149 size_t omnibox_font_size); |
143 void OnMostVisitedChanged( | 150 void OnMostVisitedChanged( |
144 const std::vector<InstantMostVisitedItemIDPair>& items); | 151 const std::vector<InstantMostVisitedItemIDPair>& items); |
145 | 152 |
146 // Returns the current zoom factor of the render view or 1 on failure. | 153 // Returns the current zoom factor of the render view or 1 on failure. |
147 double GetZoom() const; | 154 double GetZoom() const; |
148 | 155 |
149 // Sets the searchbox values to their initial value. | 156 // Sets the searchbox values to their initial value. |
150 void Reset(); | 157 void Reset(); |
151 | 158 |
152 // Sets the query to a new value. | 159 // Sets the query to a new value. |
153 void SetQuery(const string16& query, bool verbatim); | 160 void SetQuery(const string16& query, bool verbatim); |
154 | 161 |
155 string16 query_; | 162 string16 query_; |
156 bool verbatim_; | 163 bool verbatim_; |
157 bool query_is_restricted_; | 164 bool query_is_restricted_; |
158 size_t selection_start_; | 165 size_t selection_start_; |
159 size_t selection_end_; | 166 size_t selection_end_; |
160 int start_margin_; | 167 int start_margin_; |
161 gfx::Rect popup_bounds_; | 168 gfx::Rect popup_bounds_; |
162 bool is_key_capture_enabled_; | 169 OmniboxFocusState omnibox_focus_state_; |
163 ThemeBackgroundInfo theme_info_; | 170 ThemeBackgroundInfo theme_info_; |
164 bool display_instant_results_; | 171 bool display_instant_results_; |
165 string16 omnibox_font_; | 172 string16 omnibox_font_; |
166 size_t omnibox_font_size_; | 173 size_t omnibox_font_size_; |
167 InstantRestrictedIDCache<InstantAutocompleteResult> | 174 InstantRestrictedIDCache<InstantAutocompleteResult> |
168 autocomplete_results_cache_; | 175 autocomplete_results_cache_; |
169 InstantRestrictedIDCache<InstantMostVisitedItem> most_visited_items_cache_; | 176 InstantRestrictedIDCache<InstantMostVisitedItem> most_visited_items_cache_; |
170 | 177 |
171 DISALLOW_COPY_AND_ASSIGN(SearchBox); | 178 DISALLOW_COPY_AND_ASSIGN(SearchBox); |
172 }; | 179 }; |
173 | 180 |
174 #endif // CHROME_RENDERER_SEARCHBOX_SEARCHBOX_H_ | 181 #endif // CHROME_RENDERER_SEARCHBOX_SEARCHBOX_H_ |
OLD | NEW |