Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(724)

Side by Side Diff: chrome/renderer/searchbox/searchbox.cc

Issue 11889003: Fixing ESC in instant-extended. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/renderer/searchbox/searchbox.h ('k') | chrome/renderer/searchbox/searchbox_extension.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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_SearchBoxSetDisplayInstantResults, 127 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxSetDisplayInstantResults,
126 OnSetDisplayInstantResults) 128 OnSetDisplayInstantResults)
127 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxKeyCaptureChanged, 129 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxKeyCaptureChanged,
128 OnKeyCaptureChange) 130 OnKeyCaptureChange)
129 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxThemeChanged, 131 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxThemeChanged,
130 OnThemeChanged) 132 OnThemeChanged)
131 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxThemeAreaHeightChanged, 133 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxThemeAreaHeightChanged,
132 OnThemeAreaHeightChanged) 134 OnThemeAreaHeightChanged)
133 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxFontInformation, 135 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxFontInformation,
134 OnFontInformationReceived) 136 OnFontInformationReceived)
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 } 222 }
221 223
222 void SearchBox::OnUpOrDownKeyPressed(int count) { 224 void SearchBox::OnUpOrDownKeyPressed(int count) {
223 if (render_view()->GetWebView() && render_view()->GetWebView()->mainFrame()) { 225 if (render_view()->GetWebView() && render_view()->GetWebView()->mainFrame()) {
224 DVLOG(1) << render_view() << " OnKeyPress: " << count; 226 DVLOG(1) << render_view() << " OnKeyPress: " << count;
225 extensions_v8::SearchBoxExtension::DispatchUpOrDownKeyPress( 227 extensions_v8::SearchBoxExtension::DispatchUpOrDownKeyPress(
226 render_view()->GetWebView()->mainFrame(), count); 228 render_view()->GetWebView()->mainFrame(), count);
227 } 229 }
228 } 230 }
229 231
232 void SearchBox::OnCancelSelection(const string16& query) {
233 // TODO(sreeram): crbug.com/176101 The state reset below are somewhat wrong.
234 query_ = query;
235 verbatim_ = true;
236 selection_start_ = selection_end_ = query_.size();
237 if (render_view()->GetWebView() && render_view()->GetWebView()->mainFrame()) {
238 DVLOG(1) << render_view() << " OnKeyPress ESC";
239 extensions_v8::SearchBoxExtension::DispatchEscKeyPress(
240 render_view()->GetWebView()->mainFrame());
241 }
242 }
243
230 void SearchBox::OnKeyCaptureChange(bool is_key_capture_enabled) { 244 void SearchBox::OnKeyCaptureChange(bool is_key_capture_enabled) {
231 if (is_key_capture_enabled != is_key_capture_enabled_ && 245 if (is_key_capture_enabled != is_key_capture_enabled_ &&
232 render_view()->GetWebView() && render_view()->GetWebView()->mainFrame()) { 246 render_view()->GetWebView() && render_view()->GetWebView()->mainFrame()) {
233 is_key_capture_enabled_ = is_key_capture_enabled; 247 is_key_capture_enabled_ = is_key_capture_enabled;
234 DVLOG(1) << render_view() << " OnKeyCaptureChange"; 248 DVLOG(1) << render_view() << " OnKeyCaptureChange";
235 extensions_v8::SearchBoxExtension::DispatchKeyCaptureChange( 249 extensions_v8::SearchBoxExtension::DispatchKeyCaptureChange(
236 render_view()->GetWebView()->mainFrame()); 250 render_view()->GetWebView()->mainFrame());
237 } 251 }
238 } 252 }
239 253
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 autocomplete_results_.clear(); 299 autocomplete_results_.clear();
286 is_key_capture_enabled_ = false; 300 is_key_capture_enabled_ = false;
287 theme_info_ = ThemeBackgroundInfo(); 301 theme_info_ = ThemeBackgroundInfo();
288 theme_area_height_ = 0; 302 theme_area_height_ = 0;
289 // Don't reset display_instant_results_ to prevent clearing it on committed 303 // Don't reset display_instant_results_ to prevent clearing it on committed
290 // results pages in extended mode. Otherwise resetting it is a no-op because 304 // results pages in extended mode. Otherwise resetting it is a no-op because
291 // a new loader is created when it changes; see crbug.com/164662. 305 // a new loader is created when it changes; see crbug.com/164662.
292 // Also don't reset omnibox_font_ or omnibox_font_size_ since it never 306 // Also don't reset omnibox_font_ or omnibox_font_size_ since it never
293 // changes. 307 // changes.
294 } 308 }
OLDNEW
« no previous file with comments | « chrome/renderer/searchbox/searchbox.h ('k') | chrome/renderer/searchbox/searchbox_extension.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698