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

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

Issue 11091050: InstantExtended: Add js api for custom logo. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 2 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 509bfe1e519420598094f56f21108422bf6457dd..6b0c84e58e2dabba0185a75d4a1183185ef94625 100644
--- a/chrome/browser/instant/instant_loader.cc
+++ b/chrome/browser/instant/instant_loader.cc
@@ -90,6 +90,10 @@ class InstantLoader::WebContentsDelegateImpl
void OnSetSuggestions(int page_id,
const std::vector<InstantSuggestion>& suggestions);
+ // Message from renderer indicating whether the page has a custom logo to
+ // display on the NTP.
+ void OnSetHasCustomLogo(int page_id, bool has_logo);
+
// Message from the renderer determining whether it supports the Instant API.
void OnInstantSupportDetermined(int page_id, bool result);
@@ -200,6 +204,8 @@ bool InstantLoader::WebContentsDelegateImpl::OnMessageReceived(
bool handled = true;
IPC_BEGIN_MESSAGE_MAP(WebContentsDelegateImpl, message)
IPC_MESSAGE_HANDLER(ChromeViewHostMsg_SetSuggestions, OnSetSuggestions)
+ IPC_MESSAGE_HANDLER(ChromeViewHostMsg_SetHasCustomLogo,
+ OnSetHasCustomLogo);
IPC_MESSAGE_HANDLER(ChromeViewHostMsg_InstantSupportDetermined,
OnInstantSupportDetermined)
IPC_MESSAGE_HANDLER(ChromeViewHostMsg_SetInstantPreviewHeight,
@@ -222,6 +228,21 @@ void InstantLoader::WebContentsDelegateImpl::OnSetSuggestions(
}
}
+// Message from renderer indicating whether the page has a custom logo to
+// display on the NTP.
+void InstantLoader::WebContentsDelegateImpl::OnSetHasCustomLogo(
+ int page_id,
+ bool has_logo) {
+ DCHECK(loader_->preview_contents());
+ DCHECK(loader_->preview_contents_->web_contents());
+ content::NavigationEntry* entry = loader_->preview_contents_->web_contents()->
+ GetController().GetActiveEntry();
+ if (entry && page_id == entry->GetPageID()) {
+ MaybeSetAndNotifyInstantSupportDetermined(true);
+ loader_->loader_delegate_->SetHasCustomLogo(loader_, has_logo);
+ }
+}
+
void InstantLoader::WebContentsDelegateImpl::OnInstantSupportDetermined(
int page_id,
bool result) {

Powered by Google App Engine
This is Rietveld 408576698