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

Unified Diff: chrome/renderer/searchbox/searchbox.cc

Issue 14646034: Add onfocuschange to the Extended Search API, with associated isFocused attribute. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 side-by-side diff with in-line comments
Download patch
Index: chrome/renderer/searchbox/searchbox.cc
diff --git a/chrome/renderer/searchbox/searchbox.cc b/chrome/renderer/searchbox/searchbox.cc
index d72a60cb974e1980cc468d7c80dacee9f005c40e..5130222bba2615eff921b21a6cb7a10048beb304 100644
--- a/chrome/renderer/searchbox/searchbox.cc
+++ b/chrome/renderer/searchbox/searchbox.cc
@@ -67,6 +67,7 @@ SearchBox::SearchBox(content::RenderView* render_view)
is_key_capture_enabled_(false),
display_instant_results_(false),
omnibox_font_size_(0),
+ is_focused_(false),
autocomplete_results_cache_(kMaxInstantAutocompleteResultItemCacheSize),
most_visited_items_cache_(kMaxInstantMostVisitedItemCacheSize) {
}
@@ -209,6 +210,8 @@ bool SearchBox::OnMessageReceived(const IPC::Message& message) {
OnFontInformationReceived)
IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxMostVisitedItemsChanged,
OnMostVisitedChanged)
+ IPC_MESSAGE_HANDLER(ChromeViewMsg_SearchBoxFocusChanged,
+ OnFocusChanged)
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP()
return handled;
@@ -442,3 +445,11 @@ bool SearchBox::GetMostVisitedItemWithID(
return most_visited_items_cache_.GetItemWithRestrictedID(most_visited_item_id,
item);
}
+
+void SearchBox::OnFocusChanged(bool is_focused) {
+ is_focused_ = is_focused;
+ if (render_view()->GetWebView() && render_view()->GetWebView()->mainFrame()) {
+ extensions_v8::SearchBoxExtension::DispatchFocusChange(
+ render_view()->GetWebView()->mainFrame());
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698