| 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 } | 1915 } |
| 1916 | 1916 |
| 1917 return true; | 1917 return true; |
| 1918 } | 1918 } |
| 1919 | 1919 |
| 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 !LoadPlugins(error) || | 1926 !LoadPlugins(error) || |
| 1926 !LoadNaClModules(error) || | 1927 !LoadNaClModules(error) || |
| 1927 !LoadSandboxedPages(error) || | 1928 !LoadSandboxedPages(error) || |
| 1928 !LoadRequirements(error) || | 1929 !LoadRequirements(error) || |
| 1929 !LoadDefaultLocale(error) || | 1930 !LoadDefaultLocale(error) || |
| 1930 !LoadOfflineEnabled(error) || | 1931 !LoadOfflineEnabled(error) || |
| 1931 // LoadBackgroundScripts() must be called before LoadBackgroundPage(). | 1932 // LoadBackgroundScripts() must be called before LoadBackgroundPage(). |
| 1932 !LoadBackgroundScripts(error) || | 1933 !LoadBackgroundScripts(error) || |
| 1933 !LoadBackgroundPage(api_permissions, error) || | 1934 !LoadBackgroundPage(api_permissions, error) || |
| 1934 !LoadBackgroundPersistent(api_permissions, error) || | 1935 !LoadBackgroundPersistent(api_permissions, error) || |
| (...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2372 | 2373 |
| 2373 return true; | 2374 return true; |
| 2374 } | 2375 } |
| 2375 | 2376 |
| 2376 bool Extension::LoadExtensionFeatures(APIPermissionSet* api_permissions, | 2377 bool Extension::LoadExtensionFeatures(APIPermissionSet* api_permissions, |
| 2377 string16* error) { | 2378 string16* error) { |
| 2378 if (manifest_->HasKey(keys::kConvertedFromUserScript)) | 2379 if (manifest_->HasKey(keys::kConvertedFromUserScript)) |
| 2379 manifest_->GetBoolean(keys::kConvertedFromUserScript, | 2380 manifest_->GetBoolean(keys::kConvertedFromUserScript, |
| 2380 &converted_from_user_script_); | 2381 &converted_from_user_script_); |
| 2381 | 2382 |
| 2382 if (!LoadManifestHandlerFeatures(error) || | 2383 if (!LoadContentScripts(error) || |
| 2383 !LoadContentScripts(error) || | |
| 2384 !LoadPageAction(error) || | 2384 !LoadPageAction(error) || |
| 2385 !LoadSystemIndicator(api_permissions, error) || | 2385 !LoadSystemIndicator(api_permissions, error) || |
| 2386 !LoadIncognitoMode(error) || | 2386 !LoadIncognitoMode(error) || |
| 2387 !LoadContentSecurityPolicy(error)) | 2387 !LoadContentSecurityPolicy(error)) |
| 2388 return false; | 2388 return false; |
| 2389 | 2389 |
| 2390 return true; | 2390 return true; |
| 2391 } | 2391 } |
| 2392 | 2392 |
| 2393 bool Extension::LoadManifestHandlerFeatures(string16* error) { | |
| 2394 std::vector<std::string> keys = ManifestHandler::GetKeys(); | |
| 2395 for (size_t i = 0; i < keys.size(); ++i) { | |
| 2396 Value* value = NULL; | |
| 2397 if (!manifest_->Get(keys[i], &value)) { | |
| 2398 if (!ManifestHandler::Get(keys[i])->HasNoKey(this, error)) | |
| 2399 return false; | |
| 2400 } else if (!ManifestHandler::Get(keys[i])->Parse(value, this, error)) { | |
| 2401 return false; | |
| 2402 } | |
| 2403 } | |
| 2404 return true; | |
| 2405 } | |
| 2406 | |
| 2407 bool Extension::LoadContentScripts(string16* error) { | 2393 bool Extension::LoadContentScripts(string16* error) { |
| 2408 if (!manifest_->HasKey(keys::kContentScripts)) | 2394 if (!manifest_->HasKey(keys::kContentScripts)) |
| 2409 return true; | 2395 return true; |
| 2410 ListValue* list_value; | 2396 ListValue* list_value; |
| 2411 if (!manifest_->GetList(keys::kContentScripts, &list_value)) { | 2397 if (!manifest_->GetList(keys::kContentScripts, &list_value)) { |
| 2412 *error = ASCIIToUTF16(errors::kInvalidContentScriptsList); | 2398 *error = ASCIIToUTF16(errors::kInvalidContentScriptsList); |
| 2413 return false; | 2399 return false; |
| 2414 } | 2400 } |
| 2415 | 2401 |
| 2416 for (size_t i = 0; i < list_value->GetSize(); ++i) { | 2402 for (size_t i = 0; i < list_value->GetSize(); ++i) { |
| (...skipping 725 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3142 | 3128 |
| 3143 UpdatedExtensionPermissionsInfo::UpdatedExtensionPermissionsInfo( | 3129 UpdatedExtensionPermissionsInfo::UpdatedExtensionPermissionsInfo( |
| 3144 const Extension* extension, | 3130 const Extension* extension, |
| 3145 const PermissionSet* permissions, | 3131 const PermissionSet* permissions, |
| 3146 Reason reason) | 3132 Reason reason) |
| 3147 : reason(reason), | 3133 : reason(reason), |
| 3148 extension(extension), | 3134 extension(extension), |
| 3149 permissions(permissions) {} | 3135 permissions(permissions) {} |
| 3150 | 3136 |
| 3151 } // namespace extensions | 3137 } // namespace extensions |
| OLD | NEW |