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

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

Issue 14608004: Move instant support to SearchTabHelper. Fix InstantTab reset. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Guard instant-extended-only bits. Created 7 years, 8 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/search_tab_helper.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/search/search_tab_helper.cc
diff --git a/chrome/browser/ui/search/search_tab_helper.cc b/chrome/browser/ui/search/search_tab_helper.cc
index 400a1b4af157d86e731e3e683dbda975fb99e052..74a1acdb5fe3068e06ace9a68736b05fa921bfa6 100644
--- a/chrome/browser/ui/search/search_tab_helper.cc
+++ b/chrome/browser/ui/search/search_tab_helper.cc
@@ -33,13 +33,14 @@ bool IsSearchResults(const content::WebContents* contents) {
} // namespace
SearchTabHelper::SearchTabHelper(content::WebContents* web_contents)
- : WebContentsObserver(web_contents),
- is_search_enabled_(chrome::IsInstantExtendedAPIEnabled()),
+ : is_search_enabled_(chrome::IsInstantExtendedAPIEnabled()),
user_input_in_progress_(false),
web_contents_(web_contents) {
if (!is_search_enabled_)
return;
+ WebContentsObserver::Observe(web_contents);
+
registrar_.Add(
this,
content::NOTIFICATION_NAV_ENTRY_COMMITTED,
@@ -84,11 +85,22 @@ bool SearchTabHelper::OnMessageReceived(const IPC::Message& message) {
OnSearchBoxShowBars)
IPC_MESSAGE_HANDLER(ChromeViewHostMsg_SearchBoxHideBars,
OnSearchBoxHideBars)
+ IPC_MESSAGE_HANDLER(ChromeViewHostMsg_InstantSupportDetermined,
+ OnInstantSupportDetermined);
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP()
return handled;
}
+void SearchTabHelper::DidFinishLoad(
+ int64 /* frame_id */,
+ const GURL& /* validated_url */,
+ bool is_main_frame,
+ content::RenderViewHost* /* render_view_host */) {
+ if (is_main_frame)
+ DetermineIfPageSupportsInstant();
+}
+
void SearchTabHelper::UpdateMode() {
SearchMode::Type type = SearchMode::MODE_DEFAULT;
SearchMode::Origin origin = SearchMode::ORIGIN_DEFAULT;
@@ -104,6 +116,10 @@ void SearchTabHelper::UpdateMode() {
model_.SetMode(SearchMode(type, origin));
}
+void SearchTabHelper::DetermineIfPageSupportsInstant() {
+ Send(new ChromeViewMsg_DetermineIfPageSupportsInstant(routing_id()));
+}
+
void SearchTabHelper::OnSearchBoxShowBars(int page_id) {
if (web_contents()->IsActiveEntry(page_id))
model_.SetTopBarsVisible(true);
@@ -115,3 +131,9 @@ void SearchTabHelper::OnSearchBoxHideBars(int page_id) {
Send(new ChromeViewMsg_SearchBoxBarsHidden(routing_id()));
}
}
+
+void SearchTabHelper::OnInstantSupportDetermined(int page_id,
+ bool supports_instant) {
+ if (web_contents()->IsActiveEntry(page_id))
+ model_.SetSupportsInstant(supports_instant);
+}
« no previous file with comments | « chrome/browser/ui/search/search_tab_helper.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698