summaryrefslogtreecommitdiff
path: root/chromium/chrome/browser/resources/settings/appearance_page
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/chrome/browser/resources/settings/appearance_page')
-rw-r--r--chromium/chrome/browser/resources/settings/appearance_page/appearance_browser_proxy.html3
-rw-r--r--chromium/chrome/browser/resources/settings/appearance_page/appearance_browser_proxy.js82
-rw-r--r--chromium/chrome/browser/resources/settings/appearance_page/appearance_fonts_page.html142
-rw-r--r--chromium/chrome/browser/resources/settings/appearance_page/appearance_fonts_page.js157
-rw-r--r--chromium/chrome/browser/resources/settings/appearance_page/appearance_page.html193
-rw-r--r--chromium/chrome/browser/resources/settings/appearance_page/appearance_page.js352
-rw-r--r--chromium/chrome/browser/resources/settings/appearance_page/fonts_browser_proxy.html2
-rw-r--r--chromium/chrome/browser/resources/settings/appearance_page/fonts_browser_proxy.js56
-rw-r--r--chromium/chrome/browser/resources/settings/appearance_page/home_url_input.html44
-rw-r--r--chromium/chrome/browser/resources/settings/appearance_page/home_url_input.js156
-rw-r--r--chromium/chrome/browser/resources/settings/appearance_page/wallpaper_browser_proxy.html2
-rw-r--r--chromium/chrome/browser/resources/settings/appearance_page/wallpaper_browser_proxy.js48
12 files changed, 0 insertions, 1237 deletions
diff --git a/chromium/chrome/browser/resources/settings/appearance_page/appearance_browser_proxy.html b/chromium/chrome/browser/resources/settings/appearance_page/appearance_browser_proxy.html
deleted file mode 100644
index 9f8635bc54f..00000000000
--- a/chromium/chrome/browser/resources/settings/appearance_page/appearance_browser_proxy.html
+++ /dev/null
@@ -1,3 +0,0 @@
-<link rel="href" src="chrome://resources/html/cr.html">
-<link rel="href" src="chrome://resources/html/load_time_data.html">
-<script src="appearance_browser_proxy.js"></script>
diff --git a/chromium/chrome/browser/resources/settings/appearance_page/appearance_browser_proxy.js b/chromium/chrome/browser/resources/settings/appearance_page/appearance_browser_proxy.js
deleted file mode 100644
index 7e8bd802fc3..00000000000
--- a/chromium/chrome/browser/resources/settings/appearance_page/appearance_browser_proxy.js
+++ /dev/null
@@ -1,82 +0,0 @@
-// Copyright 2016 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.
-
-cr.define('settings', function() {
- /** @interface */
- class AppearanceBrowserProxy {
- /** @return {!Promise<number>} */
- getDefaultZoom() {}
-
- /**
- * @param {string} themeId
- * @return {!Promise<!chrome.management.ExtensionInfo>} Theme info.
- */
- getThemeInfo(themeId) {}
-
- /** @return {boolean} Whether the current profile is supervised. */
- isSupervised() {}
-
- useDefaultTheme() {}
-
- // <if expr="is_linux and not chromeos">
- useSystemTheme() {}
-
- // </if>
-
- /**
- * @param {string} url The url of which to check validity.
- * @return {!Promise<boolean>}
- */
- validateStartupPage(url) {}
- }
-
- /**
- * @implements {settings.AppearanceBrowserProxy}
- */
- class AppearanceBrowserProxyImpl {
- /** @override */
- getDefaultZoom() {
- return new Promise(function(resolve) {
- chrome.settingsPrivate.getDefaultZoom(resolve);
- });
- }
-
- /** @override */
- getThemeInfo(themeId) {
- return new Promise(function(resolve) {
- chrome.management.get(themeId, resolve);
- });
- }
-
- /** @override */
- isSupervised() {
- return loadTimeData.getBoolean('isSupervised');
- }
-
- /** @override */
- useDefaultTheme() {
- chrome.send('useDefaultTheme');
- }
-
- // <if expr="is_linux and not chromeos">
- /** @override */
- useSystemTheme() {
- chrome.send('useSystemTheme');
- }
-
- // </if>
-
- /** @override */
- validateStartupPage(url) {
- return cr.sendWithPromise('validateStartupPage', url);
- }
- }
-
- cr.addSingletonGetter(AppearanceBrowserProxyImpl);
-
- return {
- AppearanceBrowserProxy: AppearanceBrowserProxy,
- AppearanceBrowserProxyImpl: AppearanceBrowserProxyImpl,
- };
-});
diff --git a/chromium/chrome/browser/resources/settings/appearance_page/appearance_fonts_page.html b/chromium/chrome/browser/resources/settings/appearance_page/appearance_fonts_page.html
deleted file mode 100644
index c79e375102d..00000000000
--- a/chromium/chrome/browser/resources/settings/appearance_page/appearance_fonts_page.html
+++ /dev/null
@@ -1,142 +0,0 @@
-<link rel="import" href="chrome://resources/html/polymer.html">
-
-<link rel="import" href="chrome://resources/cr_elements/cr_link_row/cr_link_row.html">
-<link rel="import" href="chrome://resources/html/i18n_behavior.html">
-<link rel="import" href="chrome://resources/html/web_ui_listener_behavior.html">
-<link rel="import" href="fonts_browser_proxy.html">
-<link rel="import" href="../controls/settings_slider.html">
-<link rel="import" href="../controls/settings_dropdown_menu.html">
-<link rel="import" href="../i18n_setup.html">
-<link rel="import" href="../settings_shared_css.html">
-
-<dom-module id="settings-appearance-fonts-page">
- <template>
- <style include="settings-shared">
- #minimumSize {
- align-items: flex-end;
- display: flex;
- flex-direction: column;
- }
-
- #minimumSizeSample {
- text-align: end;
- }
- </style>
- <div class="settings-box first">
- <div class="start settings-box-text">$i18n{fontSize}</div>
- <settings-slider id="sizeSlider"
- pref="{{prefs.webkit.webprefs.default_font_size}}"
- ticks="[[fontSizeRange_]]"
- label-min="$i18n{tiny}" label-max="$i18n{huge}">
- </settings-slider>
- </div>
- <div class="settings-box">
- <div class="start settings-box-text">$i18n{minimumFont}</div>
- <div id="minimumSize">
- <settings-slider pref="{{prefs.webkit.webprefs.minimum_font_size}}"
- ticks="[[minimumFontSizeRange_]]" label-min="$i18n{tiny}"
- label-max="$i18n{huge}"></settings-slider>
- <div id="minimumSizeSample"
- style="
- font-size:[[computeMinimumFontSize_(
- prefs.webkit.webprefs.minimum_font_size.value)]]px;
- font-family:
- '[[prefs.webkit.webprefs.fonts.standard.Zyyy.value]]';"
- hidden>
- [[computeMinimumFontSize_(
- prefs.webkit.webprefs.minimum_font_size.value)]]:
- $i18n{quickBrownFox}
- </div>
- </div>
- </div>
- <div class="settings-box">
- <h2>$i18n{standardFont}</h2>
- </div>
- <div class="list-frame">
- <div class="list-item">
- <settings-dropdown-menu class="start" label="$i18n{standardFont}"
- pref="{{prefs.webkit.webprefs.fonts.standard.Zyyy}}"
- menu-options="[[fontOptions_]]">
- </settings-dropdown-menu>
- </div>
- <div class="list-item settings-box-text"
- style="
- font-size:[[prefs.webkit.webprefs.default_font_size.value]]px;
- font-family:
- '[[prefs.webkit.webprefs.fonts.standard.Zyyy.value]]';">
- <span>
- [[prefs.webkit.webprefs.default_font_size.value]]:
- $i18n{quickBrownFox}
- </span>
- </div>
- </div>
- <div class="settings-box">
- <h2>$i18n{serifFont}</h2>
- </div>
- <div class="list-frame">
- <div class="list-item">
- <settings-dropdown-menu class="start" label="$i18n{serifFont}"
- pref="{{prefs.webkit.webprefs.fonts.serif.Zyyy}}"
- menu-options="[[fontOptions_]]">
- </settings-dropdown-menu>
- </div>
- <div class="list-item settings-box-text"
- style="
- font-size:[[prefs.webkit.webprefs.default_font_size.value]]px;
- font-family:
- '[[prefs.webkit.webprefs.fonts.serif.Zyyy.value]]';">
- <span>
- [[prefs.webkit.webprefs.default_font_size.value]]:
- $i18n{quickBrownFox}
- </span>
- </div>
- </div>
- <div class="settings-box">
- <h2>$i18n{sansSerifFont}</h2>
- </div>
- <div class="list-frame">
- <div class="list-item">
- <settings-dropdown-menu class="start" label="$i18n{sansSerifFont}"
- pref="{{prefs.webkit.webprefs.fonts.sansserif.Zyyy}}"
- menu-options="[[fontOptions_]]">
- </settings-dropdown-menu>
- </div>
- <div class="list-item settings-box-text"
- style="
- font-size:[[prefs.webkit.webprefs.default_font_size.value]]px;
- font-family:
- '[[prefs.webkit.webprefs.fonts.sansserif.Zyyy.value]]';">
- <span>
- [[prefs.webkit.webprefs.default_font_size.value]]:
- $i18n{quickBrownFox}
- </span>
- </div>
- </div>
- <div class="settings-box">
- <h2>$i18n{fixedWidthFont}</h2>
- </div>
- <div class="list-frame">
- <div class="list-item">
- <settings-dropdown-menu class="start" label="$i18n{fixedWidthFont}"
- pref="{{prefs.webkit.webprefs.fonts.fixed.Zyyy}}"
- menu-options="[[fontOptions_]]">
- </settings-dropdown-menu>
- </div>
- <div class="list-item settings-box-text"
- style="
- font-size:
- [[prefs.webkit.webprefs.default_fixed_font_size.value]]px;
- font-family:
- '[[prefs.webkit.webprefs.fonts.fixed.Zyyy.value]]';">
- [[prefs.webkit.webprefs.default_font_size.value]]:
- $i18n{quickBrownFox}
- </div>
- </div>
- <template is="dom-if" if="[[!isGuest_]]">
- <cr-link-row id="advancedButton" class="hr"
- on-click="openAdvancedExtension_" label="$i18n{advancedFontSettings}"
- sub-label="[[advancedExtensionSublabel_]]" external></cr-link-row>
- </template>
- </template>
- <script src="appearance_fonts_page.js"></script>
-</dom-module>
diff --git a/chromium/chrome/browser/resources/settings/appearance_page/appearance_fonts_page.js b/chromium/chrome/browser/resources/settings/appearance_page/appearance_fonts_page.js
deleted file mode 100644
index 7852e2ec734..00000000000
--- a/chromium/chrome/browser/resources/settings/appearance_page/appearance_fonts_page.js
+++ /dev/null
@@ -1,157 +0,0 @@
-// 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.
-
-(function() {
-'use strict';
-
-/** @type {!Array<number>} */
-const FONT_SIZE_RANGE = [
- 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 20, 22, 24,
- 26, 28, 30, 32, 34, 36, 40, 44, 48, 56, 64, 72,
-];
-
-/** @type {!Array<number>} */
-const MINIMUM_FONT_SIZE_RANGE =
- [0, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 20, 22, 24];
-
-/**
- * @param {!Array<number>} ticks
- * @return {!Array<!cr_slider.SliderTick>}
- */
-function ticksWithLabels(ticks) {
- return ticks.map(x => ({label: `${x}`, value: x}));
-}
-
-/**
- * 'settings-appearance-fonts-page' is the settings page containing appearance
- * settings.
- */
-Polymer({
- is: 'settings-appearance-fonts-page',
-
- behaviors: [I18nBehavior, WebUIListenerBehavior],
-
- properties: {
- /** @private */
- advancedExtensionSublabel_: String,
-
- /** @private {!DropdownMenuOptionList} */
- fontOptions_: Object,
-
- /** @private */
- isGuest_: {
- type: Boolean,
- value: function() {
- return loadTimeData.getBoolean('isGuest');
- }
- },
-
- /**
- * Common font sizes.
- * @private {!Array<!cr_slider.SliderTick>}
- */
- fontSizeRange_: {
- readOnly: true,
- type: Array,
- value: ticksWithLabels(FONT_SIZE_RANGE),
- },
-
- /**
- * Reasonable, minimum font sizes.
- * @private {!Array<!cr_slider.SliderTick>}
- */
- minimumFontSizeRange_: {
- readOnly: true,
- type: Array,
- value: ticksWithLabels(MINIMUM_FONT_SIZE_RANGE),
- },
-
- /**
- * Preferences state.
- */
- prefs: {
- type: Object,
- notify: true,
- },
- },
-
- observers: [
- 'onMinimumSizeChange_(prefs.webkit.webprefs.minimum_font_size.value)',
- ],
-
- /** @private {?settings.FontsBrowserProxy} */
- browserProxy_: null,
-
- /** @private {boolean} */
- advancedExtensionInstalled_: false,
-
- /** @private {?string} */
- advancedExtensionUrl_: null,
-
- /** @override */
- created: function() {
- this.browserProxy_ = settings.FontsBrowserProxyImpl.getInstance();
- },
-
- /** @override */
- ready: function() {
- this.addWebUIListener(
- 'advanced-font-settings-installed',
- this.setAdvancedExtensionInstalled_.bind(this));
- this.browserProxy_.observeAdvancedFontExtensionAvailable();
-
- this.browserProxy_.fetchFontsData().then(this.setFontsData_.bind(this));
- },
-
- /** @private */
- openAdvancedExtension_: function() {
- if (this.advancedExtensionInstalled_) {
- this.browserProxy_.openAdvancedFontSettings();
- } else {
- window.open(this.advancedExtensionUrl_);
- }
- },
-
- /**
- * @param {boolean} isInstalled Whether the advanced font settings
- * extension is installed.
- * @private
- */
- setAdvancedExtensionInstalled_: function(isInstalled) {
- this.advancedExtensionInstalled_ = isInstalled;
- this.advancedExtensionSublabel_ = this.i18n(
- isInstalled ? 'openAdvancedFontSettings' : 'requiresWebStoreExtension');
- },
-
- /**
- * @param {!FontsData} response A list of fonts and the advanced
- * font settings extension URL.
- * @private
- */
- setFontsData_: function(response) {
- const fontMenuOptions = [];
- for (const fontData of response.fontList) {
- fontMenuOptions.push({value: fontData[0], name: fontData[1]});
- }
- this.fontOptions_ = fontMenuOptions;
- this.advancedExtensionUrl_ = response.extensionUrl;
- },
-
- /**
- * Get the minimum font size, accounting for unset prefs.
- * @return {number}
- * @private
- */
- computeMinimumFontSize_: function() {
- const prefValue = this.get('prefs.webkit.webprefs.minimum_font_size.value');
- return /** @type {number} */ (prefValue) || MINIMUM_FONT_SIZE_RANGE[0];
- },
-
-
- /** @private */
- onMinimumSizeChange_: function() {
- this.$.minimumSizeSample.hidden = this.computeMinimumFontSize_() <= 0;
- },
-});
-})();
diff --git a/chromium/chrome/browser/resources/settings/appearance_page/appearance_page.html b/chromium/chrome/browser/resources/settings/appearance_page/appearance_page.html
deleted file mode 100644
index 3a619511bed..00000000000
--- a/chromium/chrome/browser/resources/settings/appearance_page/appearance_page.html
+++ /dev/null
@@ -1,193 +0,0 @@
-<link rel="import" href="chrome://resources/html/polymer.html">
-
-<link rel="import" href="chrome://resources/cr_elements/cr_button/cr_button.html">
-<link rel="import" href="chrome://resources/cr_elements/cr_link_row/cr_link_row.html">
-<link rel="import" href="chrome://resources/html/i18n_behavior.html">
-<link rel="import" href="chrome://resources/cr_elements/md_select_css.html">
-<link rel="import" href="appearance_browser_proxy.html">
-<link rel="import" href="../controls/controlled_radio_button.html">
-<link rel="import" href="../controls/extension_controlled_indicator.html">
-<link rel="import" href="../controls/settings_dropdown_menu.html">
-<link rel="import" href="../controls/settings_radio_group.html">
-<link rel="import" href="../controls/settings_toggle_button.html">
-<link rel="import" href="../route.html">
-<link rel="import" href="../settings_page/settings_animated_pages.html">
-<link rel="import" href="../settings_page/settings_subpage.html">
-<link rel="import" href="../settings_shared_css.html">
-<link rel="import" href="../settings_vars_css.html">
-<link rel="import" href="appearance_fonts_page.html">
-<link rel="import" href="home_url_input.html">
-
-<if expr="chromeos">
-<link rel="import" href="../appearance_page/wallpaper_browser_proxy.html">
-</if>
-
-<dom-module id="settings-appearance-page">
- <template>
- <style include="settings-shared md-select iron-flex">
- /* Lines up with cr-input. */
- #custom-input {
- /* (cr-input line-height + cr-input top/bottom padding) / 2 -
- cr-radio disc-wrapper height / 2 */
- --cr-radio-button-disc-margin-block-start: calc(
- (1.54em + 12px) / 2 - 8px);
- align-items: start;
- }
-
- /* The theme mixes a link and a cr-button divided by a separator with
- * grit expressions and dom-if templates. That leads to a tricky thing
- * to style correctly, these are a workaround. */
- #themeRow cr-button {
- margin-inline-end: 20px;
- }
-
- #themeRow .separator {
- margin-inline-start: 0;
- }
- </style>
- <settings-animated-pages id="pages" section="appearance"
- focus-config="[[focusConfig_]]">
- <div route-path="default">
-<if expr="chromeos">
- <cr-link-row id="wallpaperButton"
- hidden="[[!pageVisibility.setWallpaper]]"
- on-click="openWallpaperManager_" label="$i18n{setWallpaper}"
- sub-label="$i18n{openWallpaperApp}"
- disabled="[[isWallpaperPolicyControlled_]]" external>
- <template is="dom-if" if="[[isWallpaperPolicyControlled_]]">
- <cr-policy-indicator id="wallpaperPolicyIndicator"
- indicator-type="devicePolicy">
- </cr-policy-indicator>
- </template>
- </cr-link-row>
- <div class="hr"></div>
-</if>
- <div class="settings-row continuation" id="themeRow"
- hidden="[[!pageVisibility.setTheme]]">
- <cr-link-row class="first" hidden="[[!pageVisibility.setTheme]]"
- label="$i18n{themes}" sub-label="[[themeSublabel_]]"
- on-click="openThemeUrl_" external></cr-link-row>
-<if expr="not is_linux or chromeos">
- <template is="dom-if" if="[[prefs.extensions.theme.id.value]]">
- <div class="separator"></div>
- <cr-button id="useDefault" on-click="onUseDefaultTap_">
- $i18n{resetToDefaultTheme}
- </cr-button>
- </template>
-</if>
-<if expr="is_linux and not chromeos">
- <div class="settings-row continuation"
- hidden="[[!showThemesSecondary_(
- prefs.extensions.theme.id.value, useSystemTheme_)]]"
- id="themesSecondaryActions">
- <div class="separator"></div>
- <template is="dom-if" if="[[showUseClassic_(
- prefs.extensions.theme.id.value, useSystemTheme_)]]" restamp>
- <cr-button id="useDefault" on-click="onUseDefaultTap_">
- $i18n{useClassicTheme}
- </cr-button>
- </template>
- <template is="dom-if" if="[[showUseSystem_(
- prefs.extensions.theme.id.value, useSystemTheme_)]]" restamp>
- <cr-button id="useSystem" on-click="onUseSystemTap_">
- $i18n{useSystemTheme}
- </cr-button>
- </template>
- </div>
-</if>
- </div>
- <settings-toggle-button elide-label
- hidden="[[!pageVisibility.homeButton]]"
- pref="{{prefs.browser.show_home_button}}"
- label="$i18n{showHomeButton}"
- sub-label="[[getShowHomeSubLabel_(
- prefs.browser.show_home_button.value,
- prefs.homepage_is_newtabpage.value,
- prefs.homepage.value)]]">
- </settings-toggle-button>
- <template is="dom-if" if="[[prefs.browser.show_home_button.value]]">
- <div class="list-frame" hidden="[[!pageVisibility.homeButton]]">
- <settings-radio-group pref="{{prefs.homepage_is_newtabpage}}">
- <controlled-radio-button class="list-item" name="true"
- pref="[[prefs.homepage_is_newtabpage]]"
- label="$i18n{homePageNtp}" no-extension-indicator>
- </controlled-radio-button>
- <controlled-radio-button id="custom-input" class="list-item"
- name="false" pref="[[prefs.homepage_is_newtabpage]]"
- no-extension-indicator>
- <!-- TODO(dbeam): this can show double indicators when both
- homepage and whether to use the NTP as the homepage are
- managed. -->
- <home-url-input id="customHomePage" pref="{{prefs.homepage}}"
- can-tab="[[!prefs.homepage_is_newtabpage.value]]">
- </home-url-input>
- </controlled-radio-button>
- <template is="dom-if" if="[[prefs.homepage.extensionId]]">
- <extension-controlled-indicator
- extension-id="[[prefs.homepage.extensionId]]"
- extension-can-be-disabled="[[
- prefs.homepage.extensionCanBeDisabled]]"
- extension-name="[[prefs.homepage.controlledByName]]"
- on-disable-extension="onDisableExtension_">
- </extension-controlled-indicator>
- </template>
- </settings-radio-group>
- </div>
- </template>
- <settings-toggle-button hidden="[[!pageVisibility.bookmarksBar]]"
- pref="{{prefs.bookmark_bar.show_on_all_tabs}}"
- label="$i18n{showBookmarksBar}">
- </settings-toggle-button>
-<if expr="is_linux and not chromeos">
- <settings-toggle-button
- class$="[[getFirst_(pageVisibility.bookmarksBar)]]"
- pref="{{prefs.browser.custom_chrome_frame}}"
- label="$i18n{showWindowDecorations}"
- inverted>
- </settings-toggle-button>
-</if>
- <div class="settings-box">
- <div class="start settings-box-text">$i18n{fontSize}</div>
- <settings-dropdown-menu id="defaultFontSize" label="$i18n{fontSize}"
- pref="{{prefs.webkit.webprefs.default_font_size}}"
- menu-options="[[fontSizeOptions_]]">
- </settings-dropdown-menu>
- </div>
- <cr-link-row class="hr" id="customize-fonts-subpage-trigger"
- label="$i18n{customizeFonts}" on-click="onCustomizeFontsTap_">
- </cr-link-row>
- <div class="settings-box" hidden="[[!pageVisibility.pageZoom]]">
- <div id="pageZoom" class="start settings-box-text">
- $i18n{pageZoom}
- </div>
- <select id="zoomLevel" class="md-select" aria-labelledby="pageZoom"
- on-change="onZoomLevelChange_">
- <template is="dom-repeat" items="[[pageZoomLevels_]]">
- <option value="[[item]]"
- selected="[[zoomValuesEqual_(item, defaultZoom_)]]">
- [[formatZoom_(item)]]%
- </option>
- </template>
- </select>
- </div>
-<if expr="is_macosx">
- <settings-toggle-button pref="{{prefs.webkit.webprefs.tabs_to_links}}"
- label="$i18n{tabsToLinks}">
- </settings-toggle-button>
- <settings-toggle-button pref="{{prefs.browser.confirm_to_quit}}"
- label="$i18n{warnBeforeQuitting}">
- </settings-toggle-button>
-</if>
- </div>
- <template is="dom-if" route-path="/fonts">
- <settings-subpage
- associated-control="[[$$('#customize-fonts-subpage-trigger')]]"
- page-title="$i18n{customizeFonts}">
- <settings-appearance-fonts-page prefs="{{prefs}}">
- </settings-appearance-fonts-page>
- </settings-subpage>
- </template>
- </settings-animated-pages>
- </template>
- <script src="appearance_page.js"></script>
-</dom-module>
diff --git a/chromium/chrome/browser/resources/settings/appearance_page/appearance_page.js b/chromium/chrome/browser/resources/settings/appearance_page/appearance_page.js
deleted file mode 100644
index 582ae814c9e..00000000000
--- a/chromium/chrome/browser/resources/settings/appearance_page/appearance_page.js
+++ /dev/null
@@ -1,352 +0,0 @@
-// 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.
-
-(function() {
-'use strict';
-
-/**
- * This is the absolute difference maintained between standard and
- * fixed-width font sizes. http://crbug.com/91922.
- * @type {number}
- */
-const SIZE_DIFFERENCE_FIXED_STANDARD = 3;
-
-/**
- * ID for autogenerated themes. Should match
- * |ThemeService::kAutogeneratedThemeID|.
- */
-const AUTOGENERATED_THEME_ID = 'autogenerated_theme_id';
-
-/**
- * 'settings-appearance-page' is the settings page containing appearance
- * settings.
- */
-Polymer({
- is: 'settings-appearance-page',
-
- behaviors: [I18nBehavior],
-
- properties: {
- /**
- * Dictionary defining page visibility.
- * @type {!AppearancePageVisibility}
- */
- pageVisibility: Object,
-
- prefs: {
- type: Object,
- notify: true,
- },
-
- /** @private */
- defaultZoom_: Number,
-
- /** @private */
- isWallpaperPolicyControlled_: {type: Boolean, value: true},
-
- /**
- * List of options for the font size drop-down menu.
- * @type {!DropdownMenuOptionList}
- */
- fontSizeOptions_: {
- readOnly: true,
- type: Array,
- value: function() {
- return [
- {value: 9, name: loadTimeData.getString('verySmall')},
- {value: 12, name: loadTimeData.getString('small')},
- {value: 16, name: loadTimeData.getString('medium')},
- {value: 20, name: loadTimeData.getString('large')},
- {value: 24, name: loadTimeData.getString('veryLarge')},
- ];
- },
- },
-
- /**
- * List of options for the page zoom drop-down menu.
- * @type {!Array<number>}
- */
- pageZoomLevels_: {
- readOnly: true,
- type: Array,
- value: [
- // TODO(dbeam): get these dynamically from C++ instead.
- 1 / 4,
- 1 / 3,
- 1 / 2,
- 2 / 3,
- 3 / 4,
- 4 / 5,
- 9 / 10,
- 1,
- 11 / 10,
- 5 / 4,
- 3 / 2,
- 7 / 4,
- 2,
- 5 / 2,
- 3,
- 4,
- 5,
- ],
- },
-
- /** @private */
- themeSublabel_: String,
-
- /** @private */
- themeUrl_: String,
-
- /** @private */
- useSystemTheme_: {
- type: Boolean,
- value: false, // Can only be true on Linux, but value exists everywhere.
- },
-
- /** @private {!Map<string, string>} */
- focusConfig_: {
- type: Object,
- value: function() {
- const map = new Map();
- if (settings.routes.FONTS) {
- map.set(
- settings.routes.FONTS.path, '#customize-fonts-subpage-trigger');
- }
- return map;
- },
- },
- },
-
- /** @private {?settings.AppearanceBrowserProxy} */
- appearanceBrowserProxy_: null,
-
- // <if expr="chromeos">
- /** @private {?settings.WallpaperBrowserProxy} */
- wallpaperBrowserProxy_: null,
- // </if>
-
- observers: [
- 'defaultFontSizeChanged_(prefs.webkit.webprefs.default_font_size.value)',
- 'themeChanged_(prefs.extensions.theme.id.value, useSystemTheme_)',
-
- // <if expr="is_linux and not chromeos">
- // NOTE: this pref only exists on Linux.
- 'useSystemThemePrefChanged_(prefs.extensions.theme.use_system.value)',
- // </if>
- ],
-
- /** @override */
- created: function() {
- this.appearanceBrowserProxy_ =
- settings.AppearanceBrowserProxyImpl.getInstance();
- // <if expr="chromeos">
- this.wallpaperBrowserProxy_ =
- settings.WallpaperBrowserProxyImpl.getInstance();
- // </if>
- },
-
- /** @override */
- ready: function() {
- this.$.defaultFontSize.menuOptions = this.fontSizeOptions_;
- // TODO(dschuyler): Look into adding a listener for the
- // default zoom percent.
- this.appearanceBrowserProxy_.getDefaultZoom().then(zoom => {
- this.defaultZoom_ = zoom;
- });
- // <if expr="chromeos">
- this.wallpaperBrowserProxy_.isWallpaperSettingVisible().then(
- isWallpaperSettingVisible => {
- assert(this.pageVisibility);
- this.pageVisibility.setWallpaper = isWallpaperSettingVisible;
- });
- this.wallpaperBrowserProxy_.isWallpaperPolicyControlled().then(
- isPolicyControlled => {
- this.isWallpaperPolicyControlled_ = isPolicyControlled;
- });
- // </if>
- },
-
- /**
- * @param {number} zoom
- * @return {number} A zoom easier read by users.
- * @private
- */
- formatZoom_: function(zoom) {
- return Math.round(zoom * 100);
- },
-
- /**
- * @param {boolean} showHomepage Whether to show home page.
- * @param {boolean} isNtp Whether to use the NTP as the home page.
- * @param {string} homepageValue If not using NTP, use this URL.
- * @return {string} The sub-label.
- * @private
- */
- getShowHomeSubLabel_: function(showHomepage, isNtp, homepageValue) {
- if (!showHomepage) {
- return this.i18n('homeButtonDisabled');
- }
- if (isNtp) {
- return this.i18n('homePageNtp');
- }
- return homepageValue || this.i18n('customWebAddress');
- },
-
- /** @private */
- onCustomizeFontsTap_: function() {
- settings.navigateTo(settings.routes.FONTS);
- },
-
- /** @private */
- onDisableExtension_: function() {
- this.fire('refresh-pref', 'homepage');
- },
-
- /**
- * @param {number} value The changed font size slider value.
- * @private
- */
- defaultFontSizeChanged_: function(value) {
- // This pref is handled separately in some extensions, but here it is tied
- // to default_font_size (to simplify the UI).
- this.set(
- 'prefs.webkit.webprefs.default_fixed_font_size.value',
- value - SIZE_DIFFERENCE_FIXED_STANDARD);
- },
-
- /**
- * Open URL for either current theme or the theme gallery.
- * @private
- */
- openThemeUrl_: function() {
- window.open(this.themeUrl_ || loadTimeData.getString('themesGalleryUrl'));
- },
-
- // <if expr="chromeos">
- /**
- * ChromeOS only.
- * @private
- */
- openWallpaperManager_: function() {
- this.wallpaperBrowserProxy_.openWallpaperManager();
- },
- // </if>
-
- /** @private */
- onUseDefaultTap_: function() {
- this.appearanceBrowserProxy_.useDefaultTheme();
- },
-
- // <if expr="is_linux and not chromeos">
- /**
- * @param {boolean} useSystemTheme
- * @private
- */
- useSystemThemePrefChanged_: function(useSystemTheme) {
- this.useSystemTheme_ = useSystemTheme;
- },
-
- /**
- * @param {string} themeId
- * @param {boolean} useSystemTheme
- * @return {boolean} Whether to show the "USE CLASSIC" button.
- * @private
- */
- showUseClassic_: function(themeId, useSystemTheme) {
- return !!themeId || useSystemTheme;
- },
-
- /**
- * @param {string} themeId
- * @param {boolean} useSystemTheme
- * @return {boolean} Whether to show the "USE GTK+" button.
- * @private
- */
- showUseSystem_: function(themeId, useSystemTheme) {
- return (!!themeId || !useSystemTheme) &&
- !this.appearanceBrowserProxy_.isSupervised();
- },
-
- /**
- * @param {string} themeId
- * @param {boolean} useSystemTheme
- * @return {boolean} Whether to show the secondary area where "USE CLASSIC"
- * and "USE GTK+" buttons live.
- * @private
- */
- showThemesSecondary_: function(themeId, useSystemTheme) {
- return this.showUseClassic_(themeId, useSystemTheme) ||
- this.showUseSystem_(themeId, useSystemTheme);
- },
-
- /** @private */
- onUseSystemTap_: function() {
- this.appearanceBrowserProxy_.useSystemTheme();
- },
- // </if>
-
- /**
- * @param {string} themeId
- * @param {boolean} useSystemTheme
- * @private
- */
- themeChanged_: function(themeId, useSystemTheme) {
- if (this.prefs == undefined || useSystemTheme == undefined) {
- return;
- }
-
- if (themeId.length > 0 && themeId != AUTOGENERATED_THEME_ID) {
- assert(!useSystemTheme);
-
- this.appearanceBrowserProxy_.getThemeInfo(themeId).then(info => {
- this.themeSublabel_ = info.name;
- });
-
- this.themeUrl_ = 'https://chrome.google.com/webstore/detail/' + themeId;
- return;
- }
-
- this.themeUrl_ = '';
-
- if (themeId == AUTOGENERATED_THEME_ID) {
- this.themeSublabel_ = this.i18n('chromeColors');
- return;
- }
-
- let i18nId;
- // <if expr="is_linux and not chromeos">
- i18nId = useSystemTheme ? 'systemTheme' : 'classicTheme';
- // </if>
- // <if expr="not is_linux or chromeos">
- i18nId = 'chooseFromWebStore';
- // </if>
- this.themeSublabel_ = this.i18n(i18nId);
- },
-
- /** @private */
- onZoomLevelChange_: function() {
- chrome.settingsPrivate.setDefaultZoom(parseFloat(this.$.zoomLevel.value));
- },
-
- /**
- * @param {boolean} bookmarksBarVisible if bookmarks bar option is visible.
- * @return {string} 'first' if the argument is false or empty otherwise.
- * @private
- */
- getFirst_: function(bookmarksBarVisible) {
- return !bookmarksBarVisible ? 'first' : '';
- },
-
- /**
- * @see blink::PageZoomValuesEqual().
- * @param {number} zoom1
- * @param {number} zoom2
- * @return {boolean}
- * @private
- */
- zoomValuesEqual_: function(zoom1, zoom2) {
- return Math.abs(zoom1 - zoom2) <= 0.001;
- },
-});
-})();
diff --git a/chromium/chrome/browser/resources/settings/appearance_page/fonts_browser_proxy.html b/chromium/chrome/browser/resources/settings/appearance_page/fonts_browser_proxy.html
deleted file mode 100644
index 9af652850ac..00000000000
--- a/chromium/chrome/browser/resources/settings/appearance_page/fonts_browser_proxy.html
+++ /dev/null
@@ -1,2 +0,0 @@
-<link rel="href" src="chrome://resources/html/cr.html">
-<script src="fonts_browser_proxy.js"></script>
diff --git a/chromium/chrome/browser/resources/settings/appearance_page/fonts_browser_proxy.js b/chromium/chrome/browser/resources/settings/appearance_page/fonts_browser_proxy.js
deleted file mode 100644
index 3755b3124f6..00000000000
--- a/chromium/chrome/browser/resources/settings/appearance_page/fonts_browser_proxy.js
+++ /dev/null
@@ -1,56 +0,0 @@
-// Copyright 2016 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.
-
-/**
- * @typedef {{
- * fontList: !Array<{
- * 0: string,
- * 1: (string|undefined),
- * 2: (string|undefined)}>,
- * extensionUrl: string
- * }}
- */
-let FontsData;
-
-cr.define('settings', function() {
- /** @interface */
- class FontsBrowserProxy {
- /**
- * @return {!Promise<!FontsData>} Fonts and the advanced font settings
- * extension URL.
- */
- fetchFontsData() {}
-
- observeAdvancedFontExtensionAvailable() {}
-
- openAdvancedFontSettings() {}
- }
-
- /**
- * @implements {settings.FontsBrowserProxy}
- */
- class FontsBrowserProxyImpl {
- /** @override */
- fetchFontsData() {
- return cr.sendWithPromise('fetchFontsData');
- }
-
- /** @override */
- observeAdvancedFontExtensionAvailable() {
- chrome.send('observeAdvancedFontExtensionAvailable');
- }
-
- /** @override */
- openAdvancedFontSettings() {
- chrome.send('openAdvancedFontSettings');
- }
- }
-
- cr.addSingletonGetter(FontsBrowserProxyImpl);
-
- return {
- FontsBrowserProxy: FontsBrowserProxy,
- FontsBrowserProxyImpl: FontsBrowserProxyImpl,
- };
-});
diff --git a/chromium/chrome/browser/resources/settings/appearance_page/home_url_input.html b/chromium/chrome/browser/resources/settings/appearance_page/home_url_input.html
deleted file mode 100644
index 6d293ea3061..00000000000
--- a/chromium/chrome/browser/resources/settings/appearance_page/home_url_input.html
+++ /dev/null
@@ -1,44 +0,0 @@
-<link rel="import" href="chrome://resources/html/polymer.html">
-
-<link rel="import" href="chrome://resources/cr_elements/cr_input/cr_input.html">
-<link rel="import" href="chrome://resources/html/assert.html">
-<link rel="import" href="chrome://resources/cr_elements/policy/cr_policy_pref_behavior.html">
-<link rel="import" href="chrome://resources/cr_elements/policy/cr_policy_pref_indicator.html">
-<link rel="import" href="../controls/pref_control_behavior.html">
-<link rel="import" href="appearance_browser_proxy.html">
-
-<dom-module id="home-url-input">
- <template>
- <style>
- :host {
- cursor: auto;
- display: block;
- width: 100%;
- }
-
- cr-input {
- width: 100%;
- --cr-input-width: 50%;
- }
-
- cr-input::part(row-container) {
- justify-content: normal;
- }
- </style>
- <!-- Max length of 100 KB to prevent browser from freezing. -->
- <cr-input id="input" value="{{value}}" error-message="$i18n{notValid}"
- placeholder="$i18n{enterCustomWebAddress}" maxlength="102400"
- on-change="onChange_" on-keydown="onKeydown_" on-input="validate_"
- invalid="{{invalid}}" tabindex="[[getTabindex_(canTab)]]"
- disabled="[[isDisabled_(disabled, pref.*)]]" spellcheck="false"
- on-keyup="stopKeyEventPropagation_"
- on-keypress="stopKeyEventPropagation_">
- <template is="dom-if" if="[[hasPrefPolicyIndicator(pref.*)]]">
- <cr-policy-pref-indicator pref="[[pref]]" icon-aria-label="[[label]]"
- slot="suffix">
- </cr-policy-pref-indicator>
- </template>
- </cr-input>
- </template>
- <script src="home_url_input.js"></script>
-</dom-module>
diff --git a/chromium/chrome/browser/resources/settings/appearance_page/home_url_input.js b/chromium/chrome/browser/resources/settings/appearance_page/home_url_input.js
deleted file mode 100644
index 4aa806c5625..00000000000
--- a/chromium/chrome/browser/resources/settings/appearance_page/home_url_input.js
+++ /dev/null
@@ -1,156 +0,0 @@
-// 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.
-
-/**
- * @fileoverview
- * `home-url-input` is a single-line text field intending to be used with
- * prefs.homepage
- */
-Polymer({
- is: 'home-url-input',
-
- behaviors: [CrPolicyPrefBehavior, PrefControlBehavior],
-
- properties: {
- /**
- * The preference object to control.
- * @type {!chrome.settingsPrivate.PrefObject|undefined}
- * @override
- */
- pref: {observer: 'prefChanged_'},
-
- /* Set to true to disable editing the input. */
- disabled: {type: Boolean, value: false, reflectToAttribute: true},
-
- canTab: Boolean,
-
- invalid: {type: Boolean, value: false},
-
- /* The current value of the input, reflected to/from |pref|. */
- value: {
- type: String,
- value: '',
- notify: true,
- },
- },
-
- /** @private {?settings.AppearanceBrowserProxy} */
- browserProxy_: null,
-
- /** @override */
- created: function() {
- this.browserProxy_ = settings.AppearanceBrowserProxyImpl.getInstance();
- this.noExtensionIndicator = true; // Prevent double indicator.
- },
-
- /**
- * Focuses the 'input' element.
- */
- focus: function() {
- this.$.input.focus();
- },
-
- /**
- * Polymer changed observer for |pref|.
- * @private
- */
- prefChanged_: function() {
- if (!this.pref) {
- return;
- }
-
- // Ignore updates while the input is focused so that user input is not
- // overwritten.
- if (this.$.input.focused) {
- return;
- }
-
- this.setInputValueFromPref_();
- },
-
- /** @private */
- setInputValueFromPref_: function() {
- assert(this.pref.type == chrome.settingsPrivate.PrefType.URL);
- this.value = /** @type {string} */ (this.pref.value);
- },
-
- /**
- * Gets a tab index for this control if it can be tabbed to.
- * @param {boolean} canTab
- * @return {number}
- * @private
- */
- getTabindex_: function(canTab) {
- return canTab ? 0 : -1;
- },
-
- /**
- * Change event handler for cr-input. Updates the pref value.
- * settings-input uses the change event because it is fired by the Enter key.
- * @private
- */
- onChange_: function() {
- if (this.invalid) {
- this.resetValue_();
- return;
- }
-
- assert(this.pref.type == chrome.settingsPrivate.PrefType.URL);
- this.set('pref.value', this.value);
- },
-
- /** @private */
- resetValue_: function() {
- this.invalid = false;
- this.setInputValueFromPref_();
- this.$.input.blur();
- },
-
- /**
- * Keydown handler to specify enter-key and escape-key interactions.
- * @param {!Event} event
- * @private
- */
- onKeydown_: function(event) {
- // If pressed enter when input is invalid, do not trigger on-change.
- if (event.key == 'Enter' && this.invalid) {
- event.preventDefault();
- } else if (event.key == 'Escape') {
- this.resetValue_();
- }
-
- this.stopKeyEventPropagation_(event);
- },
-
- /**
- * This function prevents unwanted change of selection of the containing
- * cr-radio-group, when the user traverses the input with arrow keys.
- * @param {!Event} e
- * @private
- */
- stopKeyEventPropagation_: function(e) {
- e.stopPropagation();
- },
-
- /**
- * @param {boolean} disabled
- * @return {boolean} Whether the element should be disabled.
- * @private
- */
- isDisabled_: function(disabled) {
- return disabled || this.isPrefEnforced();
- },
-
- /** @private */
- validate_: function() {
- if (this.value == '') {
- this.invalid = false;
- return;
- }
-
- this.browserProxy_.validateStartupPage(this.value).then(isValid => {
- this.invalid = !isValid;
- });
- },
-});
diff --git a/chromium/chrome/browser/resources/settings/appearance_page/wallpaper_browser_proxy.html b/chromium/chrome/browser/resources/settings/appearance_page/wallpaper_browser_proxy.html
deleted file mode 100644
index 59b04eed214..00000000000
--- a/chromium/chrome/browser/resources/settings/appearance_page/wallpaper_browser_proxy.html
+++ /dev/null
@@ -1,2 +0,0 @@
-<link rel="href" src="chrome://resources/html/cr.html">
-<script src="wallpaper_browser_proxy.js"></script>
diff --git a/chromium/chrome/browser/resources/settings/appearance_page/wallpaper_browser_proxy.js b/chromium/chrome/browser/resources/settings/appearance_page/wallpaper_browser_proxy.js
deleted file mode 100644
index 90a2e4db7d9..00000000000
--- a/chromium/chrome/browser/resources/settings/appearance_page/wallpaper_browser_proxy.js
+++ /dev/null
@@ -1,48 +0,0 @@
-// Copyright 2019 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.
-
-cr.define('settings', function() {
- /** @interface */
- class WallpaperBrowserProxy {
- /**
- * @return {!Promise<boolean>} Whether the wallpaper setting row should be
- * visible.
- */
- isWallpaperSettingVisible() {}
-
- /**
- * @return {!Promise<boolean>} Whether the wallpaper is policy controlled.
- */
- isWallpaperPolicyControlled() {}
-
- openWallpaperManager() {}
- }
-
- /**
- * @implements {settings.WallpaperBrowserProxy}
- */
- class WallpaperBrowserProxyImpl {
- /** @override */
- isWallpaperSettingVisible() {
- return cr.sendWithPromise('isWallpaperSettingVisible');
- }
-
- /** @override */
- isWallpaperPolicyControlled() {
- return cr.sendWithPromise('isWallpaperPolicyControlled');
- }
-
- /** @override */
- openWallpaperManager() {
- chrome.send('openWallpaperManager');
- }
- }
-
- cr.addSingletonGetter(WallpaperBrowserProxyImpl);
-
- return {
- WallpaperBrowserProxy: WallpaperBrowserProxy,
- WallpaperBrowserProxyImpl: WallpaperBrowserProxyImpl,
- };
-});