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 "base/base64.h" | 7 #include "base/base64.h" |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 #include "chrome/common/chrome_version_info.h" | 25 #include "chrome/common/chrome_version_info.h" |
26 // TODO(rdevlin.cronin): Remove these once all references have been removed as | 26 // TODO(rdevlin.cronin): Remove these once all references have been removed as |
27 // part of crbug.com/159265. | 27 // part of crbug.com/159265. |
28 #include "chrome/common/extensions/api/extension_action/action_info.h" | 28 #include "chrome/common/extensions/api/extension_action/action_info.h" |
29 #include "chrome/common/extensions/api/plugins/plugins_handler.h" | 29 #include "chrome/common/extensions/api/plugins/plugins_handler.h" |
30 #include "chrome/common/extensions/background_info.h" | 30 #include "chrome/common/extensions/background_info.h" |
31 #include "chrome/common/extensions/extension_manifest_constants.h" | 31 #include "chrome/common/extensions/extension_manifest_constants.h" |
32 #include "chrome/common/extensions/incognito_handler.h" | 32 #include "chrome/common/extensions/incognito_handler.h" |
33 #include "chrome/common/extensions/manifest.h" | 33 #include "chrome/common/extensions/manifest.h" |
34 #include "chrome/common/extensions/manifest_handler.h" | 34 #include "chrome/common/extensions/manifest_handler.h" |
35 #include "chrome/common/extensions/manifest_handlers/kiosk_enabled_info.h" | |
36 #include "chrome/common/extensions/manifest_handlers/offline_enabled_info.h" | |
37 #include "chrome/common/extensions/manifest_url_handler.h" | 35 #include "chrome/common/extensions/manifest_url_handler.h" |
38 #include "chrome/common/extensions/permissions/api_permission_set.h" | 36 #include "chrome/common/extensions/permissions/api_permission_set.h" |
39 #include "chrome/common/extensions/permissions/permission_set.h" | 37 #include "chrome/common/extensions/permissions/permission_set.h" |
40 #include "chrome/common/extensions/permissions/permissions_data.h" | 38 #include "chrome/common/extensions/permissions/permissions_data.h" |
41 #include "chrome/common/extensions/permissions/permissions_info.h" | 39 #include "chrome/common/extensions/permissions/permissions_info.h" |
42 #include "chrome/common/extensions/user_script.h" | 40 #include "chrome/common/extensions/user_script.h" |
43 #include "chrome/common/url_constants.h" | 41 #include "chrome/common/url_constants.h" |
44 #include "extensions/common/constants.h" | 42 #include "extensions/common/constants.h" |
45 #include "extensions/common/error_utils.h" | 43 #include "extensions/common/error_utils.h" |
46 #include "extensions/common/id_util.h" | 44 #include "extensions/common/id_util.h" |
47 #include "extensions/common/url_pattern_set.h" | 45 #include "extensions/common/url_pattern_set.h" |
48 #include "googleurl/src/url_util.h" | 46 #include "googleurl/src/url_util.h" |
49 #include "grit/chromium_strings.h" | 47 #include "grit/chromium_strings.h" |
50 #include "grit/theme_resources.h" | 48 #include "grit/theme_resources.h" |
51 #include "third_party/skia/include/core/SkBitmap.h" | 49 #include "third_party/skia/include/core/SkBitmap.h" |
52 #include "ui/base/l10n/l10n_util.h" | 50 #include "ui/base/l10n/l10n_util.h" |
53 | 51 |
54 #if defined(OS_WIN) | 52 #if defined(OS_WIN) |
55 #include "grit/generated_resources.h" | 53 #include "grit/generated_resources.h" |
56 #endif | 54 #endif |
57 | 55 |
58 namespace keys = extension_manifest_keys; | 56 namespace keys = extension_manifest_keys; |
59 namespace values = extension_manifest_values; | 57 namespace values = extension_manifest_values; |
60 namespace errors = extension_manifest_errors; | 58 namespace errors = extension_manifest_errors; |
61 namespace info_keys = extension_info_keys; | |
62 | 59 |
63 namespace extensions { | 60 namespace extensions { |
64 | 61 |
65 namespace { | 62 namespace { |
66 | 63 |
67 const int kModernManifestVersion = 2; | 64 const int kModernManifestVersion = 2; |
68 const int kPEMOutputColumns = 65; | 65 const int kPEMOutputColumns = 65; |
69 | 66 |
70 // KEY MARKERS | 67 // KEY MARKERS |
71 const char kKeyBeginHeaderMarker[] = "-----BEGIN"; | 68 const char kKeyBeginHeaderMarker[] = "-----BEGIN"; |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 return false; | 223 return false; |
227 | 224 |
228 return true; | 225 return true; |
229 } | 226 } |
230 | 227 |
231 // static | 228 // static |
232 bool Extension::IsExtension(const base::FilePath& file_name) { | 229 bool Extension::IsExtension(const base::FilePath& file_name) { |
233 return file_name.MatchesExtension(chrome::kExtensionFileExtension); | 230 return file_name.MatchesExtension(chrome::kExtensionFileExtension); |
234 } | 231 } |
235 | 232 |
236 void Extension::GetBasicInfo(bool enabled, | |
237 DictionaryValue* info) const { | |
238 info->SetString(info_keys::kIdKey, id()); | |
239 info->SetString(info_keys::kNameKey, name()); | |
240 info->SetBoolean(info_keys::kEnabledKey, enabled); | |
241 info->SetBoolean(info_keys::kKioskEnabledKey, | |
242 KioskEnabledInfo::IsKioskEnabled(this)); | |
243 info->SetBoolean(info_keys::kOfflineEnabledKey, | |
244 OfflineEnabledInfo::IsOfflineEnabled(this)); | |
245 info->SetString(info_keys::kVersionKey, VersionString()); | |
246 info->SetString(info_keys::kDescriptionKey, description()); | |
247 info->SetString(info_keys::kOptionsUrlKey, | |
248 ManifestURL::GetOptionsPage(this).possibly_invalid_spec()); | |
249 info->SetString(info_keys::kHomepageUrlKey, | |
250 ManifestURL::GetHomepageURL(this).possibly_invalid_spec()); | |
251 info->SetString(info_keys::kDetailsUrlKey, | |
252 ManifestURL::GetDetailsURL(this).possibly_invalid_spec()); | |
253 info->SetBoolean(info_keys::kPackagedAppKey, is_platform_app()); | |
254 } | |
255 | |
256 Manifest::Type Extension::GetType() const { | 233 Manifest::Type Extension::GetType() const { |
257 return converted_from_user_script() ? | 234 return converted_from_user_script() ? |
258 Manifest::TYPE_USER_SCRIPT : manifest_->type(); | 235 Manifest::TYPE_USER_SCRIPT : manifest_->type(); |
259 } | 236 } |
260 | 237 |
261 // static | 238 // static |
262 GURL Extension::GetResourceURL(const GURL& extension_url, | 239 GURL Extension::GetResourceURL(const GURL& extension_url, |
263 const std::string& relative_path) { | 240 const std::string& relative_path) { |
264 DCHECK(extension_url.SchemeIs(extensions::kExtensionScheme)); | 241 DCHECK(extension_url.SchemeIs(extensions::kExtensionScheme)); |
265 DCHECK_EQ("/", extension_url.path()); | 242 DCHECK_EQ("/", extension_url.path()); |
(...skipping 938 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1204 | 1181 |
1205 UpdatedExtensionPermissionsInfo::UpdatedExtensionPermissionsInfo( | 1182 UpdatedExtensionPermissionsInfo::UpdatedExtensionPermissionsInfo( |
1206 const Extension* extension, | 1183 const Extension* extension, |
1207 const PermissionSet* permissions, | 1184 const PermissionSet* permissions, |
1208 Reason reason) | 1185 Reason reason) |
1209 : reason(reason), | 1186 : reason(reason), |
1210 extension(extension), | 1187 extension(extension), |
1211 permissions(permissions) {} | 1188 permissions(permissions) {} |
1212 | 1189 |
1213 } // namespace extensions | 1190 } // namespace extensions |
OLD | NEW |