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

Unified Diff: chrome/browser/ui/search/instant_page.cc

Issue 12851023: Refactor omnibox focus API into a single method. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: '' Created 7 years, 9 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
« no previous file with comments | « chrome/browser/ui/search/instant_page.h ('k') | chrome/chrome_common.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/search/instant_page.cc
diff --git a/chrome/browser/ui/search/instant_page.cc b/chrome/browser/ui/search/instant_page.cc
index 764a5658b1865df35f4eaadc972a3840a68b2cfd..a94b2444e4399587c552566930186c303a6dd3bc 100644
--- a/chrome/browser/ui/search/instant_page.cc
+++ b/chrome/browser/ui/search/instant_page.cc
@@ -161,10 +161,6 @@ bool InstantPage::OnMessageReceived(const IPC::Message& message) {
IPC_MESSAGE_HANDLER(ChromeViewHostMsg_ShowInstantOverlay,
OnShowInstantOverlay)
IPC_MESSAGE_HANDLER(ChromeViewHostMsg_FocusOmnibox, OnFocusOmnibox)
- IPC_MESSAGE_HANDLER(ChromeViewHostMsg_StartCapturingKeyStrokes,
- OnStartCapturingKeyStrokes);
- IPC_MESSAGE_HANDLER(ChromeViewHostMsg_StopCapturingKeyStrokes,
- OnStopCapturingKeyStrokes);
IPC_MESSAGE_HANDLER(ChromeViewHostMsg_SearchBoxNavigate,
OnSearchBoxNavigate);
IPC_MESSAGE_HANDLER(ChromeViewHostMsg_SearchBoxDeleteMostVisitedItem,
@@ -228,27 +224,25 @@ void InstantPage::OnShowInstantOverlay(int page_id,
}
}
-void InstantPage::OnFocusOmnibox(int page_id) {
+void InstantPage::OnFocusOmnibox(int page_id, OmniboxFocusState state) {
if (contents()->IsActiveEntry(page_id)) {
OnInstantSupportDetermined(page_id, true);
- if (ShouldProcessFocusOmnibox())
- delegate_->FocusOmnibox(contents());
- }
-}
-
-void InstantPage::OnStartCapturingKeyStrokes(int page_id) {
- if (contents()->IsActiveEntry(page_id)) {
- OnInstantSupportDetermined(page_id, true);
- if (ShouldProcessStartCapturingKeyStrokes())
- delegate_->StartCapturingKeyStrokes(contents());
- }
-}
-
-void InstantPage::OnStopCapturingKeyStrokes(int page_id) {
- if (contents()->IsActiveEntry(page_id)) {
- OnInstantSupportDetermined(page_id, true);
- if (ShouldProcessStopCapturingKeyStrokes())
- delegate_->StopCapturingKeyStrokes(contents());
+ switch (state) {
+ case OMNIBOX_FOCUS_VISIBLE:
+ if (ShouldProcessFocusOmnibox())
+ delegate_->FocusOmnibox(contents());
+ break;
+ case OMNIBOX_FOCUS_INVISIBLE:
+ if (ShouldProcessStartCapturingKeyStrokes())
+ delegate_->StartCapturingKeyStrokes(contents());
+ break;
+ case OMNIBOX_FOCUS_NONE:
+ if (ShouldProcessStopCapturingKeyStrokes())
+ delegate_->StopCapturingKeyStrokes(contents());
kmadhusu 2013/03/26 18:56:17 From my understanding of the bug report, we want t
sreeram 2013/03/26 19:01:24 Let's not. InstantPage should be a simple message
kmadhusu 2013/03/26 21:04:00 Done. Moved this logic to InstantController. Can
+ break;
+ default:
+ NOTREACHED();
+ }
}
}
« no previous file with comments | « chrome/browser/ui/search/instant_page.h ('k') | chrome/chrome_common.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698