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

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

Issue 10375021: Move Extension into extensions namespace (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Take 6 Created 8 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
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/common/extensions/extension_process_policy.h" 5 #include "chrome/common/extensions/extension_process_policy.h"
6 6
7 #include "chrome/common/extensions/extension_set.h" 7 #include "chrome/common/extensions/extension_set.h"
8 8
9 namespace extensions { 9 namespace extensions {
10 10
11 const Extension* GetNonBookmarkAppExtension( 11 const extensions::Extension* GetNonBookmarkAppExtension(
12 const ExtensionSet& extensions, const ExtensionURLInfo& url) { 12 const ExtensionSet& extensions, const ExtensionURLInfo& url) {
13 // Exclude bookmark apps, which do not use the app process model. 13 // Exclude bookmark apps, which do not use the app process model.
14 const Extension* extension = extensions.GetExtensionOrAppByURL(url); 14 const extensions::Extension* extension =
15 extensions.GetExtensionOrAppByURL(url);
15 if (extension && extension->from_bookmark()) 16 if (extension && extension->from_bookmark())
16 extension = NULL; 17 extension = NULL;
17 return extension; 18 return extension;
18 } 19 }
19 20
20 bool CrossesExtensionProcessBoundary( 21 bool CrossesExtensionProcessBoundary(
21 const ExtensionSet& extensions, 22 const ExtensionSet& extensions,
22 const ExtensionURLInfo& old_url, 23 const ExtensionURLInfo& old_url,
23 const ExtensionURLInfo& new_url) { 24 const ExtensionURLInfo& new_url) {
24 const Extension* old_url_extension = GetNonBookmarkAppExtension(extensions, 25 const extensions::Extension* old_url_extension = GetNonBookmarkAppExtension(
25 old_url); 26 extensions,
26 const Extension* new_url_extension = GetNonBookmarkAppExtension(extensions, 27 old_url);
27 new_url); 28 const extensions::Extension* new_url_extension = GetNonBookmarkAppExtension(
29 extensions,
30 new_url);
28 31
29 // TODO(creis): Temporary workaround for crbug.com/59285: Do not swap process 32 // TODO(creis): Temporary workaround for crbug.com/59285: Do not swap process
30 // to navigate from a hosted app to a normal page or another hosted app 33 // to navigate from a hosted app to a normal page or another hosted app
31 // (unless either is the web store). This is because we do not yet support 34 // (unless either is the web store). This is because we do not yet support
32 // postMessage calls from outside the app back into it (e.g., as in Facebook 35 // postMessage calls from outside the app back into it (e.g., as in Facebook
33 // OAuth 2.0). This will be removed when http://crbug.com/99202 is fixed. 36 // OAuth 2.0). This will be removed when http://crbug.com/99202 is fixed.
34 bool old_url_is_hosted_app = old_url_extension && 37 bool old_url_is_hosted_app = old_url_extension &&
35 !old_url_extension->web_extent().is_empty(); 38 !old_url_extension->web_extent().is_empty();
36 bool new_url_is_normal_or_hosted = !new_url_extension || 39 bool new_url_is_normal_or_hosted = !new_url_extension ||
37 !new_url_extension->web_extent().is_empty(); 40 !new_url_extension->web_extent().is_empty();
38 bool either_is_web_store = 41 bool either_is_web_store =
39 (old_url_extension && 42 (old_url_extension &&
40 old_url_extension->id() == extension_misc::kWebStoreAppId) || 43 old_url_extension->id() == extension_misc::kWebStoreAppId) ||
41 (new_url_extension && 44 (new_url_extension &&
42 new_url_extension->id() == extension_misc::kWebStoreAppId); 45 new_url_extension->id() == extension_misc::kWebStoreAppId);
43 if (old_url_is_hosted_app && 46 if (old_url_is_hosted_app &&
44 new_url_is_normal_or_hosted && 47 new_url_is_normal_or_hosted &&
45 !either_is_web_store) 48 !either_is_web_store)
46 return false; 49 return false;
47 50
48 return old_url_extension != new_url_extension; 51 return old_url_extension != new_url_extension;
49 } 52 }
50 53
51 } // namespace extensions 54 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/common/extensions/extension_process_policy.h ('k') | chrome/common/extensions/extension_resource_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698