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

Unified Diff: chrome/browser/instant/instant_loader.cc

Issue 10915217: Hook up SetInstantPreviewHeight for ChromeOS. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Move hidden notification, too. Created 8 years, 3 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/browser/instant/instant_loader.cc
diff --git a/chrome/browser/instant/instant_loader.cc b/chrome/browser/instant/instant_loader.cc
index b954746701cdaf852703817f32c0c4e51a446b63..8bb2329e0d5f943fb037c152fc2e80c8ba7d0341 100644
--- a/chrome/browser/instant/instant_loader.cc
+++ b/chrome/browser/instant/instant_loader.cc
@@ -79,6 +79,11 @@ class InstantLoader::WebContentsDelegateImpl
// Message from the renderer determining whether it supports the Instant API.
void OnInstantSupportDetermined(int page_id, bool result);
+ // Message from the renderer requesting the preview be resized.
+ void OnSetInstantPreviewHeight(int page_id,
+ int height,
+ InstantSizeUnits units);
+
void CommitFromPointerReleaseIfNecessary();
void MaybeSetAndNotifyInstantSupportDetermined(bool supports_instant);
@@ -190,6 +195,8 @@ bool InstantLoader::WebContentsDelegateImpl::OnMessageReceived(
IPC_MESSAGE_HANDLER(ChromeViewHostMsg_SetSuggestions, OnSetSuggestions)
IPC_MESSAGE_HANDLER(ChromeViewHostMsg_InstantSupportDetermined,
OnInstantSupportDetermined)
+ IPC_MESSAGE_HANDLER(ChromeViewHostMsg_SetInstantPreviewHeight,
+ OnSetInstantPreviewHeight);
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP()
return handled;
@@ -227,6 +234,23 @@ void InstantLoader::WebContentsDelegateImpl::OnInstantSupportDetermined(
MaybeSetAndNotifyInstantSupportDetermined(result);
}
+void InstantLoader::WebContentsDelegateImpl::OnSetInstantPreviewHeight(
+ int page_id,
+ int height,
+ InstantSizeUnits units) {
+ DCHECK(loader_->preview_contents() &&
+ loader_->preview_contents_->web_contents());
+ // TODO(sreeram): Remove this 'if' bandaid once bug 141875 is confirmed fixed.
+ if (!loader_->preview_contents() ||
+ !loader_->preview_contents_->web_contents())
+ return;
+ content::NavigationEntry* entry = loader_->preview_contents_->web_contents()->
+ GetController().GetActiveEntry();
+ if (entry && page_id == entry->GetPageID()) {
+ MaybeSetAndNotifyInstantSupportDetermined(true);
+ loader_->loader_delegate_->SetInstantPreviewHeight(loader_, height, units);
+ }
+}
void InstantLoader::WebContentsDelegateImpl
::CommitFromPointerReleaseIfNecessary() {
« no previous file with comments | « chrome/browser/instant/instant_controller_delegate.h ('k') | chrome/browser/instant/instant_loader_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698