OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/extensions_service.h" | 5 #include "chrome/browser/extensions/extensions_service.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 1318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1329 // Broadcast unloaded and loaded events to update browser state. Only bother | 1329 // Broadcast unloaded and loaded events to update browser state. Only bother |
1330 // if the extension is actually enabled, since there is no UI otherwise. | 1330 // if the extension is actually enabled, since there is no UI otherwise. |
1331 bool is_enabled = std::find(extensions_.begin(), extensions_.end(), | 1331 bool is_enabled = std::find(extensions_.begin(), extensions_.end(), |
1332 extension) != extensions_.end(); | 1332 extension) != extensions_.end(); |
1333 if (is_enabled) { | 1333 if (is_enabled) { |
1334 NotifyExtensionUnloaded(extension); | 1334 NotifyExtensionUnloaded(extension); |
1335 NotifyExtensionLoaded(extension); | 1335 NotifyExtensionLoaded(extension); |
1336 } | 1336 } |
1337 } | 1337 } |
1338 | 1338 |
| 1339 bool ExtensionsService::CanCrossIncognito(const Extension* extension) { |
| 1340 // We allow the extension to see events and data from another profile iff it |
| 1341 // uses "spanning" behavior and it has incognito access. "split" mode |
| 1342 // extensions only see events for a matching profile. |
| 1343 return IsIncognitoEnabled(extension) && !extension->incognito_split_mode(); |
| 1344 } |
| 1345 |
1339 bool ExtensionsService::AllowFileAccess(const Extension* extension) { | 1346 bool ExtensionsService::AllowFileAccess(const Extension* extension) { |
1340 return (CommandLine::ForCurrentProcess()->HasSwitch( | 1347 return (CommandLine::ForCurrentProcess()->HasSwitch( |
1341 switches::kDisableExtensionsFileAccessCheck) || | 1348 switches::kDisableExtensionsFileAccessCheck) || |
1342 extension_prefs_->AllowFileAccess(extension->id())); | 1349 extension_prefs_->AllowFileAccess(extension->id())); |
1343 } | 1350 } |
1344 | 1351 |
1345 void ExtensionsService::SetAllowFileAccess(const Extension* extension, | 1352 void ExtensionsService::SetAllowFileAccess(const Extension* extension, |
1346 bool allow) { | 1353 bool allow) { |
1347 extension_prefs_->SetAllowFileAccess(extension->id(), allow); | 1354 extension_prefs_->SetAllowFileAccess(extension->id(), allow); |
1348 NotificationService::current()->Notify( | 1355 NotificationService::current()->Notify( |
(...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1890 ExtensionIdSet ExtensionsService::GetAppIds() const { | 1897 ExtensionIdSet ExtensionsService::GetAppIds() const { |
1891 ExtensionIdSet result; | 1898 ExtensionIdSet result; |
1892 for (ExtensionList::const_iterator it = extensions_.begin(); | 1899 for (ExtensionList::const_iterator it = extensions_.begin(); |
1893 it != extensions_.end(); ++it) { | 1900 it != extensions_.end(); ++it) { |
1894 if ((*it)->is_app() && (*it)->location() != Extension::COMPONENT) | 1901 if ((*it)->is_app() && (*it)->location() != Extension::COMPONENT) |
1895 result.insert((*it)->id()); | 1902 result.insert((*it)->id()); |
1896 } | 1903 } |
1897 | 1904 |
1898 return result; | 1905 return result; |
1899 } | 1906 } |
OLD | NEW |