Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(449)

Side by Side Diff: chrome/browser/ui/webui/extensions/extension_info_ui.cc

Issue 709813004: Remove the deprecated function ExtensionService::extensions(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed thestig@'s comments. Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
11 #include "chrome/browser/extensions/extension_service.h"
12 #include "chrome/browser/profiles/profile.h" 11 #include "chrome/browser/profiles/profile.h"
13 #include "chrome/browser/ui/webui/extensions/extension_basic_info.h" 12 #include "chrome/browser/ui/webui/extensions/extension_basic_info.h"
14 #include "chrome/browser/ui/webui/extensions/extension_icon_source.h" 13 #include "chrome/browser/ui/webui/extensions/extension_icon_source.h"
15 #include "chrome/common/extensions/extension_constants.h" 14 #include "chrome/common/extensions/extension_constants.h"
16 #include "chrome/common/url_constants.h" 15 #include "chrome/common/url_constants.h"
17 #include "chrome/grit/generated_resources.h" 16 #include "chrome/grit/generated_resources.h"
18 #include "content/public/browser/web_ui.h" 17 #include "content/public/browser/web_ui.h"
19 #include "content/public/browser/web_ui_data_source.h" 18 #include "content/public/browser/web_ui_data_source.h"
20 #include "extensions/browser/extension_prefs.h" 19 #include "extensions/browser/extension_prefs.h"
21 #include "extensions/browser/extension_system.h" 20 #include "extensions/browser/extension_registry.h"
22 #include "extensions/common/extension.h" 21 #include "extensions/common/extension.h"
23 #include "extensions/common/extension_icon_set.h" 22 #include "extensions/common/extension_icon_set.h"
24 #include "grit/browser_resources.h" 23 #include "grit/browser_resources.h"
25 24
26 namespace extensions { 25 namespace extensions {
27 26
28 ExtensionInfoUI::ExtensionInfoUI(content::WebUI* web_ui, const GURL& url) 27 ExtensionInfoUI::ExtensionInfoUI(content::WebUI* web_ui, const GURL& url)
29 : content::WebUIController(web_ui), 28 : content::WebUIController(web_ui),
30 source_(content::WebUIDataSource::Create( 29 source_(content::WebUIDataSource::Create(
31 chrome::kChromeUIExtensionInfoHost)) { 30 chrome::kChromeUIExtensionInfoHost)) {
(...skipping 18 matching lines...) Expand all
50 49
51 // static 50 // static
52 GURL ExtensionInfoUI::GetURL(const std::string& extension_id) { 51 GURL ExtensionInfoUI::GetURL(const std::string& extension_id) {
53 return GURL(base::StringPrintf( 52 return GURL(base::StringPrintf(
54 "%s%s", chrome::kChromeUIExtensionInfoURL, extension_id.c_str())); 53 "%s%s", chrome::kChromeUIExtensionInfoURL, extension_id.c_str()));
55 } 54 }
56 55
57 void ExtensionInfoUI::AddExtensionDataToSource( 56 void ExtensionInfoUI::AddExtensionDataToSource(
58 const std::string& extension_id) { 57 const std::string& extension_id) {
59 Profile* profile = Profile::FromWebUI(web_ui()); 58 Profile* profile = Profile::FromWebUI(web_ui());
60 ExtensionService* extension_service =
61 ExtensionSystem::Get(profile)->extension_service();
62 const Extension* extension = 59 const Extension* extension =
63 extension_service->extensions()->GetByID(extension_id); 60 ExtensionRegistry::Get(profile)->enabled_extensions().GetByID(
61 extension_id);
64 if (!extension) 62 if (!extension)
65 return; 63 return;
66 64
67 base::DictionaryValue extension_data; 65 base::DictionaryValue extension_data;
68 GetExtensionBasicInfo(extension, true, &extension_data); 66 GetExtensionBasicInfo(extension, true, &extension_data);
69 source_->AddLocalizedStrings(extension_data); 67 source_->AddLocalizedStrings(extension_data);
70 68
71 // Set the icon URL. 69 // Set the icon URL.
72 GURL icon = 70 GURL icon =
73 ExtensionIconSource::GetIconURL(extension, 71 ExtensionIconSource::GetIconURL(extension,
74 extension_misc::EXTENSION_ICON_MEDIUM, 72 extension_misc::EXTENSION_ICON_MEDIUM,
75 ExtensionIconSet::MATCH_BIGGER, 73 ExtensionIconSet::MATCH_BIGGER,
76 false, NULL); 74 false, NULL);
77 source_->AddString("icon", base::UTF8ToUTF16(icon.spec())); 75 source_->AddString("icon", base::UTF8ToUTF16(icon.spec()));
78 // Set the last update time (the install time). 76 // Set the last update time (the install time).
79 base::Time install_time = 77 base::Time install_time =
80 ExtensionPrefs::Get(profile)->GetInstallTime(extension_id); 78 ExtensionPrefs::Get(profile)->GetInstallTime(extension_id);
81 source_->AddString("installTime", base::TimeFormatShortDate(install_time)); 79 source_->AddString("installTime", base::TimeFormatShortDate(install_time));
82 } 80 }
83 81
84 } // namespace extensions 82 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698