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: extensions/browser/extension_util.cc

Issue 1351223003: Allow extensions to specify that they are not allowed in incognito mode. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add expectations for IncognitoInfo to test Created 5 years, 3 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
« no previous file with comments | « extensions/browser/extension_util.h ('k') | extensions/common/extension.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "extensions/browser/extension_util.h" 5 #include "extensions/browser/extension_util.h"
6 6
7 #include "extensions/browser/extension_prefs.h" 7 #include "extensions/browser/extension_prefs.h"
8 #include "extensions/browser/extension_registry.h" 8 #include "extensions/browser/extension_registry.h"
9 #include "extensions/common/manifest_handlers/app_isolation_info.h" 9 #include "extensions/common/manifest_handlers/app_isolation_info.h"
10 #include "extensions/common/manifest_handlers/incognito_info.h"
10 11
11 namespace extensions { 12 namespace extensions {
12 namespace util { 13 namespace util {
13 14
14 bool IsExtensionInstalledPermanently(const std::string& extension_id, 15 bool IsExtensionInstalledPermanently(const std::string& extension_id,
15 content::BrowserContext* context) { 16 content::BrowserContext* context) {
16 const Extension* extension = ExtensionRegistry::Get(context)-> 17 const Extension* extension = ExtensionRegistry::Get(context)->
17 GetExtensionById(extension_id, ExtensionRegistry::EVERYTHING); 18 GetExtensionById(extension_id, ExtensionRegistry::EVERYTHING);
18 return extension && !IsEphemeralApp(extension_id, context); 19 return extension && !IsEphemeralApp(extension_id, context);
19 } 20 }
(...skipping 21 matching lines...) Expand all
41 } 42 }
42 43
43 bool SiteHasIsolatedStorage(const GURL& extension_site_url, 44 bool SiteHasIsolatedStorage(const GURL& extension_site_url,
44 content::BrowserContext* context) { 45 content::BrowserContext* context) {
45 const Extension* extension = ExtensionRegistry::Get(context)-> 46 const Extension* extension = ExtensionRegistry::Get(context)->
46 enabled_extensions().GetExtensionOrAppByURL(extension_site_url); 47 enabled_extensions().GetExtensionOrAppByURL(extension_site_url);
47 48
48 return extension && AppIsolationInfo::HasIsolatedStorage(extension); 49 return extension && AppIsolationInfo::HasIsolatedStorage(extension);
49 } 50 }
50 51
52 bool CanBeIncognitoEnabled(const Extension* extension) {
53 return IncognitoInfo::IsIncognitoAllowed(extension) &&
54 (!extension->is_platform_app() ||
55 extension->location() == Manifest::COMPONENT);
56 }
57
51 } // namespace util 58 } // namespace util
52 } // namespace extensions 59 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/browser/extension_util.h ('k') | extensions/common/extension.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698