| 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 1904 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1915 bool Extension::LoadSharedFeatures( | 1915 bool Extension::LoadSharedFeatures( |
| 1916 const APIPermissionSet& api_permissions, | 1916 const APIPermissionSet& api_permissions, |
| 1917 string16* error) { | 1917 string16* error) { |
| 1918 if (!LoadDescription(error) || | 1918 if (!LoadDescription(error) || |
| 1919 !LoadIcons(error) || | 1919 !LoadIcons(error) || |
| 1920 !LoadCommands(error) || | 1920 !LoadCommands(error) || |
| 1921 !LoadPlugins(error) || | 1921 !LoadPlugins(error) || |
| 1922 !LoadNaClModules(error) || | 1922 !LoadNaClModules(error) || |
| 1923 !LoadSandboxedPages(error) || | 1923 !LoadSandboxedPages(error) || |
| 1924 !LoadRequirements(error) || | 1924 !LoadRequirements(error) || |
| 1925 !LoadDefaultLocale(error) || | |
| 1926 !LoadOfflineEnabled(error) || | 1925 !LoadOfflineEnabled(error) || |
| 1927 // LoadBackgroundScripts() must be called before LoadBackgroundPage(). | 1926 // LoadBackgroundScripts() must be called before LoadBackgroundPage(). |
| 1928 !LoadBackgroundScripts(error) || | 1927 !LoadBackgroundScripts(error) || |
| 1929 !LoadBackgroundPage(api_permissions, error) || | 1928 !LoadBackgroundPage(api_permissions, error) || |
| 1930 !LoadBackgroundPersistent(api_permissions, error) || | 1929 !LoadBackgroundPersistent(api_permissions, error) || |
| 1931 !LoadBackgroundAllowJSAccess(api_permissions, error) || | 1930 !LoadBackgroundAllowJSAccess(api_permissions, error) || |
| 1932 !LoadOAuth2Info(error)) | 1931 !LoadOAuth2Info(error)) |
| 1933 return false; | 1932 return false; |
| 1934 | 1933 |
| 1935 return true; | 1934 return true; |
| (...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2261 } | 2260 } |
| 2262 } | 2261 } |
| 2263 } else { | 2262 } else { |
| 2264 *error = ASCIIToUTF16(errors::kInvalidRequirements); | 2263 *error = ASCIIToUTF16(errors::kInvalidRequirements); |
| 2265 return false; | 2264 return false; |
| 2266 } | 2265 } |
| 2267 } | 2266 } |
| 2268 return true; | 2267 return true; |
| 2269 } | 2268 } |
| 2270 | 2269 |
| 2271 bool Extension::LoadDefaultLocale(string16* error) { | |
| 2272 if (!manifest_->HasKey(keys::kDefaultLocale)) | |
| 2273 return true; | |
| 2274 if (!manifest_->GetString(keys::kDefaultLocale, &default_locale_) || | |
| 2275 !l10n_util::IsValidLocaleSyntax(default_locale_)) { | |
| 2276 *error = ASCIIToUTF16(errors::kInvalidDefaultLocale); | |
| 2277 return false; | |
| 2278 } | |
| 2279 return true; | |
| 2280 } | |
| 2281 | |
| 2282 bool Extension::LoadOfflineEnabled(string16* error) { | 2270 bool Extension::LoadOfflineEnabled(string16* error) { |
| 2283 // Defaults to false, except for platform apps which are offline by default. | 2271 // Defaults to false, except for platform apps which are offline by default. |
| 2284 if (!manifest_->HasKey(keys::kOfflineEnabled)) { | 2272 if (!manifest_->HasKey(keys::kOfflineEnabled)) { |
| 2285 offline_enabled_ = is_platform_app(); | 2273 offline_enabled_ = is_platform_app(); |
| 2286 return true; | 2274 return true; |
| 2287 } | 2275 } |
| 2288 if (!manifest_->GetBoolean(keys::kOfflineEnabled, &offline_enabled_)) { | 2276 if (!manifest_->GetBoolean(keys::kOfflineEnabled, &offline_enabled_)) { |
| 2289 *error = ASCIIToUTF16(errors::kInvalidOfflineEnabled); | 2277 *error = ASCIIToUTF16(errors::kInvalidOfflineEnabled); |
| 2290 return false; | 2278 return false; |
| 2291 } | 2279 } |
| (...skipping 924 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3216 | 3204 |
| 3217 UpdatedExtensionPermissionsInfo::UpdatedExtensionPermissionsInfo( | 3205 UpdatedExtensionPermissionsInfo::UpdatedExtensionPermissionsInfo( |
| 3218 const Extension* extension, | 3206 const Extension* extension, |
| 3219 const PermissionSet* permissions, | 3207 const PermissionSet* permissions, |
| 3220 Reason reason) | 3208 Reason reason) |
| 3221 : reason(reason), | 3209 : reason(reason), |
| 3222 extension(extension), | 3210 extension(extension), |
| 3223 permissions(permissions) {} | 3211 permissions(permissions) {} |
| 3224 | 3212 |
| 3225 } // namespace extensions | 3213 } // namespace extensions |
| OLD | NEW |