| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/browser/ui/webui/extensions/extension_info_ui.h" | 5 #include "chrome/browser/ui/webui/extensions/extension_info_ui.h" |
| 6 | 6 |
| 7 #include "base/i18n/time_formatting.h" | 7 #include "base/i18n/time_formatting.h" |
| 8 #include "base/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 } | 50 } |
| 51 | 51 |
| 52 // static | 52 // static |
| 53 GURL ExtensionInfoUI::GetURL(const std::string& extension_id) { | 53 GURL ExtensionInfoUI::GetURL(const std::string& extension_id) { |
| 54 return GURL(base::StringPrintf( | 54 return GURL(base::StringPrintf( |
| 55 "%s%s", chrome::kChromeUIExtensionInfoURL, extension_id.c_str())); | 55 "%s%s", chrome::kChromeUIExtensionInfoURL, extension_id.c_str())); |
| 56 } | 56 } |
| 57 | 57 |
| 58 void ExtensionInfoUI::AddExtensionDataToSource( | 58 void ExtensionInfoUI::AddExtensionDataToSource( |
| 59 const std::string& extension_id) { | 59 const std::string& extension_id) { |
| 60 ExtensionService* extension_service = ExtensionSystem::Get( | 60 Profile* profile = Profile::FromWebUI(web_ui()); |
| 61 Profile::FromWebUI(web_ui()))->extension_service(); | 61 ExtensionService* extension_service = |
| 62 ExtensionSystem::Get(profile)->extension_service(); |
| 62 const Extension* extension = | 63 const Extension* extension = |
| 63 extension_service->extensions()->GetByID(extension_id); | 64 extension_service->extensions()->GetByID(extension_id); |
| 64 if (!extension) | 65 if (!extension) |
| 65 return; | 66 return; |
| 66 | 67 |
| 67 base::DictionaryValue extension_data; | 68 base::DictionaryValue extension_data; |
| 68 GetExtensionBasicInfo(extension, true, &extension_data); | 69 GetExtensionBasicInfo(extension, true, &extension_data); |
| 69 source_->AddLocalizedStrings(extension_data); | 70 source_->AddLocalizedStrings(extension_data); |
| 70 | 71 |
| 71 // Set the icon URL. | 72 // Set the icon URL. |
| 72 GURL icon = | 73 GURL icon = |
| 73 ExtensionIconSource::GetIconURL(extension, | 74 ExtensionIconSource::GetIconURL(extension, |
| 74 extension_misc::EXTENSION_ICON_MEDIUM, | 75 extension_misc::EXTENSION_ICON_MEDIUM, |
| 75 ExtensionIconSet::MATCH_BIGGER, | 76 ExtensionIconSet::MATCH_BIGGER, |
| 76 false, NULL); | 77 false, NULL); |
| 77 source_->AddString("icon", base::UTF8ToUTF16(icon.spec())); | 78 source_->AddString("icon", base::UTF8ToUTF16(icon.spec())); |
| 78 // Set the last update time (the install time). | 79 // Set the last update time (the install time). |
| 79 base::Time install_time = extension_service->extension_prefs()-> | 80 base::Time install_time = |
| 80 GetInstallTime(extension_id); | 81 ExtensionPrefs::Get(profile)->GetInstallTime(extension_id); |
| 81 source_->AddString("installTime", base::TimeFormatShortDate(install_time)); | 82 source_->AddString("installTime", base::TimeFormatShortDate(install_time)); |
| 82 } | 83 } |
| 83 | 84 |
| 84 } // namespace extensions | 85 } // namespace extensions |
| OLD | NEW |