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

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: Minor fixes. 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..5c54e171ad5dd8a303247a7c68a752a1f2b09b0e 100644
--- a/chrome/browser/instant/instant_loader.cc
+++ b/chrome/browser/instant/instant_loader.cc
@@ -15,6 +15,7 @@
#include "chrome/browser/ui/tab_contents/core_tab_helper.h"
#include "chrome/browser/ui/tab_contents/core_tab_helper_delegate.h"
#include "chrome/browser/ui/tab_contents/tab_contents.h"
+#include "chrome/common/instant_types.h"
#include "chrome/common/render_messages.h"
#include "content/public/browser/navigation_entry.h"
#include "content/public/browser/notification_source.h"
@@ -79,6 +80,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 +196,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 +235,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() {

Powered by Google App Engine
This is Rietveld 408576698