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 "extensions/common/manifest_handlers/background_info.h" | 5 #include "extensions/common/manifest_handlers/background_info.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 | 10 |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 } | 119 } |
120 | 120 |
121 bool BackgroundInfo::LoadBackgroundScripts(const Extension* extension, | 121 bool BackgroundInfo::LoadBackgroundScripts(const Extension* extension, |
122 const std::string& key, | 122 const std::string& key, |
123 base::string16* error) { | 123 base::string16* error) { |
124 const base::Value* background_scripts_value = NULL; | 124 const base::Value* background_scripts_value = NULL; |
125 if (!extension->manifest()->Get(key, &background_scripts_value)) | 125 if (!extension->manifest()->Get(key, &background_scripts_value)) |
126 return true; | 126 return true; |
127 | 127 |
128 CHECK(background_scripts_value); | 128 CHECK(background_scripts_value); |
129 if (background_scripts_value->GetType() != base::Value::TYPE_LIST) { | 129 if (background_scripts_value->GetType() != base::Value::Type::LIST) { |
130 *error = ASCIIToUTF16(errors::kInvalidBackgroundScripts); | 130 *error = ASCIIToUTF16(errors::kInvalidBackgroundScripts); |
131 return false; | 131 return false; |
132 } | 132 } |
133 | 133 |
134 const base::ListValue* background_scripts = NULL; | 134 const base::ListValue* background_scripts = NULL; |
135 background_scripts_value->GetAsList(&background_scripts); | 135 background_scripts_value->GetAsList(&background_scripts); |
136 for (size_t i = 0; i < background_scripts->GetSize(); ++i) { | 136 for (size_t i = 0; i < background_scripts->GetSize(); ++i) { |
137 std::string script; | 137 std::string script; |
138 if (!background_scripts->GetString(i, &script)) { | 138 if (!background_scripts->GetString(i, &script)) { |
139 *error = ErrorUtils::FormatErrorMessageUTF16( | 139 *error = ErrorUtils::FormatErrorMessageUTF16( |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 return true; | 226 return true; |
227 } | 227 } |
228 | 228 |
229 bool BackgroundInfo::LoadAllowJSAccess(const Extension* extension, | 229 bool BackgroundInfo::LoadAllowJSAccess(const Extension* extension, |
230 base::string16* error) { | 230 base::string16* error) { |
231 const base::Value* allow_js_access = NULL; | 231 const base::Value* allow_js_access = NULL; |
232 if (!extension->manifest()->Get(keys::kBackgroundAllowJsAccess, | 232 if (!extension->manifest()->Get(keys::kBackgroundAllowJsAccess, |
233 &allow_js_access)) | 233 &allow_js_access)) |
234 return true; | 234 return true; |
235 | 235 |
236 if (!allow_js_access->IsType(base::Value::TYPE_BOOLEAN) || | 236 if (!allow_js_access->IsType(base::Value::Type::BOOLEAN) || |
237 !allow_js_access->GetAsBoolean(&allow_js_access_)) { | 237 !allow_js_access->GetAsBoolean(&allow_js_access_)) { |
238 *error = ASCIIToUTF16(errors::kInvalidBackgroundAllowJsAccess); | 238 *error = ASCIIToUTF16(errors::kInvalidBackgroundAllowJsAccess); |
239 return false; | 239 return false; |
240 } | 240 } |
241 | 241 |
242 return true; | 242 return true; |
243 } | 243 } |
244 | 244 |
245 BackgroundManifestHandler::BackgroundManifestHandler() { | 245 BackgroundManifestHandler::BackgroundManifestHandler() { |
246 } | 246 } |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
334 const std::vector<std::string> BackgroundManifestHandler::Keys() const { | 334 const std::vector<std::string> BackgroundManifestHandler::Keys() const { |
335 static const char* keys[] = { | 335 static const char* keys[] = { |
336 keys::kBackgroundAllowJsAccess, keys::kBackgroundPage, | 336 keys::kBackgroundAllowJsAccess, keys::kBackgroundPage, |
337 keys::kBackgroundPageLegacy, keys::kBackgroundPersistent, | 337 keys::kBackgroundPageLegacy, keys::kBackgroundPersistent, |
338 keys::kBackgroundScripts, keys::kPlatformAppBackgroundPage, | 338 keys::kBackgroundScripts, keys::kPlatformAppBackgroundPage, |
339 keys::kPlatformAppBackgroundScripts}; | 339 keys::kPlatformAppBackgroundScripts}; |
340 return std::vector<std::string>(keys, keys + arraysize(keys)); | 340 return std::vector<std::string>(keys, keys + arraysize(keys)); |
341 } | 341 } |
342 | 342 |
343 } // namespace extensions | 343 } // namespace extensions |
OLD | NEW |