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

Unified Diff: chrome/browser/tab_contents/render_view_host_delegate_helper.cc

Issue 8403024: Set extension-related webkit preferences in a common location. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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/tab_contents/render_view_host_delegate_helper.cc
diff --git a/chrome/browser/tab_contents/render_view_host_delegate_helper.cc b/chrome/browser/tab_contents/render_view_host_delegate_helper.cc
index d2e9bce2e78fc0084e56644320aaa52359b8417a..2a802d9613e515a2fe85820ad0c5b2ba9130d914 100644
--- a/chrome/browser/tab_contents/render_view_host_delegate_helper.cc
+++ b/chrome/browser/tab_contents/render_view_host_delegate_helper.cc
@@ -13,7 +13,9 @@
#include "chrome/browser/background/background_contents_service_factory.h"
#include "chrome/browser/chrome_content_browser_client.h"
#include "chrome/browser/character_encoding.h"
+#include "chrome/browser/extensions/extension_process_manager.h"
#include "chrome/browser/extensions/extension_service.h"
+#include "chrome/browser/extensions/extension_webkit_preferences.h"
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/browser/prefs/scoped_user_pref_update.h"
#include "chrome/browser/prerender/prerender_manager.h"
@@ -326,8 +328,9 @@ RenderWidgetHostView*
// static
WebPreferences RenderViewHostDelegateHelper::GetWebkitPrefs(
- content::BrowserContext* browser_context, bool is_web_ui) {
- Profile* profile = Profile::FromBrowserContext(browser_context);
+ RenderViewHost* rvh, bool is_web_ui) {
+ Profile* profile = Profile::FromBrowserContext(
+ rvh->process()->browser_context());
PrefService* prefs = profile->GetPrefs();
WebPreferences web_prefs;
@@ -532,6 +535,15 @@ WebPreferences RenderViewHostDelegateHelper::GetWebkitPrefs(
web_prefs.is_online = !net::NetworkChangeNotifier::IsOffline();
+ ExtensionProcessManager* extension_process_manager =
+ profile->GetExtensionProcessManager();
+ if (extension_process_manager) {
+ const Extension* extension =
+ extension_process_manager->GetExtensionForSiteInstance(
+ rvh->site_instance()->id());
+ extension_webkit_preferences::SetPreferences(&web_prefs, extension);
+ }
+
return web_prefs;
}

Powered by Google App Engine
This is Rietveld 408576698