summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkalman@chromium.org <kalman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-05-28 23:54:27 +0000
committerkalman@chromium.org <kalman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-05-28 23:54:27 +0000
commitead70321a7dfc5d66ae10d0a8560aa8981f8b39e (patch)
treec7ccbaf7a6c350bb4c7cb7e3c88b9098ae6898e9
parent9f4a56be5923dfb62216b81c10d2c05a2f52f9e2 (diff)
downloadchromium_src-ead70321a7dfc5d66ae10d0a8560aa8981f8b39e.zip
chromium_src-ead70321a7dfc5d66ae10d0a8560aa8981f8b39e.tar.gz
chromium_src-ead70321a7dfc5d66ae10d0a8560aa8981f8b39e.tar.bz2
Merge 201182 "Send the extension tab ID to the render view when ..."
> Send the extension tab ID to the render view when TabHelper is created in > addition to when a render view is created. This fixes a (easily reproducible) > race condition preventing activeTab from working when tabs are opened from > other websites (i.e. that share processes, presumably). > > BUG=239374 > > Review URL: https://chromiumcodereview.appspot.com/15389002 TBR=kalman@chromium.org Review URL: https://codereview.chromium.org/15925009 git-svn-id: svn://svn.chromium.org/chrome/branches/1500/src@202694 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/extensions/tab_helper.cc12
-rw-r--r--chrome/browser/extensions/tab_helper.h3
2 files changed, 12 insertions, 3 deletions
diff --git a/chrome/browser/extensions/tab_helper.cc b/chrome/browser/extensions/tab_helper.cc
index 5c2b4cf..1a069ac 100644
--- a/chrome/browser/extensions/tab_helper.cc
+++ b/chrome/browser/extensions/tab_helper.cc
@@ -93,6 +93,8 @@ TabHelper::TabHelper(content::WebContents* web_contents)
// The ActiveTabPermissionManager requires a session ID; ensure this
// WebContents has one.
SessionTabHelper::CreateForWebContents(web_contents);
+ if (web_contents->GetRenderViewHost())
+ SetTabId(web_contents->GetRenderViewHost());
active_tab_permission_granter_.reset(new ActiveTabPermissionGranter(
web_contents,
SessionID::IdForTab(web_contents),
@@ -185,9 +187,7 @@ SkBitmap* TabHelper::GetExtensionAppIcon() {
}
void TabHelper::RenderViewCreated(RenderViewHost* render_view_host) {
- render_view_host->Send(
- new ExtensionMsg_SetTabId(render_view_host->GetRoutingID(),
- SessionID::IdForTab(web_contents())));
+ SetTabId(render_view_host);
}
void TabHelper::DidNavigateMainFrame(
@@ -460,4 +460,10 @@ void TabHelper::Observe(int type,
}
}
+void TabHelper::SetTabId(RenderViewHost* render_view_host) {
+ render_view_host->Send(
+ new ExtensionMsg_SetTabId(render_view_host->GetRoutingID(),
+ SessionID::IdForTab(web_contents())));
+}
+
} // namespace extensions
diff --git a/chrome/browser/extensions/tab_helper.h b/chrome/browser/extensions/tab_helper.h
index b38d84a..7f97cdf 100644
--- a/chrome/browser/extensions/tab_helper.h
+++ b/chrome/browser/extensions/tab_helper.h
@@ -219,6 +219,9 @@ class TabHelper : public content::WebContentsObserver,
// the data is available.
void GetApplicationInfo(int32 page_id);
+ // Sends our tab ID to |render_view_host|.
+ void SetTabId(content::RenderViewHost* render_view_host);
+
// Data for app extensions ---------------------------------------------------
// Our content script observers. Declare at top so that it will outlive all