Index: chrome/browser/ui/webui/extensions/extension_basic_info.cc |
diff --git a/chrome/browser/ui/webui/extensions/extension_basic_info.cc b/chrome/browser/ui/webui/extensions/extension_basic_info.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..c264bbf6d58e32b5689ad2c4b9ac82f37ae27669 |
--- /dev/null |
+++ b/chrome/browser/ui/webui/extensions/extension_basic_info.cc |
@@ -0,0 +1,56 @@ |
+// Copyright 2013 The Chromium Authors. All rights reserved. |
+// Use of extension source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "chrome/browser/ui/webui/extensions/extension_basic_info.h" |
+ |
+#include "base/values.h" |
+#include "chrome/common/extensions/extension.h" |
+#include "chrome/common/extensions/manifest_handlers/kiosk_enabled_info.h" |
+#include "chrome/common/extensions/manifest_handlers/offline_enabled_info.h" |
+#include "chrome/common/extensions/manifest_url_handler.h" |
+ |
+namespace { |
+ |
+// Keys in the dictionary returned by GetExtensionBasicInfo(). |
Matt Perry
2013/06/03 21:06:42
It's worth noting that these can't change and must
Yoyo Zhou
2013/06/03 21:23:47
There was a comment to this effect but I couldn't
Matt Perry
2013/06/03 21:29:12
Oh right, that comment probably predates the JSON
|
+const char kDescriptionKey[] = "description"; |
+const char kEnabledKey[] = "enabled"; |
+const char kHomepageUrlKey[] = "homepageUrl"; |
+const char kIdKey[] = "id"; |
+const char kNameKey[] = "name"; |
+const char kKioskEnabledKey[] = "kioskEnabled"; |
+const char kOfflineEnabledKey[] = "offlineEnabled"; |
+const char kOptionsUrlKey[] = "optionsUrl"; |
+const char kDetailsUrlKey[] = "detailsUrl"; |
+const char kVersionKey[] = "version"; |
+const char kPackagedAppKey[] = "packagedApp"; |
+ |
+} // namespace |
+ |
+namespace extensions { |
+ |
+void GetExtensionBasicInfo(const Extension* extension, |
+ bool enabled, |
+ base::DictionaryValue* info) { |
+ info->SetString(kIdKey, extension->id()); |
+ info->SetString(kNameKey, extension->name()); |
+ info->SetBoolean(kEnabledKey, enabled); |
+ info->SetBoolean(kKioskEnabledKey, |
+ KioskEnabledInfo::IsKioskEnabled(extension)); |
+ info->SetBoolean(kOfflineEnabledKey, |
+ OfflineEnabledInfo::IsOfflineEnabled(extension)); |
+ info->SetString(kVersionKey, extension->VersionString()); |
+ info->SetString(kDescriptionKey, extension->description()); |
+ info->SetString( |
+ kOptionsUrlKey, |
+ ManifestURL::GetOptionsPage(extension).possibly_invalid_spec()); |
+ info->SetString( |
+ kHomepageUrlKey, |
+ ManifestURL::GetHomepageURL(extension).possibly_invalid_spec()); |
+ info->SetString( |
+ kDetailsUrlKey, |
+ ManifestURL::GetDetailsURL(extension).possibly_invalid_spec()); |
+ info->SetBoolean(kPackagedAppKey, extension->is_platform_app()); |
+} |
+ |
+} // namespace extensions |