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

Unified Diff: chrome/browser/ui/webui/extensions/extensions_ui.cc

Issue 1319163004: [Extensions Page MD] Stub out a materialized extensions page (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Nits Created 5 years, 3 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc ('k') | chrome/common/chrome_switches.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/webui/extensions/extensions_ui.cc
diff --git a/chrome/browser/ui/webui/extensions/extensions_ui.cc b/chrome/browser/ui/webui/extensions/extensions_ui.cc
index 1c6acb27964615184b4add6138a5dcea86ed82be..bd109b0d3c9ea6768a1ed60da5bb4592b15104fe 100644
--- a/chrome/browser/ui/webui/extensions/extensions_ui.cc
+++ b/chrome/browser/ui/webui/extensions/extensions_ui.cc
@@ -9,7 +9,9 @@
#include "chrome/browser/ui/webui/extensions/extension_settings_handler.h"
#include "chrome/browser/ui/webui/extensions/install_extension_handler.h"
#include "chrome/browser/ui/webui/metrics_handler.h"
+#include "chrome/common/chrome_switches.h"
#include "chrome/common/url_constants.h"
+#include "chrome/grit/generated_resources.h"
#include "content/public/browser/web_ui.h"
#include "content/public/browser/web_ui_data_source.h"
#include "grit/browser_resources.h"
@@ -25,6 +27,21 @@ namespace extensions {
namespace {
+content::WebUIDataSource* CreateMdExtensionsSource() {
+ content::WebUIDataSource* source =
+ content::WebUIDataSource::Create(chrome::kChromeUIExtensionsHost);
+
+ source->SetJsonPath("strings.js");
+ source->AddLocalizedString("title",
+ IDS_MANAGE_EXTENSIONS_SETTING_WINDOWS_TITLE);
+ source->AddResourcePath("manager.html", IDR_MD_EXTENSIONS_MANAGER_HTML);
+ source->AddResourcePath("manager.js", IDR_MD_EXTENSIONS_MANAGER_JS);
+ source->AddResourcePath("strings.html", IDR_MD_EXTENSIONS_STRINGS_HTML);
+ source->SetDefaultResource(IDR_MD_EXTENSIONS_EXTENSIONS_HTML);
+
+ return source;
+}
+
content::WebUIDataSource* CreateExtensionsHTMLSource() {
content::WebUIDataSource* source =
content::WebUIDataSource::Create(chrome::kChromeUIExtensionsFrameHost);
@@ -43,36 +60,42 @@ content::WebUIDataSource* CreateExtensionsHTMLSource() {
ExtensionsUI::ExtensionsUI(content::WebUI* web_ui) : WebUIController(web_ui) {
Profile* profile = Profile::FromWebUI(web_ui);
- content::WebUIDataSource* source = CreateExtensionsHTMLSource();
+ content::WebUIDataSource* source = nullptr;
+
+ if (::switches::MdExtensionsEnabled()) {
+ source = CreateMdExtensionsSource();
+ } else {
+ source = CreateExtensionsHTMLSource();
- ExtensionSettingsHandler* handler = new ExtensionSettingsHandler();
- handler->GetLocalizedValues(source);
- web_ui->AddMessageHandler(handler);
+ ExtensionSettingsHandler* handler = new ExtensionSettingsHandler();
+ handler->GetLocalizedValues(source);
+ web_ui->AddMessageHandler(handler);
- ExtensionLoaderHandler* extension_loader_handler =
- new ExtensionLoaderHandler(profile);
- extension_loader_handler->GetLocalizedValues(source);
- web_ui->AddMessageHandler(extension_loader_handler);
+ ExtensionLoaderHandler* extension_loader_handler =
+ new ExtensionLoaderHandler(profile);
+ extension_loader_handler->GetLocalizedValues(source);
+ web_ui->AddMessageHandler(extension_loader_handler);
- InstallExtensionHandler* install_extension_handler =
- new InstallExtensionHandler();
- install_extension_handler->GetLocalizedValues(source);
- web_ui->AddMessageHandler(install_extension_handler);
+ InstallExtensionHandler* install_extension_handler =
+ new InstallExtensionHandler();
+ install_extension_handler->GetLocalizedValues(source);
+ web_ui->AddMessageHandler(install_extension_handler);
#if defined(OS_CHROMEOS)
- chromeos::KioskAppsHandler* kiosk_app_handler =
- new chromeos::KioskAppsHandler(
- chromeos::OwnerSettingsServiceChromeOSFactory::GetForBrowserContext(
- profile));
- kiosk_app_handler->GetLocalizedValues(source);
- web_ui->AddMessageHandler(kiosk_app_handler);
+ chromeos::KioskAppsHandler* kiosk_app_handler =
+ new chromeos::KioskAppsHandler(
+ chromeos::OwnerSettingsServiceChromeOSFactory::GetForBrowserContext(
+ profile));
+ kiosk_app_handler->GetLocalizedValues(source);
+ web_ui->AddMessageHandler(kiosk_app_handler);
#endif
- web_ui->AddMessageHandler(new MetricsHandler());
+ web_ui->AddMessageHandler(new MetricsHandler());
- // Need to allow <object> elements so that the <extensionoptions> browser
- // plugin can be loaded within chrome://extensions.
- source->OverrideContentSecurityPolicyObjectSrc("object-src 'self';");
+ // Need to allow <object> elements so that the <extensionoptions> browser
+ // plugin can be loaded within chrome://extensions.
+ source->OverrideContentSecurityPolicyObjectSrc("object-src 'self';");
+ }
content::WebUIDataSource::Add(profile, source);
}
« no previous file with comments | « chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc ('k') | chrome/common/chrome_switches.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698