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

Unified Diff: chrome/browser/chrome_content_browser_client.cc

Issue 383213007: ifdef more extensions code to be used only when extensions are enabled. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 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/chrome_content_browser_client.cc
diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc
index ed973ca45813f97c0536f15abec0cb06c7f94dec..ecc7927fb5e1d06f000331f41c0a26357c03e93f 100644
--- a/chrome/browser/chrome_content_browser_client.cc
+++ b/chrome/browser/chrome_content_browser_client.cc
@@ -1415,10 +1415,14 @@ bool ChromeContentBrowserClient::ShouldSwapBrowsingInstancesForNavigation(
bool ChromeContentBrowserClient::ShouldSwapProcessesForRedirect(
content::ResourceContext* resource_context, const GURL& current_url,
const GURL& new_url) {
+#if defined(ENABLE_EXTENSIONS)
ProfileIOData* io_data = ProfileIOData::FromResourceContext(resource_context);
return extensions::CrossesExtensionProcessBoundary(
io_data->GetExtensionInfoMap()->extensions(),
current_url, new_url, false);
+#else
+ return false;
+#endif
}
bool ChromeContentBrowserClient::ShouldAssignSiteForURL(const GURL& url) {
@@ -1940,10 +1944,12 @@ net::URLRequestContext*
ChromeContentBrowserClient::OverrideRequestContextForURL(
const GURL& url, content::ResourceContext* context) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
+#if defined(ENABLE_EXTENSIONS)
if (url.SchemeIs(extensions::kExtensionScheme)) {
ProfileIOData* io_data = ProfileIOData::FromResourceContext(context);
return io_data->extensions_request_context();
}
+#endif
return NULL;
}
@@ -2249,12 +2255,15 @@ bool ChromeContentBrowserClient::CanCreateWindow(
*no_javascript_access = false;
+#if defined(ENABLE_EXTENSIONS)
ProfileIOData* io_data = ProfileIOData::FromResourceContext(context);
Tom Sepez 2014/07/14 16:12:43 nit: can these declarations move into the #if bloc
Lei Zhang 2014/07/14 21:26:06 Thanks, done.
InfoMap* map = io_data->GetExtensionInfoMap();
+#endif
// If the opener is trying to create a background window but doesn't have
// the appropriate permission, fail the attempt.
if (container_type == WINDOW_CONTAINER_TYPE_BACKGROUND) {
+#if defined(ENABLE_EXTENSIONS)
if (!map->SecurityOriginHasAPIPermission(
source_origin,
render_process_id,
@@ -2272,6 +2281,7 @@ bool ChromeContentBrowserClient::CanCreateWindow(
map->extensions().GetExtensionOrAppByURL(opener_url);
if (extension && !extensions::BackgroundInfo::AllowJSAccess(extension))
*no_javascript_access = true;
+#endif
return true;
}
@@ -2323,12 +2333,16 @@ bool ChromeContentBrowserClient::CanCreateWindow(
std::string ChromeContentBrowserClient::GetWorkerProcessTitle(
const GURL& url, content::ResourceContext* context) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
+#if defined(ENABLE_EXTENSIONS)
// Check if it's an extension-created worker, in which case we want to use
// the name of the extension.
ProfileIOData* io_data = ProfileIOData::FromResourceContext(context);
const Extension* extension =
io_data->GetExtensionInfoMap()->extensions().GetByID(url.host());
return extension ? extension->name() : std::string();
+#else
+ return std::string();
+#endif
}
void ChromeContentBrowserClient::ResourceDispatcherHostCreated() {

Powered by Google App Engine
This is Rietveld 408576698