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
3 // found in the LICENSE file.
5 #include "chrome/browser/ui/webui/extensions/extension_basic_info.h"
7 #include "base/values.h"
8 #include "chrome/common/extensions/manifest_url_handler.h"
9 #include "extensions/common/extension.h"
10 #include "extensions/common/manifest_handlers/kiosk_mode_info.h"
11 #include "extensions/common/manifest_handlers/offline_enabled_info.h"
15 // Keys in the dictionary returned by GetExtensionBasicInfo().
16 const char kDescriptionKey
[] = "description";
17 const char kEnabledKey
[] = "enabled";
18 const char kHomepageUrlKey
[] = "homepageUrl";
19 const char kIdKey
[] = "id";
20 const char kNameKey
[] = "name";
21 const char kKioskEnabledKey
[] = "kioskEnabled";
22 const char kKioskOnlyKey
[] = "kioskOnly";
23 const char kOfflineEnabledKey
[] = "offlineEnabled";
24 const char kOptionsUrlKey
[] = "optionsUrl";
25 const char kDetailsUrlKey
[] = "detailsUrl";
26 const char kVersionKey
[] = "version";
27 const char kPackagedAppKey
[] = "packagedApp";
31 namespace extensions
{
33 void GetExtensionBasicInfo(const Extension
* extension
,
35 base::DictionaryValue
* info
) {
36 info
->SetString(kIdKey
, extension
->id());
37 info
->SetString(kNameKey
, extension
->name());
38 info
->SetBoolean(kEnabledKey
, enabled
);
39 info
->SetBoolean(kKioskEnabledKey
,
40 KioskModeInfo::IsKioskEnabled(extension
));
41 info
->SetBoolean(kKioskOnlyKey
,
42 KioskModeInfo::IsKioskOnly(extension
));
43 info
->SetBoolean(kOfflineEnabledKey
,
44 OfflineEnabledInfo::IsOfflineEnabled(extension
));
45 info
->SetString(kVersionKey
, extension
->VersionString());
46 info
->SetString(kDescriptionKey
, extension
->description());
49 ManifestURL::GetOptionsPage(extension
).possibly_invalid_spec());
52 ManifestURL::GetHomepageURL(extension
).possibly_invalid_spec());
55 ManifestURL::GetDetailsURL(extension
).possibly_invalid_spec());
56 info
->SetBoolean(kPackagedAppKey
, extension
->is_platform_app());
59 } // namespace extensions