1868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)// Copyright 2013 The Chromium Authors. All rights reserved. 2868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be 3868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)// found in the LICENSE file. 4868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) 5868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)#include "chrome/browser/ui/webui/extensions/extension_basic_info.h" 6868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) 7868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)#include "base/values.h" 8868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)#include "chrome/common/extensions/extension.h" 9868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)#include "chrome/common/extensions/manifest_handlers/kiosk_enabled_info.h" 10868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)#include "chrome/common/extensions/manifest_handlers/offline_enabled_info.h" 11868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)#include "chrome/common/extensions/manifest_url_handler.h" 12868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) 13868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)namespace { 14868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) 15868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)// Keys in the dictionary returned by GetExtensionBasicInfo(). 16868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)const char kDescriptionKey[] = "description"; 17868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)const char kEnabledKey[] = "enabled"; 18868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)const char kHomepageUrlKey[] = "homepageUrl"; 19868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)const char kIdKey[] = "id"; 20868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)const char kNameKey[] = "name"; 21868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)const char kKioskEnabledKey[] = "kioskEnabled"; 22868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)const char kOfflineEnabledKey[] = "offlineEnabled"; 23868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)const char kOptionsUrlKey[] = "optionsUrl"; 24868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)const char kDetailsUrlKey[] = "detailsUrl"; 25868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)const char kVersionKey[] = "version"; 26868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)const char kPackagedAppKey[] = "packagedApp"; 27868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) 28868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)} // namespace 29868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) 30868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)namespace extensions { 31868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) 32868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)void GetExtensionBasicInfo(const Extension* extension, 33868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) bool enabled, 34868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) base::DictionaryValue* info) { 35868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) info->SetString(kIdKey, extension->id()); 36868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) info->SetString(kNameKey, extension->name()); 37868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) info->SetBoolean(kEnabledKey, enabled); 38868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) info->SetBoolean(kKioskEnabledKey, 39868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) KioskEnabledInfo::IsKioskEnabled(extension)); 40868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) info->SetBoolean(kOfflineEnabledKey, 41868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) OfflineEnabledInfo::IsOfflineEnabled(extension)); 42868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) info->SetString(kVersionKey, extension->VersionString()); 43868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) info->SetString(kDescriptionKey, extension->description()); 44868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) info->SetString( 45868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) kOptionsUrlKey, 46868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) ManifestURL::GetOptionsPage(extension).possibly_invalid_spec()); 47868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) info->SetString( 48868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) kHomepageUrlKey, 49868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) ManifestURL::GetHomepageURL(extension).possibly_invalid_spec()); 50868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) info->SetString( 51868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) kDetailsUrlKey, 52868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) ManifestURL::GetDetailsURL(extension).possibly_invalid_spec()); 53868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) info->SetBoolean(kPackagedAppKey, extension->is_platform_app()); 54868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)} 55868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) 56868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)} // namespace extensions 57