| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/chromeos/options/wifi_config_view.h" | 5 #include "chrome/browser/chromeos/options/wifi_config_view.h" |
| 6 | 6 |
| 7 #include "ash/system/chromeos/network/network_connect.h" | 7 #include "ash/system/chromeos/network/network_connect.h" |
| 8 #include "base/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
| 9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 | 99 |
| 100 namespace internal { | 100 namespace internal { |
| 101 | 101 |
| 102 class SecurityComboboxModel : public ui::ComboboxModel { | 102 class SecurityComboboxModel : public ui::ComboboxModel { |
| 103 public: | 103 public: |
| 104 SecurityComboboxModel(); | 104 SecurityComboboxModel(); |
| 105 virtual ~SecurityComboboxModel(); | 105 virtual ~SecurityComboboxModel(); |
| 106 | 106 |
| 107 // Overridden from ui::ComboboxModel: | 107 // Overridden from ui::ComboboxModel: |
| 108 virtual int GetItemCount() const OVERRIDE; | 108 virtual int GetItemCount() const OVERRIDE; |
| 109 virtual string16 GetItemAt(int index) OVERRIDE; | 109 virtual base::string16 GetItemAt(int index) OVERRIDE; |
| 110 | 110 |
| 111 private: | 111 private: |
| 112 DISALLOW_COPY_AND_ASSIGN(SecurityComboboxModel); | 112 DISALLOW_COPY_AND_ASSIGN(SecurityComboboxModel); |
| 113 }; | 113 }; |
| 114 | 114 |
| 115 class EAPMethodComboboxModel : public ui::ComboboxModel { | 115 class EAPMethodComboboxModel : public ui::ComboboxModel { |
| 116 public: | 116 public: |
| 117 EAPMethodComboboxModel(); | 117 EAPMethodComboboxModel(); |
| 118 virtual ~EAPMethodComboboxModel(); | 118 virtual ~EAPMethodComboboxModel(); |
| 119 | 119 |
| 120 // Overridden from ui::ComboboxModel: | 120 // Overridden from ui::ComboboxModel: |
| 121 virtual int GetItemCount() const OVERRIDE; | 121 virtual int GetItemCount() const OVERRIDE; |
| 122 virtual string16 GetItemAt(int index) OVERRIDE; | 122 virtual base::string16 GetItemAt(int index) OVERRIDE; |
| 123 | 123 |
| 124 private: | 124 private: |
| 125 DISALLOW_COPY_AND_ASSIGN(EAPMethodComboboxModel); | 125 DISALLOW_COPY_AND_ASSIGN(EAPMethodComboboxModel); |
| 126 }; | 126 }; |
| 127 | 127 |
| 128 class Phase2AuthComboboxModel : public ui::ComboboxModel { | 128 class Phase2AuthComboboxModel : public ui::ComboboxModel { |
| 129 public: | 129 public: |
| 130 explicit Phase2AuthComboboxModel(views::Combobox* eap_method_combobox); | 130 explicit Phase2AuthComboboxModel(views::Combobox* eap_method_combobox); |
| 131 virtual ~Phase2AuthComboboxModel(); | 131 virtual ~Phase2AuthComboboxModel(); |
| 132 | 132 |
| 133 // Overridden from ui::ComboboxModel: | 133 // Overridden from ui::ComboboxModel: |
| 134 virtual int GetItemCount() const OVERRIDE; | 134 virtual int GetItemCount() const OVERRIDE; |
| 135 virtual string16 GetItemAt(int index) OVERRIDE; | 135 virtual base::string16 GetItemAt(int index) OVERRIDE; |
| 136 | 136 |
| 137 private: | 137 private: |
| 138 views::Combobox* eap_method_combobox_; | 138 views::Combobox* eap_method_combobox_; |
| 139 | 139 |
| 140 DISALLOW_COPY_AND_ASSIGN(Phase2AuthComboboxModel); | 140 DISALLOW_COPY_AND_ASSIGN(Phase2AuthComboboxModel); |
| 141 }; | 141 }; |
| 142 | 142 |
| 143 class ServerCACertComboboxModel : public ui::ComboboxModel { | 143 class ServerCACertComboboxModel : public ui::ComboboxModel { |
| 144 public: | 144 public: |
| 145 ServerCACertComboboxModel(); | 145 ServerCACertComboboxModel(); |
| 146 virtual ~ServerCACertComboboxModel(); | 146 virtual ~ServerCACertComboboxModel(); |
| 147 | 147 |
| 148 // Overridden from ui::ComboboxModel: | 148 // Overridden from ui::ComboboxModel: |
| 149 virtual int GetItemCount() const OVERRIDE; | 149 virtual int GetItemCount() const OVERRIDE; |
| 150 virtual string16 GetItemAt(int index) OVERRIDE; | 150 virtual base::string16 GetItemAt(int index) OVERRIDE; |
| 151 | 151 |
| 152 private: | 152 private: |
| 153 DISALLOW_COPY_AND_ASSIGN(ServerCACertComboboxModel); | 153 DISALLOW_COPY_AND_ASSIGN(ServerCACertComboboxModel); |
| 154 }; | 154 }; |
| 155 | 155 |
| 156 class UserCertComboboxModel : public ui::ComboboxModel { | 156 class UserCertComboboxModel : public ui::ComboboxModel { |
| 157 public: | 157 public: |
| 158 explicit UserCertComboboxModel(WifiConfigView* owner); | 158 explicit UserCertComboboxModel(WifiConfigView* owner); |
| 159 virtual ~UserCertComboboxModel(); | 159 virtual ~UserCertComboboxModel(); |
| 160 | 160 |
| 161 // Overridden from ui::ComboboxModel: | 161 // Overridden from ui::ComboboxModel: |
| 162 virtual int GetItemCount() const OVERRIDE; | 162 virtual int GetItemCount() const OVERRIDE; |
| 163 virtual string16 GetItemAt(int index) OVERRIDE; | 163 virtual base::string16 GetItemAt(int index) OVERRIDE; |
| 164 | 164 |
| 165 private: | 165 private: |
| 166 WifiConfigView* owner_; | 166 WifiConfigView* owner_; |
| 167 | 167 |
| 168 DISALLOW_COPY_AND_ASSIGN(UserCertComboboxModel); | 168 DISALLOW_COPY_AND_ASSIGN(UserCertComboboxModel); |
| 169 }; | 169 }; |
| 170 | 170 |
| 171 // SecurityComboboxModel ------------------------------------------------------- | 171 // SecurityComboboxModel ------------------------------------------------------- |
| 172 | 172 |
| 173 SecurityComboboxModel::SecurityComboboxModel() { | 173 SecurityComboboxModel::SecurityComboboxModel() { |
| 174 } | 174 } |
| 175 | 175 |
| 176 SecurityComboboxModel::~SecurityComboboxModel() { | 176 SecurityComboboxModel::~SecurityComboboxModel() { |
| 177 } | 177 } |
| 178 | 178 |
| 179 int SecurityComboboxModel::GetItemCount() const { | 179 int SecurityComboboxModel::GetItemCount() const { |
| 180 return SECURITY_INDEX_COUNT; | 180 return SECURITY_INDEX_COUNT; |
| 181 } | 181 } |
| 182 string16 SecurityComboboxModel::GetItemAt(int index) { | 182 base::string16 SecurityComboboxModel::GetItemAt(int index) { |
| 183 if (index == SECURITY_INDEX_NONE) | 183 if (index == SECURITY_INDEX_NONE) |
| 184 return l10n_util::GetStringUTF16( | 184 return l10n_util::GetStringUTF16( |
| 185 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_SECURITY_NONE); | 185 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_SECURITY_NONE); |
| 186 else if (index == SECURITY_INDEX_WEP) | 186 else if (index == SECURITY_INDEX_WEP) |
| 187 return l10n_util::GetStringUTF16( | 187 return l10n_util::GetStringUTF16( |
| 188 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_SECURITY_WEP); | 188 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_SECURITY_WEP); |
| 189 else if (index == SECURITY_INDEX_PSK) | 189 else if (index == SECURITY_INDEX_PSK) |
| 190 return l10n_util::GetStringUTF16( | 190 return l10n_util::GetStringUTF16( |
| 191 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_SECURITY_PSK); | 191 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_SECURITY_PSK); |
| 192 NOTREACHED(); | 192 NOTREACHED(); |
| 193 return string16(); | 193 return base::string16(); |
| 194 } | 194 } |
| 195 | 195 |
| 196 // EAPMethodComboboxModel ------------------------------------------------------ | 196 // EAPMethodComboboxModel ------------------------------------------------------ |
| 197 | 197 |
| 198 EAPMethodComboboxModel::EAPMethodComboboxModel() { | 198 EAPMethodComboboxModel::EAPMethodComboboxModel() { |
| 199 } | 199 } |
| 200 | 200 |
| 201 EAPMethodComboboxModel::~EAPMethodComboboxModel() { | 201 EAPMethodComboboxModel::~EAPMethodComboboxModel() { |
| 202 } | 202 } |
| 203 | 203 |
| 204 int EAPMethodComboboxModel::GetItemCount() const { | 204 int EAPMethodComboboxModel::GetItemCount() const { |
| 205 return EAP_METHOD_INDEX_COUNT; | 205 return EAP_METHOD_INDEX_COUNT; |
| 206 } | 206 } |
| 207 string16 EAPMethodComboboxModel::GetItemAt(int index) { | 207 base::string16 EAPMethodComboboxModel::GetItemAt(int index) { |
| 208 if (index == EAP_METHOD_INDEX_NONE) | 208 if (index == EAP_METHOD_INDEX_NONE) |
| 209 return l10n_util::GetStringUTF16( | 209 return l10n_util::GetStringUTF16( |
| 210 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_EAP_METHOD_NONE); | 210 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_EAP_METHOD_NONE); |
| 211 else if (index == EAP_METHOD_INDEX_LEAP) | 211 else if (index == EAP_METHOD_INDEX_LEAP) |
| 212 return l10n_util::GetStringUTF16( | 212 return l10n_util::GetStringUTF16( |
| 213 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_EAP_METHOD_LEAP); | 213 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_EAP_METHOD_LEAP); |
| 214 else if (index == EAP_METHOD_INDEX_PEAP) | 214 else if (index == EAP_METHOD_INDEX_PEAP) |
| 215 return l10n_util::GetStringUTF16( | 215 return l10n_util::GetStringUTF16( |
| 216 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_EAP_METHOD_PEAP); | 216 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_EAP_METHOD_PEAP); |
| 217 else if (index == EAP_METHOD_INDEX_TLS) | 217 else if (index == EAP_METHOD_INDEX_TLS) |
| 218 return l10n_util::GetStringUTF16( | 218 return l10n_util::GetStringUTF16( |
| 219 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_EAP_METHOD_TLS); | 219 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_EAP_METHOD_TLS); |
| 220 else if (index == EAP_METHOD_INDEX_TTLS) | 220 else if (index == EAP_METHOD_INDEX_TTLS) |
| 221 return l10n_util::GetStringUTF16( | 221 return l10n_util::GetStringUTF16( |
| 222 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_EAP_METHOD_TTLS); | 222 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_EAP_METHOD_TTLS); |
| 223 NOTREACHED(); | 223 NOTREACHED(); |
| 224 return string16(); | 224 return base::string16(); |
| 225 } | 225 } |
| 226 | 226 |
| 227 // Phase2AuthComboboxModel ----------------------------------------------------- | 227 // Phase2AuthComboboxModel ----------------------------------------------------- |
| 228 | 228 |
| 229 Phase2AuthComboboxModel::Phase2AuthComboboxModel( | 229 Phase2AuthComboboxModel::Phase2AuthComboboxModel( |
| 230 views::Combobox* eap_method_combobox) | 230 views::Combobox* eap_method_combobox) |
| 231 : eap_method_combobox_(eap_method_combobox) { | 231 : eap_method_combobox_(eap_method_combobox) { |
| 232 } | 232 } |
| 233 | 233 |
| 234 Phase2AuthComboboxModel::~Phase2AuthComboboxModel() { | 234 Phase2AuthComboboxModel::~Phase2AuthComboboxModel() { |
| 235 } | 235 } |
| 236 | 236 |
| 237 int Phase2AuthComboboxModel::GetItemCount() const { | 237 int Phase2AuthComboboxModel::GetItemCount() const { |
| 238 switch (eap_method_combobox_->selected_index()) { | 238 switch (eap_method_combobox_->selected_index()) { |
| 239 case EAP_METHOD_INDEX_NONE: | 239 case EAP_METHOD_INDEX_NONE: |
| 240 case EAP_METHOD_INDEX_TLS: | 240 case EAP_METHOD_INDEX_TLS: |
| 241 case EAP_METHOD_INDEX_LEAP: | 241 case EAP_METHOD_INDEX_LEAP: |
| 242 return PHASE_2_AUTH_INDEX_AUTO + 1; | 242 return PHASE_2_AUTH_INDEX_AUTO + 1; |
| 243 case EAP_METHOD_INDEX_PEAP: | 243 case EAP_METHOD_INDEX_PEAP: |
| 244 return PHASE_2_AUTH_INDEX_MSCHAPV2 + 1; | 244 return PHASE_2_AUTH_INDEX_MSCHAPV2 + 1; |
| 245 case EAP_METHOD_INDEX_TTLS: | 245 case EAP_METHOD_INDEX_TTLS: |
| 246 return PHASE_2_AUTH_INDEX_CHAP + 1; | 246 return PHASE_2_AUTH_INDEX_CHAP + 1; |
| 247 } | 247 } |
| 248 NOTREACHED(); | 248 NOTREACHED(); |
| 249 return 0; | 249 return 0; |
| 250 } | 250 } |
| 251 | 251 |
| 252 string16 Phase2AuthComboboxModel::GetItemAt(int index) { | 252 base::string16 Phase2AuthComboboxModel::GetItemAt(int index) { |
| 253 if (index == PHASE_2_AUTH_INDEX_AUTO) | 253 if (index == PHASE_2_AUTH_INDEX_AUTO) |
| 254 return l10n_util::GetStringUTF16( | 254 return l10n_util::GetStringUTF16( |
| 255 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_PHASE_2_AUTH_AUTO); | 255 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_PHASE_2_AUTH_AUTO); |
| 256 else if (index == PHASE_2_AUTH_INDEX_MD5) | 256 else if (index == PHASE_2_AUTH_INDEX_MD5) |
| 257 return l10n_util::GetStringUTF16( | 257 return l10n_util::GetStringUTF16( |
| 258 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_PHASE_2_AUTH_MD5); | 258 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_PHASE_2_AUTH_MD5); |
| 259 else if (index == PHASE_2_AUTH_INDEX_MSCHAPV2) | 259 else if (index == PHASE_2_AUTH_INDEX_MSCHAPV2) |
| 260 return l10n_util::GetStringUTF16( | 260 return l10n_util::GetStringUTF16( |
| 261 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_PHASE_2_AUTH_MSCHAPV2); | 261 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_PHASE_2_AUTH_MSCHAPV2); |
| 262 else if (index == PHASE_2_AUTH_INDEX_MSCHAP) | 262 else if (index == PHASE_2_AUTH_INDEX_MSCHAP) |
| 263 return l10n_util::GetStringUTF16( | 263 return l10n_util::GetStringUTF16( |
| 264 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_PHASE_2_AUTH_MSCHAP); | 264 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_PHASE_2_AUTH_MSCHAP); |
| 265 else if (index == PHASE_2_AUTH_INDEX_PAP) | 265 else if (index == PHASE_2_AUTH_INDEX_PAP) |
| 266 return l10n_util::GetStringUTF16( | 266 return l10n_util::GetStringUTF16( |
| 267 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_PHASE_2_AUTH_PAP); | 267 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_PHASE_2_AUTH_PAP); |
| 268 else if (index == PHASE_2_AUTH_INDEX_CHAP) | 268 else if (index == PHASE_2_AUTH_INDEX_CHAP) |
| 269 return l10n_util::GetStringUTF16( | 269 return l10n_util::GetStringUTF16( |
| 270 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_PHASE_2_AUTH_CHAP); | 270 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_PHASE_2_AUTH_CHAP); |
| 271 NOTREACHED(); | 271 NOTREACHED(); |
| 272 return string16(); | 272 return base::string16(); |
| 273 } | 273 } |
| 274 | 274 |
| 275 // ServerCACertComboboxModel --------------------------------------------------- | 275 // ServerCACertComboboxModel --------------------------------------------------- |
| 276 | 276 |
| 277 ServerCACertComboboxModel::ServerCACertComboboxModel() { | 277 ServerCACertComboboxModel::ServerCACertComboboxModel() { |
| 278 } | 278 } |
| 279 | 279 |
| 280 ServerCACertComboboxModel::~ServerCACertComboboxModel() { | 280 ServerCACertComboboxModel::~ServerCACertComboboxModel() { |
| 281 } | 281 } |
| 282 | 282 |
| 283 int ServerCACertComboboxModel::GetItemCount() const { | 283 int ServerCACertComboboxModel::GetItemCount() const { |
| 284 if (CertLibrary::Get()->CertificatesLoading()) | 284 if (CertLibrary::Get()->CertificatesLoading()) |
| 285 return 1; // "Loading" | 285 return 1; // "Loading" |
| 286 // First "Default", then the certs, then "Do not check". | 286 // First "Default", then the certs, then "Do not check". |
| 287 return CertLibrary::Get()->NumCertificates( | 287 return CertLibrary::Get()->NumCertificates( |
| 288 CertLibrary::CERT_TYPE_SERVER_CA) + 2; | 288 CertLibrary::CERT_TYPE_SERVER_CA) + 2; |
| 289 } | 289 } |
| 290 | 290 |
| 291 string16 ServerCACertComboboxModel::GetItemAt(int index) { | 291 base::string16 ServerCACertComboboxModel::GetItemAt(int index) { |
| 292 if (CertLibrary::Get()->CertificatesLoading()) | 292 if (CertLibrary::Get()->CertificatesLoading()) |
| 293 return l10n_util::GetStringUTF16( | 293 return l10n_util::GetStringUTF16( |
| 294 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_CERT_LOADING); | 294 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_CERT_LOADING); |
| 295 if (index == 0) | 295 if (index == 0) |
| 296 return l10n_util::GetStringUTF16( | 296 return l10n_util::GetStringUTF16( |
| 297 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_CERT_SERVER_CA_DEFAULT); | 297 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_CERT_SERVER_CA_DEFAULT); |
| 298 if (index == GetItemCount() - 1) | 298 if (index == GetItemCount() - 1) |
| 299 return l10n_util::GetStringUTF16( | 299 return l10n_util::GetStringUTF16( |
| 300 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_CERT_SERVER_CA_DO_NOT_CHECK); | 300 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_CERT_SERVER_CA_DO_NOT_CHECK); |
| 301 int cert_index = index - 1; | 301 int cert_index = index - 1; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 317 return 0; | 317 return 0; |
| 318 if (CertLibrary::Get()->CertificatesLoading()) | 318 if (CertLibrary::Get()->CertificatesLoading()) |
| 319 return 1; // "Loading" | 319 return 1; // "Loading" |
| 320 int num_certs = | 320 int num_certs = |
| 321 CertLibrary::Get()->NumCertificates(CertLibrary::CERT_TYPE_USER); | 321 CertLibrary::Get()->NumCertificates(CertLibrary::CERT_TYPE_USER); |
| 322 if (num_certs == 0) | 322 if (num_certs == 0) |
| 323 return 1; // "None installed" | 323 return 1; // "None installed" |
| 324 return num_certs; | 324 return num_certs; |
| 325 } | 325 } |
| 326 | 326 |
| 327 string16 UserCertComboboxModel::GetItemAt(int index) { | 327 base::string16 UserCertComboboxModel::GetItemAt(int index) { |
| 328 if (!owner_->UserCertActive()) | 328 if (!owner_->UserCertActive()) |
| 329 return string16(); | 329 return base::string16(); |
| 330 if (CertLibrary::Get()->CertificatesLoading()) | 330 if (CertLibrary::Get()->CertificatesLoading()) |
| 331 return l10n_util::GetStringUTF16( | 331 return l10n_util::GetStringUTF16( |
| 332 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_CERT_LOADING); | 332 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_CERT_LOADING); |
| 333 if (CertLibrary::Get()->NumCertificates(CertLibrary::CERT_TYPE_USER) == 0) | 333 if (CertLibrary::Get()->NumCertificates(CertLibrary::CERT_TYPE_USER) == 0) |
| 334 return l10n_util::GetStringUTF16( | 334 return l10n_util::GetStringUTF16( |
| 335 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_USER_CERT_NONE_INSTALLED); | 335 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_USER_CERT_NONE_INSTALLED); |
| 336 return CertLibrary::Get()->GetCertDisplayStringAt( | 336 return CertLibrary::Get()->GetCertDisplayStringAt( |
| 337 CertLibrary::CERT_TYPE_USER, index); | 337 CertLibrary::CERT_TYPE_USER, index); |
| 338 } | 338 } |
| 339 | 339 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 372 | 372 |
| 373 WifiConfigView::~WifiConfigView() { | 373 WifiConfigView::~WifiConfigView() { |
| 374 RemoveAllChildViews(true); // Destroy children before models | 374 RemoveAllChildViews(true); // Destroy children before models |
| 375 if (NetworkHandler::IsInitialized()) { | 375 if (NetworkHandler::IsInitialized()) { |
| 376 NetworkHandler::Get()->network_state_handler()->RemoveObserver( | 376 NetworkHandler::Get()->network_state_handler()->RemoveObserver( |
| 377 this, FROM_HERE); | 377 this, FROM_HERE); |
| 378 } | 378 } |
| 379 CertLibrary::Get()->RemoveObserver(this); | 379 CertLibrary::Get()->RemoveObserver(this); |
| 380 } | 380 } |
| 381 | 381 |
| 382 string16 WifiConfigView::GetTitle() const { | 382 base::string16 WifiConfigView::GetTitle() const { |
| 383 return l10n_util::GetStringUTF16(IDS_OPTIONS_SETTINGS_JOIN_WIFI_NETWORKS); | 383 return l10n_util::GetStringUTF16(IDS_OPTIONS_SETTINGS_JOIN_WIFI_NETWORKS); |
| 384 } | 384 } |
| 385 | 385 |
| 386 views::View* WifiConfigView::GetInitiallyFocusedView() { | 386 views::View* WifiConfigView::GetInitiallyFocusedView() { |
| 387 // Return a reasonable widget for initial focus, | 387 // Return a reasonable widget for initial focus, |
| 388 // depending on what we're showing. | 388 // depending on what we're showing. |
| 389 if (ssid_textfield_) | 389 if (ssid_textfield_) |
| 390 return ssid_textfield_; | 390 return ssid_textfield_; |
| 391 else if (eap_method_combobox_) | 391 else if (eap_method_combobox_) |
| 392 return eap_method_combobox_; | 392 return eap_method_combobox_; |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 490 phase_2_auth_combobox_->SetEnabled(phase_2_auth_enabled && | 490 phase_2_auth_combobox_->SetEnabled(phase_2_auth_enabled && |
| 491 phase_2_auth_ui_data_.IsEditable()); | 491 phase_2_auth_ui_data_.IsEditable()); |
| 492 phase_2_auth_label_->SetEnabled(phase_2_auth_enabled); | 492 phase_2_auth_label_->SetEnabled(phase_2_auth_enabled); |
| 493 | 493 |
| 494 // Passphrase. | 494 // Passphrase. |
| 495 bool passphrase_enabled = PassphraseActive(); | 495 bool passphrase_enabled = PassphraseActive(); |
| 496 passphrase_textfield_->SetEnabled(passphrase_enabled && | 496 passphrase_textfield_->SetEnabled(passphrase_enabled && |
| 497 passphrase_ui_data_.IsEditable()); | 497 passphrase_ui_data_.IsEditable()); |
| 498 passphrase_label_->SetEnabled(passphrase_enabled); | 498 passphrase_label_->SetEnabled(passphrase_enabled); |
| 499 if (!passphrase_enabled) | 499 if (!passphrase_enabled) |
| 500 passphrase_textfield_->SetText(string16()); | 500 passphrase_textfield_->SetText(base::string16()); |
| 501 | 501 |
| 502 // User cert. | 502 // User cert. |
| 503 bool certs_loading = CertLibrary::Get()->CertificatesLoading(); | 503 bool certs_loading = CertLibrary::Get()->CertificatesLoading(); |
| 504 bool user_cert_enabled = UserCertActive(); | 504 bool user_cert_enabled = UserCertActive(); |
| 505 user_cert_label_->SetEnabled(user_cert_enabled); | 505 user_cert_label_->SetEnabled(user_cert_enabled); |
| 506 bool have_user_certs = !certs_loading && HaveUserCerts(); | 506 bool have_user_certs = !certs_loading && HaveUserCerts(); |
| 507 user_cert_combobox_->SetEnabled(user_cert_enabled && | 507 user_cert_combobox_->SetEnabled(user_cert_enabled && |
| 508 have_user_certs && | 508 have_user_certs && |
| 509 user_cert_ui_data_.IsEditable()); | 509 user_cert_ui_data_.IsEditable()); |
| 510 user_cert_combobox_->ModelChanged(); | 510 user_cert_combobox_->ModelChanged(); |
| 511 user_cert_combobox_->SetSelectedIndex(0); | 511 user_cert_combobox_->SetSelectedIndex(0); |
| 512 | 512 |
| 513 // Server CA. | 513 // Server CA. |
| 514 bool ca_cert_enabled = CaCertActive(); | 514 bool ca_cert_enabled = CaCertActive(); |
| 515 server_ca_cert_label_->SetEnabled(ca_cert_enabled); | 515 server_ca_cert_label_->SetEnabled(ca_cert_enabled); |
| 516 server_ca_cert_combobox_->SetEnabled(ca_cert_enabled && | 516 server_ca_cert_combobox_->SetEnabled(ca_cert_enabled && |
| 517 !certs_loading && | 517 !certs_loading && |
| 518 server_ca_cert_ui_data_.IsEditable()); | 518 server_ca_cert_ui_data_.IsEditable()); |
| 519 server_ca_cert_combobox_->ModelChanged(); | 519 server_ca_cert_combobox_->ModelChanged(); |
| 520 server_ca_cert_combobox_->SetSelectedIndex(0); | 520 server_ca_cert_combobox_->SetSelectedIndex(0); |
| 521 | 521 |
| 522 // Subject Match | 522 // Subject Match |
| 523 bool subject_match_enabled = | 523 bool subject_match_enabled = |
| 524 ca_cert_enabled && eap_method_combobox_ && | 524 ca_cert_enabled && eap_method_combobox_ && |
| 525 eap_method_combobox_->selected_index() == EAP_METHOD_INDEX_TLS; | 525 eap_method_combobox_->selected_index() == EAP_METHOD_INDEX_TLS; |
| 526 subject_match_label_->SetEnabled(subject_match_enabled); | 526 subject_match_label_->SetEnabled(subject_match_enabled); |
| 527 subject_match_textfield_->SetEnabled(subject_match_enabled); | 527 subject_match_textfield_->SetEnabled(subject_match_enabled); |
| 528 if (!subject_match_enabled) | 528 if (!subject_match_enabled) |
| 529 subject_match_textfield_->SetText(string16()); | 529 subject_match_textfield_->SetText(base::string16()); |
| 530 | 530 |
| 531 // No anonymous identity if no phase 2 auth. | 531 // No anonymous identity if no phase 2 auth. |
| 532 bool identity_anonymous_enabled = phase_2_auth_enabled; | 532 bool identity_anonymous_enabled = phase_2_auth_enabled; |
| 533 identity_anonymous_textfield_->SetEnabled( | 533 identity_anonymous_textfield_->SetEnabled( |
| 534 identity_anonymous_enabled && identity_anonymous_ui_data_.IsEditable()); | 534 identity_anonymous_enabled && identity_anonymous_ui_data_.IsEditable()); |
| 535 identity_anonymous_label_->SetEnabled(identity_anonymous_enabled); | 535 identity_anonymous_label_->SetEnabled(identity_anonymous_enabled); |
| 536 if (!identity_anonymous_enabled) | 536 if (!identity_anonymous_enabled) |
| 537 identity_anonymous_textfield_->SetText(string16()); | 537 identity_anonymous_textfield_->SetText(base::string16()); |
| 538 | 538 |
| 539 RefreshShareCheckbox(); | 539 RefreshShareCheckbox(); |
| 540 } | 540 } |
| 541 | 541 |
| 542 void WifiConfigView::RefreshShareCheckbox() { | 542 void WifiConfigView::RefreshShareCheckbox() { |
| 543 if (!share_network_checkbox_) | 543 if (!share_network_checkbox_) |
| 544 return; | 544 return; |
| 545 | 545 |
| 546 if (security_combobox_ && | 546 if (security_combobox_ && |
| 547 security_combobox_->selected_index() == SECURITY_INDEX_NONE) { | 547 security_combobox_->selected_index() == SECURITY_INDEX_NONE) { |
| (...skipping 794 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1342 void WifiConfigView::ParseWiFiEAPUIProperty( | 1342 void WifiConfigView::ParseWiFiEAPUIProperty( |
| 1343 NetworkPropertyUIData* property_ui_data, | 1343 NetworkPropertyUIData* property_ui_data, |
| 1344 const NetworkState* network, | 1344 const NetworkState* network, |
| 1345 const std::string& key) { | 1345 const std::string& key) { |
| 1346 ParseWiFiUIProperty( | 1346 ParseWiFiUIProperty( |
| 1347 property_ui_data, network, | 1347 property_ui_data, network, |
| 1348 base::StringPrintf("%s.%s", ::onc::wifi::kEAP, key.c_str())); | 1348 base::StringPrintf("%s.%s", ::onc::wifi::kEAP, key.c_str())); |
| 1349 } | 1349 } |
| 1350 | 1350 |
| 1351 } // namespace chromeos | 1351 } // namespace chromeos |
| OLD | NEW |