[go: up one dir, main page]

Revert "Give users the option not to auto connect to WiFi networks."

This reverts commit e6926742006fcf847e5f091f89be251a715c6755.

Reason for revert: This feature was not finished before branch point so I'm pushing it back to 77.

Original change's description:
> Give users the option not to auto connect to WiFi networks.
>
> In order to auto connect to hidden Wifi networks, CrOS must broadcast
> the SSID of the network to see if it's available, which leaks
> information about what networks the device is configured to
> auto-connect to.  This page gives users the option of whether or not to
> auto connect to a WiFi network when first configuring the network, and
> provides a warning that auto connecting to a hidden network is bad from
> a privacy point of view.  A pop up dialog with a longer explanation
> about why auto connecting to a hidden network is bad from a privacy
> point of view will be included in a later cl but is currently blocked
> on a CSS bug (crbug/954202).
>
> Change-Id: I0abd56ff2b3a57ec77f31feb6b66d800cf2ebeb6
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1476090
> Commit-Queue: Melissa Galonsky <mgalonsky@chromium.org>
> Reviewed-by: Steven Bennetts <stevenjb@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#656767}

(cherry picked from commit f1a792d5b7a5e56718ae2144a8ea4974d89ff560)

Bug: 903908
Change-Id: I02740cec60bfd0e7a23032d732752cf252616b18
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1655395
Commit-Queue: Melissa Galonsky <mgalonsky@chromium.org>
Reviewed-by: Christian Dullweber <dullweber@chromium.org>
Reviewed-by: Steven Bennetts <stevenjb@chromium.org>
Reviewed-by: Kyle Horimoto <khorimoto@chromium.org>
Auto-Submit: Melissa Galonsky <mgalonsky@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#668761}
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1659015
Cr-Commit-Position: refs/branch-heads/3809@{#299}
Cr-Branched-From: d82dec1a818f378c464ba307ddd9c92133eac355-refs/heads/master@{#665002}
diff --git a/chrome/app/settings_strings.grdp b/chrome/app/settings_strings.grdp
index a9466622..65b3d68e 100644
--- a/chrome/app/settings_strings.grdp
+++ b/chrome/app/settings_strings.grdp
@@ -1827,9 +1827,6 @@
     <message name="IDS_SETTINGS_INTERNET_CONFIG_SHARE" desc="Settings > Internet > Network config: Label for setting allowing other device users to use the network configuration.">
       Allow other users of this device to use this network
     </message>
-    <message name="IDS_SETTINGS_HIDDEN_NETWORK_WARNING" desc="Settings > Internet > Network config: Text shown when auto connect to the WiFi network is enabled, warning about the dangers of auto-connecting to hidden networks.">
-      Automatically connecting to a hidden network allows others to see your device and some network settings, and is not recommended.
-    </message>
     <message name="IDS_SETTINGS_INTERNET_CONFIG_SAVE_CREDENTIALS" desc="Settings > Internet > Network config: Label for the setting to save identity and password.">
       Save identity and password
     </message>
diff --git a/chrome/app/settings_strings_grdp/IDS_SETTINGS_HIDDEN_NETWORK_WARNING.png.sha1 b/chrome/app/settings_strings_grdp/IDS_SETTINGS_HIDDEN_NETWORK_WARNING.png.sha1
deleted file mode 100644
index fd39eb1..0000000
--- a/chrome/app/settings_strings_grdp/IDS_SETTINGS_HIDDEN_NETWORK_WARNING.png.sha1
+++ /dev/null
@@ -1 +0,0 @@
-7b67f22ff91633353d0c6e3e61cd2bdfd75aab9a
\ No newline at end of file
diff --git a/chrome/browser/resources/settings/internet_page/internet_detail_page.html b/chrome/browser/resources/settings/internet_page/internet_detail_page.html
index 941598f..480ec02a 100644
--- a/chrome/browser/resources/settings/internet_page/internet_detail_page.html
+++ b/chrome/browser/resources/settings/internet_page/internet_detail_page.html
@@ -31,7 +31,7 @@
 
 <dom-module id="settings-internet-detail-page">
   <template>
-    <style include="internet-shared settings-shared iron-flex">
+    <style include="internet-shared iron-flex">
       :host {
         padding-bottom: 40px;
       }
@@ -65,10 +65,6 @@
       paper-spinner-lite {
         @apply --cr-icon-height-width;
       }
-      .warning {
-          color: var(--cr-secondary-text-color);
-          margin-inline-start: var(--settings-controlled-by-spacing);
-      }
     </style>
     <!-- Title section: Icon + name + connection state. -->
     <div id="titleDiv" class="settings-box first">
@@ -187,15 +183,6 @@
             pref="{{autoConnect_}}"
             label="[[getAutoConnectToggleLabel_(networkProperties_)]]">
         </settings-toggle-button>
-        <!-- Hidden Network Warning -->
-        <template is="dom-if"
-            if="[[showHiddenNetworkWarning_(autoConnect_, networkProperties_)]]"
-            restamp>
-          <div class="warning">
-            <iron-icon icon="cr:warning"></iron-icon>
-            [[i18n('hiddenNetworkWarning')]]
-          </div>
-        </template>
       </template>
       <!-- Always-on VPN. -->
       <template is="dom-if"
diff --git a/chrome/browser/resources/settings/internet_page/internet_detail_page.js b/chrome/browser/resources/settings/internet_page/internet_detail_page.js
index 2b24a90..c935bf25 100644
--- a/chrome/browser/resources/settings/internet_page/internet_detail_page.js
+++ b/chrome/browser/resources/settings/internet_page/internet_detail_page.js
@@ -957,16 +957,6 @@
   },
 
   /**
-   * @return {boolean}
-   * @private
-   */
-  showHiddenNetworkWarning_: function() {
-    return !!this.autoConnect_ && !!this.autoConnect_.value &&
-        !!this.networkProperties_ && !!this.networkProperties_.WiFi &&
-        !!CrOnc.getActiveValue(this.networkProperties_.WiFi.HiddenSSID);
-  },
-
-  /**
    * Event triggered for elements associated with network properties.
    * @param {!CustomEvent<!{
    *     field: string,
diff --git a/chrome/browser/ui/webui/chromeos/network_element_localized_strings_provider.cc b/chrome/browser/ui/webui/chromeos/network_element_localized_strings_provider.cc
index e006b48..6013fe4 100644
--- a/chrome/browser/ui/webui/chromeos/network_element_localized_strings_provider.cc
+++ b/chrome/browser/ui/webui/chromeos/network_element_localized_strings_provider.cc
@@ -15,7 +15,6 @@
 #include "components/login/localized_values_builder.h"
 #include "content/public/browser/web_ui_data_source.h"
 #include "third_party/cros_system_api/dbus/service_constants.h"
-#include "ui/base/l10n/l10n_util.h"
 
 namespace chromeos {
 namespace network_element {
@@ -264,8 +263,6 @@
       {"networkConfigSaveCredentials",
        IDS_SETTINGS_INTERNET_CONFIG_SAVE_CREDENTIALS},
       {"networkConfigShare", IDS_SETTINGS_INTERNET_CONFIG_SHARE},
-      {"networkAutoConnect", IDS_SETTINGS_INTERNET_NETWORK_AUTO_CONNECT},
-      {"hiddenNetworkWarning", IDS_SETTINGS_HIDDEN_NETWORK_WARNING},
       {"hidePassword", IDS_SETTINGS_PASSWORD_HIDE},
       {"showPassword", IDS_SETTINGS_PASSWORD_SHOW},
   };
diff --git a/ui/webui/resources/cr_components/chromeos/network/network_config.html b/ui/webui/resources/cr_components/chromeos/network/network_config.html
index 6461170..654a6f4f 100644
--- a/ui/webui/resources/cr_components/chromeos/network/network_config.html
+++ b/ui/webui/resources/cr_components/chromeos/network/network_config.html
@@ -1,11 +1,7 @@
 <link rel="import" href="chrome://resources/html/polymer.html">
 
 <link rel="import" href="chrome://resources/cr_elements/chromeos/network/cr_onc_types.html">
-<link rel="import" href="chrome://resources/cr_elements/cr_dialog/cr_dialog.html">
 <link rel="import" href="chrome://resources/cr_elements/cr_toggle/cr_toggle.html">
-<link rel="import" href="chrome://resources/cr_elements/policy/cr_policy_indicator.html">
-<link rel="import" href="chrome://resources/html/action_link.html">
-<link rel="import" href="chrome://resources/html/action_link_css.html">
 <link rel="import" href="chrome://resources/html/i18n_behavior.html">
 <link rel="import" href="chrome://resources/polymer/v1_0/iron-flex-layout/iron-flex-layout-classes.html">
 <link rel="import" href="chrome://resources/polymer/v1_0/iron-icon/iron-icon.html">
@@ -18,7 +14,7 @@
 
 <dom-module id="network-config">
   <template>
-    <style include="network-shared settings-shared action-link iron-flex">
+    <style include="network-shared iron-flex">
       #spinner-container {
         height: 200px;
       }
@@ -189,31 +185,6 @@
           </cr-toggle>
         </div>
       </template>
-
-      <!-- AutoConnect (WiFi) -->
-      <template is="dom-if" if="[[configCanAutoConnect_(type)]]" restamp>
-        <div class="property-box">
-          <div id="autoConnectLabel"
-              class="start">[[i18n('networkAutoConnect')]]</div>
-          <template is="dom-if"
-              if="[[isAutoConnectEnforcedByPolicy_(globalPolicy)]]" restamp>
-            <cr-policy-indicator indicator-type="devicePolicy">
-            </cr-policy-indicator>
-          </template>
-          <cr-toggle id="autoConnect" checked="{{autoConnect_}}"
-              disabled="[[autoConnectDisabled_(globalPolicy)]]"
-              aria-labeledby="autoConnectLabel">
-          </cr-toggle>
-        </div>
-      </template>
-
-      <!-- Hidden Network Warning -->
-      <template is="dom-if" if="{{autoConnect_}}" restamp>
-        <div>
-          <iron-icon icon="cr:warning"></iron-icon>
-          [[i18nAdvanced('hiddenNetworkWarning')]]
-        </div>
-      </template>
     </template>
   </template>
   <script src="network_config.js"></script>
diff --git a/ui/webui/resources/cr_components/chromeos/network/network_config.js b/ui/webui/resources/cr_components/chromeos/network/network_config.js
index 83396a86..2b7bb47a 100644
--- a/ui/webui/resources/cr_components/chromeos/network/network_config.js
+++ b/ui/webui/resources/cr_components/chromeos/network/network_config.js
@@ -181,12 +181,6 @@
     },
 
     /**
-     * Whether the device should automatically connect to the network.
-     * @private
-     */
-    autoConnect_: Boolean,
-
-    /**
      * Security value, used for Ethernet and Wifi and to detect when Security
      * changes.
      * @private
@@ -391,15 +385,6 @@
     } else {
       this.focusFirstInput_();
     }
-
-    if (this.type == CrOnc.Type.VPN ||
-        (this.globalPolicy &&
-         this.globalPolicy.AllowOnlyPolicyNetworksToConnect)) {
-      this.autoConnect_ = false;
-    } else {
-      this.autoConnect_ = true;
-    }
-
     this.onCertificateListsChanged_();
     this.updateIsConfigured_();
     this.setShareNetwork_();
@@ -427,9 +412,12 @@
 
     const propertiesToSet = this.getPropertiesToSet_();
     if (this.getSource_() == CrOnc.Source.NONE) {
-      if (!this.autoConnect_) {
-        // Note: Do not set AutoConnect to true, the connection manager will do
-        // that on a successful connection (unless set to false here).
+      // Set 'AutoConnect' to false for VPN or if prohibited by policy.
+      // Note: Do not set AutoConnect to true, the connection manager will do
+      // that on a successful connection (unless set to false here).
+      if (this.type == CrOnc.Type.VPN ||
+          (this.globalPolicy &&
+           this.globalPolicy.AllowOnlyPolicyNetworksToConnect)) {
         CrOnc.setTypeProperty(propertiesToSet, 'AutoConnect', false);
       }
       this.networkingPrivate.createNetwork(
@@ -1295,32 +1283,6 @@
    * @return {boolean}
    * @private
    */
-  configCanAutoConnect_: function() {
-    // Only WiFi can choose whether or not to autoConnect.
-    return this.type == CrOnc.Type.WI_FI;
-  },
-
-  /**
-   * @return {boolean}
-   * @private
-   */
-  autoConnectDisabled_: function() {
-    return this.isAutoConnectEnforcedByPolicy_();
-  },
-
-  /**
-   * @return {boolean}
-   * @private
-   */
-  isAutoConnectEnforcedByPolicy_: function() {
-    return !!this.globalPolicy &&
-        !!this.globalPolicy.AllowOnlyPolicyNetworksToAutoconnect;
-  },
-
-  /**
-   * @return {boolean}
-   * @private
-   */
   selectedUserCertHashIsValid_: function() {
     return !!this.selectedUserCertHash_ &&
         this.selectedUserCertHash_ != NO_CERTS_HASH;