blob: 9f251dbeca8dfd7f1ccc2884fac585a692aa3bba [file] [log] [blame]
<link rel="import" href="chrome://resources/cr_elements/cr_dialog/cr_dialog.html">
<link rel="import" href="chrome://resources/cr_elements/network/cr_onc_types.html">
<link rel="import" href="chrome://resources/cr_elements/policy/cr_policy_network_behavior.html">
<link rel="import" href="chrome://resources/cr_elements/policy/cr_policy_network_indicator.html">
<link rel="import" href="chrome://resources/html/i18n_behavior.html">
<link rel="import" href="chrome://resources/html/md_select_css.html">
<link rel="import" href="chrome://resources/html/polymer.html">
<link rel="import" href="chrome://resources/polymer/v1_0/iron-a11y-keys/iron-a11y-keys.html">
<link rel="import" href="chrome://resources/polymer/v1_0/paper-button/paper-button.html">
<link rel="import" href="chrome://resources/polymer/v1_0/paper-input/paper-input-container.html">
<link rel="import" href="chrome://resources/polymer/v1_0/paper-input/paper-input.html">
<link rel="import" href="chrome://resources/polymer/v1_0/paper-toggle-button/paper-toggle-button.html">
<link rel="import" href="../controls/extension_controlled_indicator.html">
<link rel="import" href="../controls/settings_toggle_button.html">
<link rel="import" href="../i18n_setup.html">
<link rel="import" href="../prefs/prefs_behavior.html">
<link rel="import" href="../settings_vars_css.html">
<link rel="import" href="internet_shared_css.html">
<link rel="import" href="network_proxy_exclusions.html">
<link rel="import" href="network_proxy_input.html">
<dom-module id="network-proxy">
<template>
<style include="internet-shared md-select">
cr-policy-network-indicator {
-webkit-margin-end: 10px;
}
extension-controlled-indicator {
-webkit-margin-start: 0;
width: 100%;
}
network-proxy-input {
margin-bottom: 10px;
}
/* Use .middle spacing but no flex. */
.settings-box .middle {
flex: none;
}
#exceptionsDiv {
padding: 10px 0;
}
#exceptionsDiv network-proxy-exclusions {
margin: 10px 0;
}
#proxyDiv paper-toggle-button {
padding: 10px 0;
}
</style>
<!-- Policy indicator. Only one dom-if below will be shown. -->
<template is="dom-if"
if="[[shouldShowNetworkPolicyIndicator_(networkProperties)]]">
<div class="settings-box continuation single-column">
<div class="layout horizontal center">
<cr-policy-network-indicator
property="[[networkProperties.ProxySettings.Type]]"
ignore-extensions>
</cr-policy-network-indicator>
<div>$i18n{networkProxyEnforcedPolicy}</div>
</div>
</div>
</template>
<template is="dom-if"
if="[[shouldShowExtensionIndicator_(networkProperties)]]">
<div class="settings-box continuation single-column">
<extension-controlled-indicator
extension-id="[[prefs.proxy.extensionId]]"
extension-name="[[prefs.proxy.controlledByName]]"
extension-can-be-disabled="[[prefs.proxy.extensionCanBeDisabled]]">
</extension-controlled-indicator>
</div>
</template>
<!-- Allow shared proxies -->
<div class="settings-box continuation"
hidden$="[[!shouldShowAllowShared_(
networkProperties.ProxySettings.Type)]]">
<settings-toggle-button id="allowShared" class="start"
pref="{{prefs.settings.use_shared_proxies}}"
label="$i18n{networkProxyAllowShared}"
on-change="onAllowSharedProxiesChange_"
no-set-pref>
</settings-toggle-button>
</div>
<!-- Proxy type dropdown -->
<div class="settings-box continuation">
<div class="start">$i18n{networkProxyConnectionType}</div>
<div class="md-select-wrapper">
<select id="proxyType" class="md-select" on-change="onTypeChange_"
value="[[proxy_.Type]]"
disabled="[[!isEditable_('Type', networkProperties, editable,
useSharedProxies_)]]">
<template is="dom-repeat" items="[[proxyTypes_]]">
<option value="[[item]]">[[getProxyTypeDesc_(item)]]</option>
</template>
</select>
<span class="md-select-underline"></span>
</div>
</div>
<!-- Autoconfiguration (PAC) -->
<div class="settings-box continuation indent"
hidden$="[[!matches_(proxy_.Type, ProxySettingsType_.PAC)]]">
<div>$i18n{networkProxyAutoConfig}</div>
<paper-input no-label-float class="middle flex" value="{{proxy_.PAC}}"
disabled="[[!isEditable_('PAC', networkProperties, editable,
useSharedProxies_)]]"
on-change="onPACChange_">
</paper-input>
</div>
<!-- Web Proxy Auto Discovery (WPAD) -->
<div class="settings-box continuation indent"
hidden$="[[!matches_(proxy_.Type, ProxySettingsType_.WPAD)]]">
<div>$i18n{networkSectionWpad}</div>
<div class="middle flex">[[WPAD_]]</div>
</div>
<!-- Manual -->
<div id="proxyDiv" class="settings-box continuation single-column indent"
hidden$="[[!matches_(proxy_.Type, ProxySettingsType_.MANUAL)]]">
<div class="flex layout horizontal">
<div id="networkProxyToggleLabel" class="flex">
$i18n{networkProxyUseSame}
</div>
<paper-toggle-button checked="{{useSameProxy_}}"
disabled="[[!isEditable_('Type', networkProperties, editable,
useSharedProxies_)]]"
aria-labelledby="networkProxyToggleLabel">
</paper-toggle-button>
</div>
<div hidden$="[[!useSameProxy_]]" class="layout vertical">
<network-proxy-input
on-proxy-change="onProxyInputChange_"
editable="[[isEditable_('Manual.HTTPProxy.Host', networkProperties,
editable, useSharedProxies_)]]"
value="{{proxy_.Manual.HTTPProxy}}"
label="$i18n{networkProxy}">
</network-proxy-input>
</div>
<div hidden$="[[useSameProxy_]]" class="layout vertical">
<network-proxy-input
on-proxy-change="onProxyInputChange_"
editable="[[isEditable_('Manual.HTTPProxy.Host', networkProperties,
editable, useSharedProxies_)]]"
value="{{proxy_.Manual.HTTPProxy}}"
label="$i18n{networkProxyHttp}">
</network-proxy-input>
<network-proxy-input
on-proxy-change="onProxyInputChange_"
editable="[[isEditable_('Manual.SecureHTTPProxy.Host',
networkProperties, editable, useSharedProxies_)]]"
value="{{proxy_.Manual.SecureHTTPProxy}}"
label="$i18n{networkProxyShttp}">
</network-proxy-input>
<network-proxy-input
on-proxy-change="onProxyInputChange_"
editable="[[isEditable_('Manual.FTPProxy.Host', networkProperties,
editable, useSharedProxies_)]]"
value="{{proxy_.Manual.FTPProxy}}"
label="$i18n{networkProxyFtp}">
</network-proxy-input>
<network-proxy-input
on-proxy-change="onProxyInputChange_"
editable="[[isEditable_('Manual.SOCKS.Host', networkProperties,
editable, useSharedProxies_)]]"
value="{{proxy_.Manual.SOCKS}}"
label="$i18n{networkProxySocks}">
</network-proxy-input>
</div>
<div id="exceptionsDiv"
hidden="[[!isEditable_('Type', networkProperties, editable,
useSharedProxies_)]]">
<div>$i18n{networkProxyExceptionList}</div>
<network-proxy-exclusions on-proxy-change="onProxyExclusionsChange_"
exclusions="{{proxy_.ExcludeDomains}}">
</network-proxy-exclusions>
<div class="layout horizontal">
<paper-input-container no-label-float class="flex">
<input id="proxyExclusion" is="iron-input">
<iron-a11y-keys keys="enter"
on-keys-pressed="onAddProxyExclusionTap_">
</iron-a11y-keys>
</paper-input-container>
<paper-button on-tap="onAddProxyExclusionTap_">
$i18n{networkProxyAddException}
</paper-button>
</div>
</div>
<paper-button id="saveManualProxy"
on-tap="onSaveProxyTap_" class="action-button"
disabled="[[!isSaveManualProxyEnabled_(networkProperties,
proxyModified_, proxy_.*)]]">
$i18n{save}
</paper-button>
</div>
<!-- Confirm Allow shared proxies dialog -->
<dialog is="cr-dialog" id="confirmAllowSharedDialog"
close-text="$i18n{close}" on-cancel="onAllowSharedDialogCancel_">
<div class="title">$i18n{networkProxyAllowSharedWarningTitle}</div>
<div class="body">$i18n{networkProxyAllowSharedWarningMessage}</div>
<div class="button-container">
<paper-button class="cancel-button"
on-tap="onAllowSharedDialogCancel_">
$i18n{cancel}
</paper-button>
<paper-button class="action-button"
on-tap="onAllowSharedDialogConfirm_">
$i18n{confirm}
</paper-button>
</div>
</dialog>
</template>
<script src="network_proxy.js"></script>
</dom-module>