OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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.h" | 5 #include "chrome/common/extensions/extension.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/base64.h" | 9 #include "base/base64.h" |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 1368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1379 !LoadPlugins(error) || | 1379 !LoadPlugins(error) || |
1380 !LoadNaClModules(error) || | 1380 !LoadNaClModules(error) || |
1381 !LoadWebAccessibleResources(error) || | 1381 !LoadWebAccessibleResources(error) || |
1382 !CheckRequirements(error) || | 1382 !CheckRequirements(error) || |
1383 !LoadDefaultLocale(error) || | 1383 !LoadDefaultLocale(error) || |
1384 !LoadOfflineEnabled(error) || | 1384 !LoadOfflineEnabled(error) || |
1385 !LoadOptionsPage(error) || | 1385 !LoadOptionsPage(error) || |
1386 // LoadBackgroundScripts() must be called before LoadBackgroundPage(). | 1386 // LoadBackgroundScripts() must be called before LoadBackgroundPage(). |
1387 !LoadBackgroundScripts(error) || | 1387 !LoadBackgroundScripts(error) || |
1388 !LoadBackgroundPage(api_permissions, error) || | 1388 !LoadBackgroundPage(api_permissions, error) || |
1389 !LoadBackgroundPersistent(api_permissions, error) || | 1389 !LoadBackgroundTransient(api_permissions, error) || |
1390 !LoadBackgroundAllowJSAccess(api_permissions, error) || | 1390 !LoadBackgroundAllowJSAccess(api_permissions, error) || |
1391 !LoadWebIntentServices(error)) | 1391 !LoadWebIntentServices(error)) |
1392 return false; | 1392 return false; |
1393 | 1393 |
1394 return true; | 1394 return true; |
1395 } | 1395 } |
1396 | 1396 |
1397 bool Extension::LoadVersion(string16* error) { | 1397 bool Extension::LoadVersion(string16* error) { |
1398 std::string version_str; | 1398 std::string version_str; |
1399 if (!manifest_->GetString(keys::kVersion, &version_str)) { | 1399 if (!manifest_->GetString(keys::kVersion, &version_str)) { |
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1792 return false; | 1792 return false; |
1793 } | 1793 } |
1794 background_url_ = bg_page; | 1794 background_url_ = bg_page; |
1795 } else { | 1795 } else { |
1796 background_url_ = GetResourceURL(background_str); | 1796 background_url_ = GetResourceURL(background_str); |
1797 } | 1797 } |
1798 | 1798 |
1799 return true; | 1799 return true; |
1800 } | 1800 } |
1801 | 1801 |
1802 bool Extension::LoadBackgroundPersistent( | 1802 bool Extension::LoadBackgroundTransient( |
1803 const ExtensionAPIPermissionSet& api_permissions, | 1803 const ExtensionAPIPermissionSet& api_permissions, |
1804 string16* error) { | 1804 string16* error) { |
1805 Value* background_persistent = NULL; | 1805 Value* background_transient = NULL; |
1806 if (!api_permissions.count(ExtensionAPIPermission::kExperimental) || | 1806 if (!api_permissions.count(ExtensionAPIPermission::kExperimental) || |
1807 !manifest_->Get(keys::kBackgroundPersistent, &background_persistent)) | 1807 !manifest_->Get(keys::kBackgroundTransient, &background_transient)) |
1808 return true; | 1808 return true; |
1809 | 1809 |
1810 if (!background_persistent->IsType(Value::TYPE_BOOLEAN) || | 1810 if (!background_transient->IsType(Value::TYPE_BOOLEAN) || |
1811 !background_persistent->GetAsBoolean(&background_page_persists_)) { | 1811 !background_transient->GetAsBoolean(&background_page_is_transient_)) { |
1812 *error = ASCIIToUTF16(errors::kInvalidBackgroundPersistent); | 1812 *error = ASCIIToUTF16(errors::kInvalidBackgroundTransient); |
1813 return false; | 1813 return false; |
1814 } | 1814 } |
1815 | 1815 |
1816 if (!has_background_page()) { | 1816 if (!has_background_page()) { |
1817 *error = ASCIIToUTF16(errors::kInvalidBackgroundPersistentNoPage); | 1817 *error = ASCIIToUTF16(errors::kInvalidBackgroundTransientNoPage); |
1818 return false; | 1818 return false; |
1819 } | 1819 } |
1820 | 1820 |
1821 return true; | 1821 return true; |
1822 } | 1822 } |
1823 | 1823 |
1824 bool Extension::LoadBackgroundAllowJSAccess( | 1824 bool Extension::LoadBackgroundAllowJSAccess( |
1825 const ExtensionAPIPermissionSet& api_permissions, | 1825 const ExtensionAPIPermissionSet& api_permissions, |
1826 string16* error) { | 1826 string16* error) { |
1827 Value* allow_js_access = NULL; | 1827 Value* allow_js_access = NULL; |
(...skipping 897 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2725 // See http://b/4946060 for more details. | 2725 // See http://b/4946060 for more details. |
2726 return id == std::string("nckgahadagoaajjgafhacjanaoiihapd"); | 2726 return id == std::string("nckgahadagoaajjgafhacjanaoiihapd"); |
2727 } | 2727 } |
2728 | 2728 |
2729 Extension::Extension(const FilePath& path, | 2729 Extension::Extension(const FilePath& path, |
2730 scoped_ptr<extensions::Manifest> manifest) | 2730 scoped_ptr<extensions::Manifest> manifest) |
2731 : manifest_version_(0), | 2731 : manifest_version_(0), |
2732 incognito_split_mode_(false), | 2732 incognito_split_mode_(false), |
2733 offline_enabled_(false), | 2733 offline_enabled_(false), |
2734 converted_from_user_script_(false), | 2734 converted_from_user_script_(false), |
2735 background_page_persists_(true), | 2735 background_page_is_transient_(false), |
2736 allow_background_js_access_(true), | 2736 allow_background_js_access_(true), |
2737 manifest_(manifest.release()), | 2737 manifest_(manifest.release()), |
2738 is_storage_isolated_(false), | 2738 is_storage_isolated_(false), |
2739 launch_container_(extension_misc::LAUNCH_TAB), | 2739 launch_container_(extension_misc::LAUNCH_TAB), |
2740 launch_width_(0), | 2740 launch_width_(0), |
2741 launch_height_(0), | 2741 launch_height_(0), |
2742 launch_min_width_(0), | 2742 launch_min_width_(0), |
2743 launch_min_height_(0), | 2743 launch_min_height_(0), |
2744 launch_max_width_(0), | 2744 launch_max_width_(0), |
2745 launch_max_height_(0), | 2745 launch_max_height_(0), |
(...skipping 821 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3567 already_disabled(false), | 3567 already_disabled(false), |
3568 extension(extension) {} | 3568 extension(extension) {} |
3569 | 3569 |
3570 UpdatedExtensionPermissionsInfo::UpdatedExtensionPermissionsInfo( | 3570 UpdatedExtensionPermissionsInfo::UpdatedExtensionPermissionsInfo( |
3571 const Extension* extension, | 3571 const Extension* extension, |
3572 const ExtensionPermissionSet* permissions, | 3572 const ExtensionPermissionSet* permissions, |
3573 Reason reason) | 3573 Reason reason) |
3574 : reason(reason), | 3574 : reason(reason), |
3575 extension(extension), | 3575 extension(extension), |
3576 permissions(permissions) {} | 3576 permissions(permissions) {} |
OLD | NEW |