| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/common/extensions/extension.h" | 5 #include "chrome/common/extensions/extension.h" |
| 6 | 6 |
| 7 #include <ostream> | 7 #include <ostream> |
| 8 | 8 |
| 9 #include "base/base64.h" | 9 #include "base/base64.h" |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 1909 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1920 bool Extension::LoadSharedFeatures( | 1920 bool Extension::LoadSharedFeatures( |
| 1921 const APIPermissionSet& api_permissions, | 1921 const APIPermissionSet& api_permissions, |
| 1922 string16* error) { | 1922 string16* error) { |
| 1923 if (!LoadDescription(error) || | 1923 if (!LoadDescription(error) || |
| 1924 !LoadIcons(error) || | 1924 !LoadIcons(error) || |
| 1925 !ManifestHandler::ParseExtension(this, error) || | 1925 !ManifestHandler::ParseExtension(this, error) || |
| 1926 !LoadPlugins(error) || | 1926 !LoadPlugins(error) || |
| 1927 !LoadNaClModules(error) || | 1927 !LoadNaClModules(error) || |
| 1928 !LoadSandboxedPages(error) || | 1928 !LoadSandboxedPages(error) || |
| 1929 !LoadRequirements(error) || | 1929 !LoadRequirements(error) || |
| 1930 !LoadDefaultLocale(error) || | |
| 1931 !LoadOfflineEnabled(error) || | 1930 !LoadOfflineEnabled(error) || |
| 1932 // LoadBackgroundScripts() must be called before LoadBackgroundPage(). | 1931 // LoadBackgroundScripts() must be called before LoadBackgroundPage(). |
| 1933 !LoadBackgroundScripts(error) || | 1932 !LoadBackgroundScripts(error) || |
| 1934 !LoadBackgroundPage(api_permissions, error) || | 1933 !LoadBackgroundPage(api_permissions, error) || |
| 1935 !LoadBackgroundPersistent(api_permissions, error) || | 1934 !LoadBackgroundPersistent(api_permissions, error) || |
| 1936 !LoadBackgroundAllowJSAccess(api_permissions, error) || | 1935 !LoadBackgroundAllowJSAccess(api_permissions, error) || |
| 1937 !LoadOAuth2Info(error)) | 1936 !LoadOAuth2Info(error)) |
| 1938 return false; | 1937 return false; |
| 1939 | 1938 |
| 1940 return true; | 1939 return true; |
| (...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2205 } | 2204 } |
| 2206 } | 2205 } |
| 2207 } else { | 2206 } else { |
| 2208 *error = ASCIIToUTF16(errors::kInvalidRequirements); | 2207 *error = ASCIIToUTF16(errors::kInvalidRequirements); |
| 2209 return false; | 2208 return false; |
| 2210 } | 2209 } |
| 2211 } | 2210 } |
| 2212 return true; | 2211 return true; |
| 2213 } | 2212 } |
| 2214 | 2213 |
| 2215 bool Extension::LoadDefaultLocale(string16* error) { | |
| 2216 if (!manifest_->HasKey(keys::kDefaultLocale)) | |
| 2217 return true; | |
| 2218 if (!manifest_->GetString(keys::kDefaultLocale, &default_locale_) || | |
| 2219 !l10n_util::IsValidLocaleSyntax(default_locale_)) { | |
| 2220 *error = ASCIIToUTF16(errors::kInvalidDefaultLocale); | |
| 2221 return false; | |
| 2222 } | |
| 2223 return true; | |
| 2224 } | |
| 2225 | |
| 2226 bool Extension::LoadOfflineEnabled(string16* error) { | 2214 bool Extension::LoadOfflineEnabled(string16* error) { |
| 2227 // Defaults to false, except for platform apps which are offline by default. | 2215 // Defaults to false, except for platform apps which are offline by default. |
| 2228 if (!manifest_->HasKey(keys::kOfflineEnabled)) { | 2216 if (!manifest_->HasKey(keys::kOfflineEnabled)) { |
| 2229 offline_enabled_ = is_platform_app(); | 2217 offline_enabled_ = is_platform_app(); |
| 2230 return true; | 2218 return true; |
| 2231 } | 2219 } |
| 2232 if (!manifest_->GetBoolean(keys::kOfflineEnabled, &offline_enabled_)) { | 2220 if (!manifest_->GetBoolean(keys::kOfflineEnabled, &offline_enabled_)) { |
| 2233 *error = ASCIIToUTF16(errors::kInvalidOfflineEnabled); | 2221 *error = ASCIIToUTF16(errors::kInvalidOfflineEnabled); |
| 2234 return false; | 2222 return false; |
| 2235 } | 2223 } |
| (...skipping 892 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3128 | 3116 |
| 3129 UpdatedExtensionPermissionsInfo::UpdatedExtensionPermissionsInfo( | 3117 UpdatedExtensionPermissionsInfo::UpdatedExtensionPermissionsInfo( |
| 3130 const Extension* extension, | 3118 const Extension* extension, |
| 3131 const PermissionSet* permissions, | 3119 const PermissionSet* permissions, |
| 3132 Reason reason) | 3120 Reason reason) |
| 3133 : reason(reason), | 3121 : reason(reason), |
| 3134 extension(extension), | 3122 extension(extension), |
| 3135 permissions(permissions) {} | 3123 permissions(permissions) {} |
| 3136 | 3124 |
| 3137 } // namespace extensions | 3125 } // namespace extensions |
| OLD | NEW |