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

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

Issue 14562006: Handle Esc key press event in Local NTP. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: git cl upload Created 7 years, 7 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/test/data/instant_extended.html » ('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 "base/string_number_conversions.h" 7 #include "base/string_number_conversions.h"
8 #include "base/utf_string_conversions.h" 8 #include "base/utf_string_conversions.h"
9 #include "chrome/common/chrome_switches.h" 9 #include "chrome/common/chrome_switches.h"
10 #include "chrome/common/omnibox_focus_state.h" 10 #include "chrome/common/omnibox_focus_state.h"
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxCancel, OnCancel) 189 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxCancel, OnCancel)
190 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxPopupResize, OnPopupResize) 190 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxPopupResize, OnPopupResize)
191 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxMarginChange, OnMarginChange) 191 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxMarginChange, OnMarginChange)
192 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxBarsHidden, OnBarsHidden) 192 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxBarsHidden, OnBarsHidden)
193 IPC_MESSAGE_HANDLER(ChromeViewMsg_DetermineIfPageSupportsInstant, 193 IPC_MESSAGE_HANDLER(ChromeViewMsg_DetermineIfPageSupportsInstant,
194 OnDetermineIfPageSupportsInstant) 194 OnDetermineIfPageSupportsInstant)
195 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxAutocompleteResults, 195 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxAutocompleteResults,
196 OnAutocompleteResults) 196 OnAutocompleteResults)
197 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxUpOrDownKeyPressed, 197 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxUpOrDownKeyPressed,
198 OnUpOrDownKeyPressed) 198 OnUpOrDownKeyPressed)
199 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxEscKeyPressed, OnEscKeyPressed)
199 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxCancelSelection, 200 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxCancelSelection,
200 OnCancelSelection) 201 OnCancelSelection)
201 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxSetDisplayInstantResults, 202 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxSetDisplayInstantResults,
202 OnSetDisplayInstantResults) 203 OnSetDisplayInstantResults)
203 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxKeyCaptureChanged, 204 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxKeyCaptureChanged,
204 OnKeyCaptureChange) 205 OnKeyCaptureChange)
205 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxThemeChanged, 206 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxThemeChanged,
206 OnThemeChanged) 207 OnThemeChanged)
207 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxFontInformation, 208 IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxFontInformation,
208 OnFontInformationReceived) 209 OnFontInformationReceived)
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 } 324 }
324 325
325 void SearchBox::OnUpOrDownKeyPressed(int count) { 326 void SearchBox::OnUpOrDownKeyPressed(int count) {
326 if (render_view()->GetWebView() && render_view()->GetWebView()->mainFrame()) { 327 if (render_view()->GetWebView() && render_view()->GetWebView()->mainFrame()) {
327 DVLOG(1) << render_view() << " OnKeyPress: " << count; 328 DVLOG(1) << render_view() << " OnKeyPress: " << count;
328 extensions_v8::SearchBoxExtension::DispatchUpOrDownKeyPress( 329 extensions_v8::SearchBoxExtension::DispatchUpOrDownKeyPress(
329 render_view()->GetWebView()->mainFrame(), count); 330 render_view()->GetWebView()->mainFrame(), count);
330 } 331 }
331 } 332 }
332 333
334 void SearchBox::OnEscKeyPressed() {
335 if (render_view()->GetWebView() && render_view()->GetWebView()->mainFrame()) {
336 DVLOG(1) << render_view() << " OnEscKeyPressed ";
337 extensions_v8::SearchBoxExtension::DispatchEscKeyPress(
338 render_view()->GetWebView()->mainFrame());
339 }
340 }
341
333 void SearchBox::OnCancelSelection(const string16& query, 342 void SearchBox::OnCancelSelection(const string16& query,
334 bool verbatim, 343 bool verbatim,
335 size_t selection_start, 344 size_t selection_start,
336 size_t selection_end) { 345 size_t selection_end) {
337 SetQuery(query, verbatim); 346 SetQuery(query, verbatim);
338 selection_start_ = selection_start; 347 selection_start_ = selection_start;
339 selection_end_ = selection_end; 348 selection_end_ = selection_end;
340 if (render_view()->GetWebView() && render_view()->GetWebView()->mainFrame()) { 349 if (render_view()->GetWebView() && render_view()->GetWebView()->mainFrame()) {
341 DVLOG(1) << render_view() << " OnKeyPress ESC"; 350 DVLOG(1) << render_view() << " OnKeyPress ESC";
342 extensions_v8::SearchBoxExtension::DispatchEscKeyPress( 351 extensions_v8::SearchBoxExtension::DispatchEscKeyPress(
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
426 std::vector<InstantMostVisitedItemIDPair>* items) const { 435 std::vector<InstantMostVisitedItemIDPair>* items) const {
427 return most_visited_items_cache_.GetCurrentItems(items); 436 return most_visited_items_cache_.GetCurrentItems(items);
428 } 437 }
429 438
430 bool SearchBox::GetMostVisitedItemWithID( 439 bool SearchBox::GetMostVisitedItemWithID(
431 InstantRestrictedID most_visited_item_id, 440 InstantRestrictedID most_visited_item_id,
432 InstantMostVisitedItem* item) const { 441 InstantMostVisitedItem* item) const {
433 return most_visited_items_cache_.GetItemWithRestrictedID(most_visited_item_id, 442 return most_visited_items_cache_.GetItemWithRestrictedID(most_visited_item_id,
434 item); 443 item);
435 } 444 }
OLDNEW
« no previous file with comments | « chrome/renderer/searchbox/searchbox.h ('k') | chrome/test/data/instant_extended.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698