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 #include "chrome/renderer/searchbox/searchbox.h" | 5 #include "chrome/renderer/searchbox/searchbox.h" |
6 | 6 |
7 #include "chrome/common/render_messages.h" | 7 #include "chrome/common/render_messages.h" |
8 #include "chrome/renderer/searchbox/searchbox_extension.h" | 8 #include "chrome/renderer/searchbox/searchbox_extension.h" |
9 #include "content/public/renderer/render_view.h" | 9 #include "content/public/renderer/render_view.h" |
10 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" | 10 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
115 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxSubmit, OnSubmit) | 115 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxSubmit, OnSubmit) |
116 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxCancel, OnCancel) | 116 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxCancel, OnCancel) |
117 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxPopupResize, OnPopupResize) | 117 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxPopupResize, OnPopupResize) |
118 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxMarginChange, OnMarginChange) | 118 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxMarginChange, OnMarginChange) |
119 IPC_MESSAGE_HANDLER(ChromeViewMsg_DetermineIfPageSupportsInstant, | 119 IPC_MESSAGE_HANDLER(ChromeViewMsg_DetermineIfPageSupportsInstant, |
120 OnDetermineIfPageSupportsInstant) | 120 OnDetermineIfPageSupportsInstant) |
121 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxAutocompleteResults, | 121 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxAutocompleteResults, |
122 OnAutocompleteResults) | 122 OnAutocompleteResults) |
123 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxUpOrDownKeyPressed, | 123 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxUpOrDownKeyPressed, |
124 OnUpOrDownKeyPressed) | 124 OnUpOrDownKeyPressed) |
125 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxCancelSelection, | |
126 OnCancelSelection) | |
125 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxModeChanged, | 127 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxModeChanged, |
126 OnModeChanged) | 128 OnModeChanged) |
127 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxSetDisplayInstantResults, | 129 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxSetDisplayInstantResults, |
128 OnSetDisplayInstantResults) | 130 OnSetDisplayInstantResults) |
129 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxKeyCaptureChanged, | 131 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxKeyCaptureChanged, |
130 OnKeyCaptureChange) | 132 OnKeyCaptureChange) |
131 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxThemeChanged, | 133 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxThemeChanged, |
132 OnThemeChanged) | 134 OnThemeChanged) |
133 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxThemeAreaHeightChanged, | 135 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxThemeAreaHeightChanged, |
134 OnThemeAreaHeightChanged) | 136 OnThemeAreaHeightChanged) |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
222 } | 224 } |
223 | 225 |
224 void SearchBox::OnUpOrDownKeyPressed(int count) { | 226 void SearchBox::OnUpOrDownKeyPressed(int count) { |
225 if (render_view()->GetWebView() && render_view()->GetWebView()->mainFrame()) { | 227 if (render_view()->GetWebView() && render_view()->GetWebView()->mainFrame()) { |
226 DVLOG(1) << render_view() << " OnKeyPress: " << count; | 228 DVLOG(1) << render_view() << " OnKeyPress: " << count; |
227 extensions_v8::SearchBoxExtension::DispatchUpOrDownKeyPress( | 229 extensions_v8::SearchBoxExtension::DispatchUpOrDownKeyPress( |
228 render_view()->GetWebView()->mainFrame(), count); | 230 render_view()->GetWebView()->mainFrame(), count); |
229 } | 231 } |
230 } | 232 } |
231 | 233 |
234 void SearchBox::OnCancelSelection(const string16& query) { | |
235 // TODO(sreeram): The state reset below are somewhat wrong. Fix them. | |
palmer
2013/02/13 21:27:54
I believe it is better to cite a bug # in TODOs.
beaudoin
2013/02/13 21:32:38
Done.
Peter Kasting
2013/02/14 21:17:50
Actually, I ask all my reviewees to not cite bug n
| |
236 query_ = query; | |
237 verbatim_ = true; | |
238 selection_start_ = selection_end_ = query_.size(); | |
239 if (render_view()->GetWebView() && render_view()->GetWebView()->mainFrame()) { | |
240 DVLOG(1) << render_view() << " OnKeyPress ESC"; | |
241 extensions_v8::SearchBoxExtension::DispatchEscKeyPress( | |
242 render_view()->GetWebView()->mainFrame()); | |
243 } | |
244 } | |
245 | |
232 void SearchBox::OnKeyCaptureChange(bool is_key_capture_enabled) { | 246 void SearchBox::OnKeyCaptureChange(bool is_key_capture_enabled) { |
233 if (is_key_capture_enabled != is_key_capture_enabled_ && | 247 if (is_key_capture_enabled != is_key_capture_enabled_ && |
234 render_view()->GetWebView() && render_view()->GetWebView()->mainFrame()) { | 248 render_view()->GetWebView() && render_view()->GetWebView()->mainFrame()) { |
235 is_key_capture_enabled_ = is_key_capture_enabled; | 249 is_key_capture_enabled_ = is_key_capture_enabled; |
236 DVLOG(1) << render_view() << " OnKeyCaptureChange"; | 250 DVLOG(1) << render_view() << " OnKeyCaptureChange"; |
237 extensions_v8::SearchBoxExtension::DispatchKeyCaptureChange( | 251 extensions_v8::SearchBoxExtension::DispatchKeyCaptureChange( |
238 render_view()->GetWebView()->mainFrame()); | 252 render_view()->GetWebView()->mainFrame()); |
239 } | 253 } |
240 } | 254 } |
241 | 255 |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
297 is_key_capture_enabled_ = false; | 311 is_key_capture_enabled_ = false; |
298 mode_ = chrome::search::Mode(); | 312 mode_ = chrome::search::Mode(); |
299 theme_info_ = ThemeBackgroundInfo(); | 313 theme_info_ = ThemeBackgroundInfo(); |
300 theme_area_height_ = 0; | 314 theme_area_height_ = 0; |
301 // Don't reset display_instant_results_ to prevent clearing it on committed | 315 // Don't reset display_instant_results_ to prevent clearing it on committed |
302 // results pages in extended mode. Otherwise resetting it is a no-op because | 316 // results pages in extended mode. Otherwise resetting it is a no-op because |
303 // a new loader is created when it changes; see crbug.com/164662. | 317 // a new loader is created when it changes; see crbug.com/164662. |
304 // Also don't reset omnibox_font_ or omnibox_font_size_ since it never | 318 // Also don't reset omnibox_font_ or omnibox_font_size_ since it never |
305 // changes. | 319 // changes. |
306 } | 320 } |
OLD | NEW |