| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_util.h" | 5 #include "chrome/browser/extensions/extension_util.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/values.h" | 9 #include "base/values.h" |
| 10 #include "chrome/browser/extensions/extension_service.h" | 10 #include "chrome/browser/extensions/extension_service.h" |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 if (extension->is_hosted_app()) | 148 if (extension->is_hosted_app()) |
| 149 return true; | 149 return true; |
| 150 // Packaged apps and regular extensions need to be enabled specifically for | 150 // Packaged apps and regular extensions need to be enabled specifically for |
| 151 // incognito (and split mode should be set). | 151 // incognito (and split mode should be set). |
| 152 return IncognitoInfo::IsSplitMode(extension) && | 152 return IncognitoInfo::IsSplitMode(extension) && |
| 153 IsIncognitoEnabled(extension->id(), context); | 153 IsIncognitoEnabled(extension->id(), context); |
| 154 } | 154 } |
| 155 | 155 |
| 156 bool AllowFileAccess(const std::string& extension_id, | 156 bool AllowFileAccess(const std::string& extension_id, |
| 157 content::BrowserContext* context) { | 157 content::BrowserContext* context) { |
| 158 return CommandLine::ForCurrentProcess()->HasSwitch( | 158 return base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 159 switches::kDisableExtensionsFileAccessCheck) || | 159 switches::kDisableExtensionsFileAccessCheck) || |
| 160 ExtensionPrefs::Get(context)->AllowFileAccess(extension_id); | 160 ExtensionPrefs::Get(context)->AllowFileAccess(extension_id); |
| 161 } | 161 } |
| 162 | 162 |
| 163 void SetAllowFileAccess(const std::string& extension_id, | 163 void SetAllowFileAccess(const std::string& extension_id, |
| 164 content::BrowserContext* context, | 164 content::BrowserContext* context, |
| 165 bool allow) { | 165 bool allow) { |
| 166 // Reload to update browser state. Only bother if the value changed and the | 166 // Reload to update browser state. Only bother if the value changed and the |
| 167 // extension is actually enabled, since there is no UI otherwise. | 167 // extension is actually enabled, since there is no UI otherwise. |
| 168 if (allow == AllowFileAccess(extension_id, context)) | 168 if (allow == AllowFileAccess(extension_id, context)) |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 343 return *ResourceBundle::GetSharedInstance().GetImageSkiaNamed( | 343 return *ResourceBundle::GetSharedInstance().GetImageSkiaNamed( |
| 344 IDR_APP_DEFAULT_ICON); | 344 IDR_APP_DEFAULT_ICON); |
| 345 } | 345 } |
| 346 | 346 |
| 347 const gfx::ImageSkia& GetDefaultExtensionIcon() { | 347 const gfx::ImageSkia& GetDefaultExtensionIcon() { |
| 348 return *ResourceBundle::GetSharedInstance().GetImageSkiaNamed( | 348 return *ResourceBundle::GetSharedInstance().GetImageSkiaNamed( |
| 349 IDR_EXTENSION_DEFAULT_ICON); | 349 IDR_EXTENSION_DEFAULT_ICON); |
| 350 } | 350 } |
| 351 | 351 |
| 352 bool IsStreamlinedHostedAppsEnabled() { | 352 bool IsStreamlinedHostedAppsEnabled() { |
| 353 return !CommandLine::ForCurrentProcess()->HasSwitch( | 353 return !base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 354 switches::kDisableNewBookmarkApps); | 354 switches::kDisableNewBookmarkApps); |
| 355 } | 355 } |
| 356 | 356 |
| 357 } // namespace util | 357 } // namespace util |
| 358 } // namespace extensions | 358 } // namespace extensions |
| OLD | NEW |