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

Side by Side Diff: chrome/browser/extensions/chrome_content_browser_client_extensions_part.cc

Issue 1377933004: Modify --isolate-extensions to not isolate hosted apps. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@no_isolate_apps3
Patch Set: Fixes from charlie Created 5 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/extensions/chrome_content_browser_client_extensions_par t.h" 5 #include "chrome/browser/extensions/chrome_content_browser_client_extensions_par t.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "chrome/browser/browser_process.h" 10 #include "chrome/browser/browser_process.h"
11 #include "chrome/browser/extensions/browser_permissions_policy_delegate.h" 11 #include "chrome/browser/extensions/browser_permissions_policy_delegate.h"
12 #include "chrome/browser/extensions/extension_service.h" 12 #include "chrome/browser/extensions/extension_service.h"
13 #include "chrome/browser/extensions/extension_web_ui.h" 13 #include "chrome/browser/extensions/extension_web_ui.h"
14 #include "chrome/browser/extensions/extension_webkit_preferences.h" 14 #include "chrome/browser/extensions/extension_webkit_preferences.h"
15 #include "chrome/browser/media_galleries/fileapi/media_file_system_backend.h" 15 #include "chrome/browser/media_galleries/fileapi/media_file_system_backend.h"
16 #include "chrome/browser/profiles/profile.h" 16 #include "chrome/browser/profiles/profile.h"
17 #include "chrome/browser/profiles/profile_io_data.h" 17 #include "chrome/browser/profiles/profile_io_data.h"
18 #include "chrome/browser/profiles/profile_manager.h" 18 #include "chrome/browser/profiles/profile_manager.h"
19 #include "chrome/browser/renderer_host/chrome_extension_message_filter.h" 19 #include "chrome/browser/renderer_host/chrome_extension_message_filter.h"
20 #include "chrome/browser/sync_file_system/local/sync_file_system_backend.h" 20 #include "chrome/browser/sync_file_system/local/sync_file_system_backend.h"
21 #include "chrome/common/chrome_constants.h" 21 #include "chrome/common/chrome_constants.h"
22 #include "chrome/common/chrome_switches.h"
22 #include "chrome/common/extensions/extension_process_policy.h" 23 #include "chrome/common/extensions/extension_process_policy.h"
23 #include "components/guest_view/browser/guest_view_message_filter.h" 24 #include "components/guest_view/browser/guest_view_message_filter.h"
24 #include "content/public/browser/browser_thread.h" 25 #include "content/public/browser/browser_thread.h"
25 #include "content/public/browser/browser_url_handler.h" 26 #include "content/public/browser/browser_url_handler.h"
26 #include "content/public/browser/render_process_host.h" 27 #include "content/public/browser/render_process_host.h"
27 #include "content/public/browser/render_view_host.h" 28 #include "content/public/browser/render_view_host.h"
28 #include "content/public/browser/site_instance.h" 29 #include "content/public/browser/site_instance.h"
29 #include "content/public/browser/web_contents.h" 30 #include "content/public/browser/web_contents.h"
30 #include "content/public/common/content_switches.h" 31 #include "content/public/common/content_switches.h"
31 #include "extensions/browser/api/web_request/web_request_api.h" 32 #include "extensions/browser/api/web_request/web_request_api.h"
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 } 178 }
178 } 179 }
179 180
180 // Hosted apps that have script access to their background page must use 181 // Hosted apps that have script access to their background page must use
181 // process per site, since all instances can make synchronous calls to the 182 // process per site, since all instances can make synchronous calls to the
182 // background window. Other extensions should use process per site as well. 183 // background window. Other extensions should use process per site as well.
183 return true; 184 return true;
184 } 185 }
185 186
186 // static 187 // static
188 bool ChromeContentBrowserClientExtensionsPart::DoesSiteRequireDedicatedProcess(
189 content::BrowserContext* browser_context,
190 const GURL& effective_site_url) {
191 if (effective_site_url.SchemeIs(extensions::kExtensionScheme)) {
192 // --isolate-extensions should isolate extensions, except for hosted apps.
193 // Isolating hosted apps is a good idea, but ought to be a separate knob.
194 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
195 ::switches::kIsolateExtensions)) {
196 const Extension* extension =
197 ExtensionRegistry::Get(browser_context)
198 ->enabled_extensions()
199 .GetExtensionOrAppByURL(effective_site_url);
200 if (extension && !extension->is_hosted_app())
201 return true;
202 }
203 }
204 return false;
205 }
206
207 // static
187 bool ChromeContentBrowserClientExtensionsPart::ShouldLockToOrigin( 208 bool ChromeContentBrowserClientExtensionsPart::ShouldLockToOrigin(
188 content::BrowserContext* browser_context, 209 content::BrowserContext* browser_context,
189 const GURL& effective_site_url) { 210 const GURL& effective_site_url) {
190 // https://crbug.com/160576 workaround: Origin lock to the chrome-extension:// 211 // https://crbug.com/160576 workaround: Origin lock to the chrome-extension://
191 // scheme for a hosted app would kill processes on legitimate requests for the 212 // scheme for a hosted app would kill processes on legitimate requests for the
192 // app's cookies. 213 // app's cookies.
193 if (effective_site_url.SchemeIs(extensions::kExtensionScheme)) { 214 if (effective_site_url.SchemeIs(extensions::kExtensionScheme)) {
194 const Extension* extension = 215 const Extension* extension =
195 ExtensionRegistry::Get(browser_context) 216 ExtensionRegistry::Get(browser_context)
196 ->enabled_extensions() 217 ->enabled_extensions()
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after
592 command_line->AppendSwitch(::switches::kEnableWebRtcHWH264Encoding); 613 command_line->AppendSwitch(::switches::kEnableWebRtcHWH264Encoding);
593 #endif 614 #endif
594 if (base::CommandLine::ForCurrentProcess()->HasSwitch( 615 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
595 switches::kEnableMojoSerialService)) { 616 switches::kEnableMojoSerialService)) {
596 command_line->AppendSwitch(switches::kEnableMojoSerialService); 617 command_line->AppendSwitch(switches::kEnableMojoSerialService);
597 } 618 }
598 } 619 }
599 } 620 }
600 621
601 } // namespace extensions 622 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/chrome_content_browser_client_extensions_part.h ('k') | chrome/browser/site_details.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698