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

Unified Diff: chrome/browser/extensions/extension_tab_id_map.cc

Issue 8404046: When creating a tab contents for a browser in the RVHDelegateHelper, create a wrapper immediately. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: updates Created 9 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/extensions/extension_tab_id_map.cc
diff --git a/chrome/browser/extensions/extension_tab_id_map.cc b/chrome/browser/extensions/extension_tab_id_map.cc
index c07da6fdba3470fe2fab39fba880be11da859ae2..a52d8462d25481aea545e5a11703403c560c5621 100644
--- a/chrome/browser/extensions/extension_tab_id_map.cc
+++ b/chrome/browser/extensions/extension_tab_id_map.cc
@@ -12,6 +12,7 @@
#include "content/browser/tab_contents/tab_contents.h"
#include "content/browser/renderer_host/render_view_host.h"
#include "content/browser/renderer_host/render_process_host.h"
+#include "content/browser/tab_contents/navigation_details.h"
#include "content/public/browser/notification_registrar.h"
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_service.h"
@@ -46,6 +47,8 @@ ExtensionTabIdMap::TabObserver::TabObserver() {
content::NotificationService::AllBrowserContextsAndSources());
registrar_.Add(this, content::NOTIFICATION_TAB_PARENTED,
content::NotificationService::AllBrowserContextsAndSources());
+ registrar_.Add(this, content::NOTIFICATION_RETARGETING,
+ content::NotificationService::AllBrowserContextsAndSources());
}
ExtensionTabIdMap::TabObserver::~TabObserver() {
@@ -89,6 +92,25 @@ void ExtensionTabIdMap::TabObserver::Observe(
tab->restore_tab_helper()->window_id().id()));
break;
}
+ case content::NOTIFICATION_RETARGETING: {
+ content::RetargetingDetails* retargeting_details =
+ content::Details<content::RetargetingDetails>(details).ptr();
+ TabContents* contents = retargeting_details->target_tab_contents;
+ TabContentsWrapper* tab =
+ TabContentsWrapper::GetCurrentWrapperForContents(contents);
+ if (!tab)
+ break;
+ RenderViewHost* host = tab->render_view_host();
+ BrowserThread::PostTask(
+ BrowserThread::IO, FROM_HERE,
+ base::Bind(
+ &ExtensionTabIdMap::SetTabAndWindowId,
+ base::Unretained(ExtensionTabIdMap::GetInstance()),
+ host->process()->id(), host->routing_id(),
+ tab->restore_tab_helper()->session_id().id(),
+ tab->restore_tab_helper()->window_id().id()));
+ break;
+ }
case content::NOTIFICATION_RENDER_VIEW_HOST_DELETED: {
RenderViewHost* host = content::Source<RenderViewHost>(source).ptr();
BrowserThread::PostTask(

Powered by Google App Engine
This is Rietveld 408576698