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

Side by Side Diff: chrome/common/extensions/extension_process_policy.cc

Issue 2386503002: With --isolate-extensions, forking (via OpenURL) for extensions is not needed.
Patch Set: Rebasing... Created 3 years, 7 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
(Empty)
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/common/extensions/extension_process_policy.h"
6
7 #include "base/strings/string_util.h"
8 #include "chrome/common/extensions/extension_constants.h"
9 #include "extensions/common/constants.h"
10 #include "extensions/common/extension.h"
11 #include "extensions/common/extension_set.h"
12 #include "extensions/common/manifest_handlers/app_isolation_info.h"
13 #include "extensions/common/switches.h"
14
15 namespace extensions {
16
17 const extensions::Extension* GetNonBookmarkAppExtension(
18 const ExtensionSet& extensions, const GURL& url) {
19 // Exclude bookmark apps, which do not use the app process model.
20 const extensions::Extension* extension =
21 extensions.GetExtensionOrAppByURL(url);
22 if (extension && extension->from_bookmark())
23 extension = NULL;
24 return extension;
25 }
26
27 bool CrossesExtensionProcessBoundary(
28 const ExtensionSet& extensions,
29 const GURL& old_url,
30 const GURL& new_url,
31 bool should_consider_workaround) {
32 const extensions::Extension* old_url_extension = GetNonBookmarkAppExtension(
33 extensions,
34 old_url);
35 const extensions::Extension* new_url_extension = GetNonBookmarkAppExtension(
36 extensions,
37 new_url);
38
39 // TODO(creis): Temporary workaround for crbug.com/59285: Do not swap process
40 // to navigate from a hosted app to a normal page or another hosted app
41 // (unless either is the web store). This is because some OAuth providers
42 // use non-app popups that communicate with non-app iframes inside the app
43 // (e.g., Facebook). This would require out-of-process iframes to support.
44 // See http://crbug.com/99379.
45 // Note that we skip this exception for isolated apps, which require strict
46 // process separation from non-app pages.
47 if (should_consider_workaround) {
48 bool old_url_is_hosted_app = old_url_extension &&
49 !old_url_extension->web_extent().is_empty() &&
50 !AppIsolationInfo::HasIsolatedStorage(old_url_extension);
51 bool new_url_is_normal_or_hosted = !new_url_extension ||
52 (!new_url_extension->web_extent().is_empty() &&
53 !AppIsolationInfo::HasIsolatedStorage(new_url_extension));
54 bool either_is_web_store =
55 (old_url_extension &&
56 old_url_extension->id() == extensions::kWebStoreAppId) ||
57 (new_url_extension &&
58 new_url_extension->id() == extensions::kWebStoreAppId);
59 if (old_url_is_hosted_app &&
60 new_url_is_normal_or_hosted &&
61 !either_is_web_store)
62 return false;
63 }
64
65 return old_url_extension != new_url_extension;
66 }
67
68 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/common/extensions/extension_process_policy.h ('k') | chrome/renderer/chrome_content_renderer_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698