Commit 91bc7932 authored by orenb's avatar orenb Committed by Commit bot

Add a basic settings page with a Polymer paper element which loads at...

Add a basic settings page with a Polymer paper element which loads at chrome://md-settings (if the enable-md-settings flag is enabled).

BUG=454961

Review URL: https://codereview.chromium.org/893323002

Cr-Commit-Position: refs/heads/master@{#314685}
parent 8b42577f
......@@ -448,6 +448,7 @@
<include name="IDR_BRAILLE_MANIFEST" file="resources\chromeos\braille_ime\manifest.json" type="BINDATA" />
</if>
<include name="IDR_WHISPERNET_PROXY_MANIFEST" file="resources\whispernet_proxy\manifest.json" type="BINDATA" />
<include name="IDR_MD_SETTINGS_UI_HTML" file="resources\md_settings\md_settings.html" type="BINDATA" />
</includes>
</release>
</grit>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Settings</title>
<link rel="import"
href="chrome://resources/polymer/paper-button/paper-button.html">
</head>
<body>
<header>
<h1>Settings</h1>
</header>
<div class="main">
<paper-button id="manage-button" raised>Manage</paper-button>
</div>
</body>
</html>
......@@ -36,6 +36,7 @@
#include "chrome/browser/ui/webui/interstitials/interstitial_ui.h"
#include "chrome/browser/ui/webui/invalidations_ui.h"
#include "chrome/browser/ui/webui/local_state/local_state_ui.h"
#include "chrome/browser/ui/webui/md_settings_ui.h"
#include "chrome/browser/ui/webui/memory_internals/memory_internals_ui.h"
#include "chrome/browser/ui/webui/net_internals/net_internals_ui.h"
#include "chrome/browser/ui/webui/omnibox/omnibox_ui.h"
......@@ -367,6 +368,10 @@ WebUIFactoryFunction GetWebUIFactoryFunction(WebUI* web_ui,
return &NewWebUI<IdentityInternalsUI>;
if (url.host() == chrome::kChromeUINewTabHost)
return &NewWebUI<NewTabUI>;
if (url.host() == chrome::kChromeUIMdSettingsHost &&
::switches::MdSettingsEnabled()) {
return &NewWebUI<MdSettingsUI>;
}
// Android does not support plugins for now.
if (url.host() == chrome::kChromeUIPluginsHost)
return &NewWebUI<PluginsUI>;
......
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/ui/webui/md_settings_ui.h"
#include <string>
#include "base/values.h"
#include "chrome/common/url_constants.h"
#include "chrome/grit/generated_resources.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_ui.h"
#include "content/public/browser/web_ui_data_source.h"
#include "grit/browser_resources.h"
MdSettingsUI::MdSettingsUI(content::WebUI* web_ui)
: content::WebUIController(web_ui) {
content::WebUIDataSource* html_source =
content::WebUIDataSource::Create(chrome::kChromeUIMdSettingsHost);
html_source->SetDefaultResource(IDR_MD_SETTINGS_UI_HTML);
content::WebUIDataSource::Add(web_ui->GetWebContents()->GetBrowserContext(),
html_source);
}
MdSettingsUI::~MdSettingsUI() {
}
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_UI_WEBUI_MD_SETTINGS_UI_H_
#define CHROME_BROWSER_UI_WEBUI_MD_SETTINGS_UI_H_
#include "content/public/browser/web_ui_controller.h"
// The WebUI handler for chrome://md-settings.
class MdSettingsUI : public content::WebUIController {
public:
explicit MdSettingsUI(content::WebUI* web_ui);
~MdSettingsUI() override;
private:
DISALLOW_COPY_AND_ASSIGN(MdSettingsUI);
};
#endif // CHROME_BROWSER_UI_WEBUI_MD_SETTINGS_UI_H_
......@@ -1646,6 +1646,8 @@
'browser/ui/webui/identity_internals_ui.h',
'browser/ui/webui/inspect_ui.cc',
'browser/ui/webui/inspect_ui.h',
'browser/ui/webui/md_settings_ui.cc',
'browser/ui/webui/md_settings_ui.h',
'browser/ui/webui/ntp/app_launcher_handler.cc',
'browser/ui/webui/ntp/app_launcher_handler.h',
'browser/ui/webui/ntp/app_resource_cache_factory.cc',
......
......@@ -1376,6 +1376,12 @@ bool PdfMaterialUIEnabled() {
return false;
}
bool MdSettingsEnabled() {
return base::CommandLine::ForCurrentProcess()->HasSwitch(
::switches::kEnableMaterialDesignSettings);
}
bool SettingsWindowEnabled() {
#if defined(OS_CHROMEOS)
return !base::CommandLine::ForCurrentProcess()->HasSwitch(
......
......@@ -397,6 +397,7 @@ extern const char kFileManagerExtensionPath[];
#endif
bool AboutInSettingsEnabled();
bool MdSettingsEnabled();
bool NewOfflineErrorPageEnabled();
bool OutOfProcessPdfEnabled();
bool PdfMaterialUIEnabled();
......
......@@ -58,6 +58,7 @@ const char kChromeUIInspectURL[] = "chrome://inspect/";
const char kChromeUIInstantURL[] = "chrome://instant/";
const char kChromeUIInterstitialURL[] = "chrome://interstitials/";
const char kChromeUIInvalidationsURL[] = "chrome://invalidations/";
const char kChromeUIMdSettingsURL[] = "chrome://md-settings/";
const char kChromeUIMemoryRedirectURL[] = "chrome://memory-redirect/";
const char kChromeUIMemoryURL[] = "chrome://memory/";
const char kChromeUIMetroFlowURL[] = "chrome://make-metro/";
......@@ -200,6 +201,7 @@ const char kChromeUIInterstitialHost[] = "interstitials";
const char kChromeUIInvalidationsHost[] = "invalidations";
const char kChromeUIKillHost[] = "kill";
const char kChromeUILocalStateHost[] = "local-state";
const char kChromeUIMdSettingsHost[] = "md-settings";
const char kChromeUIMemoryHost[] = "memory";
const char kChromeUIMemoryInternalsHost[] = "memory-internals";
const char kChromeUIMemoryRedirectHost[] = "memory-redirect";
......
......@@ -70,6 +70,7 @@ extern const char kChromeUIPrintURL[];
extern const char kChromeUIQuitURL[];
extern const char kChromeUIRestartURL[];
extern const char kChromeUISessionFaviconURL[];
extern const char kChromeUIMdSettingsURL[];
extern const char kChromeUISettingsURL[];
extern const char kChromeUISettingsFrameURL[];
extern const char kChromeUISuggestions[];
......@@ -195,6 +196,7 @@ extern const char kChromeUIMemoryHost[];
extern const char kChromeUIMemoryInternalsHost[];
extern const char kChromeUIMemoryRedirectHost[];
extern const char kChromeUIMetroFlowHost[];
extern const char kChromeUIMdSettingsHost[];
extern const char kChromeUINaClHost[];
extern const char kChromeUINetExportHost[];
extern const char kChromeUINetInternalsHost[];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment