OLD | NEW |
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/browser/extensions/extension_service.h" | 5 #include "chrome/browser/extensions/extension_service.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 1449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1460 } | 1460 } |
1461 | 1461 |
1462 bool ExtensionService::CanCrossIncognito(const Extension* extension) { | 1462 bool ExtensionService::CanCrossIncognito(const Extension* extension) { |
1463 // We allow the extension to see events and data from another profile iff it | 1463 // We allow the extension to see events and data from another profile iff it |
1464 // uses "spanning" behavior and it has incognito access. "split" mode | 1464 // uses "spanning" behavior and it has incognito access. "split" mode |
1465 // extensions only see events for a matching profile. | 1465 // extensions only see events for a matching profile. |
1466 return IsIncognitoEnabled(extension->id()) && | 1466 return IsIncognitoEnabled(extension->id()) && |
1467 !extension->incognito_split_mode(); | 1467 !extension->incognito_split_mode(); |
1468 } | 1468 } |
1469 | 1469 |
| 1470 bool ExtensionService::CanLoadInIncognito(const Extension* extension) const { |
| 1471 if (extension->is_hosted_app()) |
| 1472 return true; |
| 1473 // Packaged apps and regular extensions need to be enabled specifically for |
| 1474 // incognito (and split mode should be set). |
| 1475 return extension->incognito_split_mode() && |
| 1476 IsIncognitoEnabled(extension->id()); |
| 1477 } |
| 1478 |
1470 bool ExtensionService::AllowFileAccess(const Extension* extension) { | 1479 bool ExtensionService::AllowFileAccess(const Extension* extension) { |
1471 return (CommandLine::ForCurrentProcess()->HasSwitch( | 1480 return (CommandLine::ForCurrentProcess()->HasSwitch( |
1472 switches::kDisableExtensionsFileAccessCheck) || | 1481 switches::kDisableExtensionsFileAccessCheck) || |
1473 extension_prefs_->AllowFileAccess(extension->id())); | 1482 extension_prefs_->AllowFileAccess(extension->id())); |
1474 } | 1483 } |
1475 | 1484 |
1476 void ExtensionService::SetAllowFileAccess(const Extension* extension, | 1485 void ExtensionService::SetAllowFileAccess(const Extension* extension, |
1477 bool allow) { | 1486 bool allow) { |
1478 // Reload to update browser state. Only bother if the value changed and the | 1487 // Reload to update browser state. Only bother if the value changed and the |
1479 // extension is actually enabled, since there is no UI otherwise. | 1488 // extension is actually enabled, since there is no UI otherwise. |
(...skipping 739 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2219 | 2228 |
2220 ExtensionService::NaClModuleInfoList::iterator | 2229 ExtensionService::NaClModuleInfoList::iterator |
2221 ExtensionService::FindNaClModule(const GURL& url) { | 2230 ExtensionService::FindNaClModule(const GURL& url) { |
2222 for (NaClModuleInfoList::iterator iter = nacl_module_list_.begin(); | 2231 for (NaClModuleInfoList::iterator iter = nacl_module_list_.begin(); |
2223 iter != nacl_module_list_.end(); ++iter) { | 2232 iter != nacl_module_list_.end(); ++iter) { |
2224 if (iter->url == url) | 2233 if (iter->url == url) |
2225 return iter; | 2234 return iter; |
2226 } | 2235 } |
2227 return nacl_module_list_.end(); | 2236 return nacl_module_list_.end(); |
2228 } | 2237 } |
OLD | NEW |