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

Unified Diff: content/browser/browser_plugin/browser_plugin_guest.cc

Issue 11027065: Browser plugin: Implement titleChanged event. (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: content/browser/browser_plugin/browser_plugin_guest.cc
diff --git a/content/browser/browser_plugin/browser_plugin_guest.cc b/content/browser/browser_plugin/browser_plugin_guest.cc
index b65256c27f1fce7233363df7a66a376a1daa98d8..b4d95b1bfecad5dd92489d537020e63afcbb2198 100644
--- a/content/browser/browser_plugin/browser_plugin_guest.cc
+++ b/content/browser/browser_plugin/browser_plugin_guest.cc
@@ -14,6 +14,7 @@
#include "content/browser/web_contents/web_contents_impl.h"
#include "content/common/browser_plugin_messages.h"
#include "content/common/view_messages.h"
+#include "content/public/browser/navigation_entry.h"
#include "content/public/browser/notification_service.h"
#include "content/public/browser/notification_types.h"
#include "content/public/browser/render_process_host.h"
@@ -55,6 +56,9 @@ BrowserPluginGuest::BrowserPluginGuest(int instance_id,
notification_registrar_.Add(
this, content::NOTIFICATION_RESOURCE_RECEIVED_REDIRECT,
content::Source<content::WebContents>(web_contents));
+ notification_registrar_.Add(
+ this, content::NOTIFICATION_WEB_CONTENTS_TITLE_UPDATED,
+ content::Source<content::WebContents>(web_contents));
}
BrowserPluginGuest::~BrowserPluginGuest() {
@@ -89,6 +93,16 @@ void BrowserPluginGuest::Observe(int type,
is_top_level);
break;
}
+ case NOTIFICATION_WEB_CONTENTS_TITLE_UPDATED: {
+ DCHECK_EQ(Source<WebContents>(source).ptr(), web_contents());
+ std::pair<NavigationEntry*, bool>* title =
+ Details<std::pair<NavigationEntry*, bool> >(details).ptr();
+ if (title->first) {
+ string16 title_text = title->first->GetTitle();
+ TitleChanged(title_text);
+ }
+ break;
+ }
default:
NOTREACHED() << "Unexpected notification sent.";
break;
@@ -367,6 +381,11 @@ void BrowserPluginGuest::LoadRedirect(
instance_id(), old_url, new_url, is_top_level));
}
+void BrowserPluginGuest::TitleChanged(const string16& title) {
+ SendMessageToEmbedder(
+ new BrowserPluginMsg_TitleChanged(instance_id(), title));
+}
+
void BrowserPluginGuest::DidCommitProvisionalLoadForFrame(
int64 frame_id,
bool is_main_frame,

Powered by Google App Engine
This is Rietveld 408576698