Don't show supervised user as "already on this device" while they're being imported.
[chromium-blink-merge.git] / chrome / browser / ui / webui / extensions / extension_basic_info.cc
blob3a0c247cd65780073f273e404b86678a3aaf43c5
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 "extensions/common/extension.h"
9 #include "extensions/common/manifest_handlers/kiosk_mode_info.h"
10 #include "extensions/common/manifest_handlers/offline_enabled_info.h"
11 #include "extensions/common/manifest_handlers/options_page_info.h"
12 #include "extensions/common/manifest_url_handlers.h"
14 namespace {
16 // Keys in the dictionary returned by GetExtensionBasicInfo().
17 const char kDescriptionKey[] = "description";
18 const char kEnabledKey[] = "enabled";
19 const char kHomepageUrlKey[] = "homepageUrl";
20 const char kIdKey[] = "id";
21 const char kNameKey[] = "name";
22 const char kKioskEnabledKey[] = "kioskEnabled";
23 const char kKioskOnlyKey[] = "kioskOnly";
24 const char kOfflineEnabledKey[] = "offlineEnabled";
25 const char kOptionsUrlKey[] = "optionsUrl";
26 const char kDetailsUrlKey[] = "detailsUrl";
27 const char kVersionKey[] = "version";
28 const char kPackagedAppKey[] = "packagedApp";
30 } // namespace
32 namespace extensions {
34 void GetExtensionBasicInfo(const Extension* extension,
35 bool enabled,
36 base::DictionaryValue* info) {
37 info->SetString(kIdKey, extension->id());
38 info->SetString(kNameKey, extension->name());
39 info->SetBoolean(kEnabledKey, enabled);
40 info->SetBoolean(kKioskEnabledKey,
41 KioskModeInfo::IsKioskEnabled(extension));
42 info->SetBoolean(kKioskOnlyKey,
43 KioskModeInfo::IsKioskOnly(extension));
44 info->SetBoolean(kOfflineEnabledKey,
45 OfflineEnabledInfo::IsOfflineEnabled(extension));
46 info->SetString(kVersionKey, extension->GetVersionForDisplay());
47 info->SetString(kDescriptionKey, extension->description());
48 info->SetString(
49 kOptionsUrlKey,
50 OptionsPageInfo::GetOptionsPage(extension).possibly_invalid_spec());
51 info->SetString(
52 kHomepageUrlKey,
53 ManifestURL::GetHomepageURL(extension).possibly_invalid_spec());
54 info->SetString(
55 kDetailsUrlKey,
56 ManifestURL::GetDetailsURL(extension).possibly_invalid_spec());
57 info->SetBoolean(kPackagedAppKey, extension->is_platform_app());
60 } // namespace extensions