Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(182)

Side by Side Diff: ui/chromeos/network/network_connect.cc

Issue 1426393003: NOT FOR REVIEW Base URL: https://chromium.googlesource.com/chromium/src.git@submit-4.5-split-wcss
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « extensions/shell/browser/shell_network_controller_chromeos.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 "ui/chromeos/network/network_connect.h" 5 #include "ui/chromeos/network/network_connect.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/strings/string_util.h" 9 #include "base/strings/string_util.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 void NetworkConnectImpl::OnConnectSucceeded(const std::string& service_path) { 242 void NetworkConnectImpl::OnConnectSucceeded(const std::string& service_path) {
243 NET_LOG_USER("Connect Succeeded", service_path); 243 NET_LOG_USER("Connect Succeeded", service_path);
244 network_state_notifier_->RemoveConnectNotification(); 244 network_state_notifier_->RemoveConnectNotification();
245 } 245 }
246 246
247 // If |check_error_state| is true, error state for the network is checked, 247 // If |check_error_state| is true, error state for the network is checked,
248 // otherwise any current error state is ignored (e.g. for recently configured 248 // otherwise any current error state is ignored (e.g. for recently configured
249 // networks or repeat connect attempts). 249 // networks or repeat connect attempts).
250 void NetworkConnectImpl::CallConnectToNetwork(const std::string& service_path, 250 void NetworkConnectImpl::CallConnectToNetwork(const std::string& service_path,
251 bool check_error_state) { 251 bool check_error_state) {
252 LOG(ERROR) << "*** QUICHE: " << __func__;
252 network_state_notifier_->RemoveConnectNotification(); 253 network_state_notifier_->RemoveConnectNotification();
253 NetworkHandler::Get()->network_connection_handler()->ConnectToNetwork( 254 NetworkHandler::Get()->network_connection_handler()->ConnectToNetwork(
254 service_path, base::Bind(&NetworkConnectImpl::OnConnectSucceeded, 255 service_path, base::Bind(&NetworkConnectImpl::OnConnectSucceeded,
255 weak_factory_.GetWeakPtr(), service_path), 256 weak_factory_.GetWeakPtr(), service_path),
256 base::Bind(&NetworkConnectImpl::OnConnectFailed, 257 base::Bind(&NetworkConnectImpl::OnConnectFailed,
257 weak_factory_.GetWeakPtr(), service_path), 258 weak_factory_.GetWeakPtr(), service_path),
258 check_error_state); 259 check_error_state);
259 } 260 }
260 261
261 void NetworkConnectImpl::OnActivateFailed( 262 void NetworkConnectImpl::OnActivateFailed(
(...skipping 12 matching lines...) Expand all
274 void NetworkConnectImpl::OnConfigureFailed( 275 void NetworkConnectImpl::OnConfigureFailed(
275 const std::string& error_name, 276 const std::string& error_name,
276 scoped_ptr<base::DictionaryValue> error_data) { 277 scoped_ptr<base::DictionaryValue> error_data) {
277 NET_LOG_ERROR("Unable to configure network", ""); 278 NET_LOG_ERROR("Unable to configure network", "");
278 network_state_notifier_->ShowNetworkConnectError( 279 network_state_notifier_->ShowNetworkConnectError(
279 NetworkConnectionHandler::kErrorConfigureFailed, ""); 280 NetworkConnectionHandler::kErrorConfigureFailed, "");
280 } 281 }
281 282
282 void NetworkConnectImpl::OnConfigureSucceeded(bool connect_on_configure, 283 void NetworkConnectImpl::OnConfigureSucceeded(bool connect_on_configure,
283 const std::string& service_path) { 284 const std::string& service_path) {
285 LOG(ERROR) << "*** QUICHE: " << __func__;
284 NET_LOG_USER("Configure Succeeded", service_path); 286 NET_LOG_USER("Configure Succeeded", service_path);
285 if (!connect_on_configure) 287 if (!connect_on_configure)
286 return; 288 return;
287 // After configuring a network, ignore any (possibly stale) error state. 289 // After configuring a network, ignore any (possibly stale) error state.
288 const bool check_error_state = false; 290 const bool check_error_state = false;
289 CallConnectToNetwork(service_path, check_error_state); 291 CallConnectToNetwork(service_path, check_error_state);
290 } 292 }
291 293
292 void NetworkConnectImpl::CallCreateConfiguration( 294 void NetworkConnectImpl::CallCreateConfiguration(
293 base::DictionaryValue* shill_properties, 295 base::DictionaryValue* shill_properties,
294 bool shared, 296 bool shared,
295 bool connect_on_configure) { 297 bool connect_on_configure) {
298 LOG(ERROR) << "*** QUICHE: " << __func__;
296 std::string profile_path; 299 std::string profile_path;
297 if (!GetNetworkProfilePath(shared, &profile_path)) { 300 if (!GetNetworkProfilePath(shared, &profile_path)) {
298 network_state_notifier_->ShowNetworkConnectError( 301 network_state_notifier_->ShowNetworkConnectError(
299 NetworkConnectionHandler::kErrorConfigureFailed, ""); 302 NetworkConnectionHandler::kErrorConfigureFailed, "");
300 return; 303 return;
301 } 304 }
302 shill_properties->SetStringWithoutPathExpansion(shill::kProfileProperty, 305 shill_properties->SetStringWithoutPathExpansion(shill::kProfileProperty,
303 profile_path); 306 profile_path);
304 NetworkHandler::Get() 307 NetworkHandler::Get()
305 ->network_configuration_handler() 308 ->network_configuration_handler()
(...skipping 28 matching lines...) Expand all
334 // Remove cleared properties from properties_to_set. 337 // Remove cleared properties from properties_to_set.
335 for (std::vector<std::string>::iterator iter = properties_to_clear->begin(); 338 for (std::vector<std::string>::iterator iter = properties_to_clear->begin();
336 iter != properties_to_clear->end(); ++iter) { 339 iter != properties_to_clear->end(); ++iter) {
337 properties_to_set->RemoveWithoutPathExpansion(*iter, NULL); 340 properties_to_set->RemoveWithoutPathExpansion(*iter, NULL);
338 } 341 }
339 } 342 }
340 343
341 void NetworkConnectImpl::ClearPropertiesAndConnect( 344 void NetworkConnectImpl::ClearPropertiesAndConnect(
342 const std::string& service_path, 345 const std::string& service_path,
343 const std::vector<std::string>& properties_to_clear) { 346 const std::vector<std::string>& properties_to_clear) {
347 LOG(ERROR) << "*** QUICHE: " << __func__;
344 NET_LOG_USER("ClearPropertiesAndConnect", service_path); 348 NET_LOG_USER("ClearPropertiesAndConnect", service_path);
345 // After configuring a network, ignore any (possibly stale) error state. 349 // After configuring a network, ignore any (possibly stale) error state.
346 const bool check_error_state = false; 350 const bool check_error_state = false;
347 NetworkHandler::Get()->network_configuration_handler()->ClearShillProperties( 351 NetworkHandler::Get()->network_configuration_handler()->ClearShillProperties(
348 service_path, properties_to_clear, 352 service_path, properties_to_clear,
349 base::Bind(&NetworkConnectImpl::CallConnectToNetwork, 353 base::Bind(&NetworkConnectImpl::CallConnectToNetwork,
350 weak_factory_.GetWeakPtr(), service_path, check_error_state), 354 weak_factory_.GetWeakPtr(), service_path, check_error_state),
351 base::Bind(&NetworkConnectImpl::SetPropertiesFailed, 355 base::Bind(&NetworkConnectImpl::SetPropertiesFailed,
352 weak_factory_.GetWeakPtr(), "ClearProperties", service_path)); 356 weak_factory_.GetWeakPtr(), "ClearProperties", service_path));
353 } 357 }
354 358
355 void NetworkConnectImpl::ConfigureSetProfileSucceeded( 359 void NetworkConnectImpl::ConfigureSetProfileSucceeded(
356 const std::string& service_path, 360 const std::string& service_path,
357 scoped_ptr<base::DictionaryValue> properties_to_set) { 361 scoped_ptr<base::DictionaryValue> properties_to_set) {
358 std::vector<std::string> properties_to_clear; 362 std::vector<std::string> properties_to_clear;
359 SetPropertiesToClear(properties_to_set.get(), &properties_to_clear); 363 SetPropertiesToClear(properties_to_set.get(), &properties_to_clear);
360 NetworkHandler::Get()->network_configuration_handler()->SetShillProperties( 364 NetworkHandler::Get()->network_configuration_handler()->SetShillProperties(
361 service_path, *properties_to_set, 365 service_path, *properties_to_set,
362 NetworkConfigurationObserver::SOURCE_USER_ACTION, 366 NetworkConfigurationObserver::SOURCE_USER_ACTION,
363 base::Bind(&NetworkConnectImpl::ClearPropertiesAndConnect, 367 base::Bind(&NetworkConnectImpl::ClearPropertiesAndConnect,
364 weak_factory_.GetWeakPtr(), service_path, properties_to_clear), 368 weak_factory_.GetWeakPtr(), service_path, properties_to_clear),
365 base::Bind(&NetworkConnectImpl::SetPropertiesFailed, 369 base::Bind(&NetworkConnectImpl::SetPropertiesFailed,
366 weak_factory_.GetWeakPtr(), "SetProperties", service_path)); 370 weak_factory_.GetWeakPtr(), "SetProperties", service_path));
367 } 371 }
368 372
369 // Public methods 373 // Public methods
370 374
371 void NetworkConnectImpl::ConnectToNetwork(const std::string& service_path) { 375 void NetworkConnectImpl::ConnectToNetwork(const std::string& service_path) {
376 LOG(ERROR) << "*** QUICHE: " << __func__;
372 NET_LOG_USER("ConnectToNetwork", service_path); 377 NET_LOG_USER("ConnectToNetwork", service_path);
373 const NetworkState* network = GetNetworkState(service_path); 378 const NetworkState* network = GetNetworkState(service_path);
374 if (network) { 379 if (network) {
375 if (!network->error().empty() && !network->security_class().empty()) { 380 if (!network->error().empty() && !network->security_class().empty()) {
376 NET_LOG_USER("Configure: " + network->error(), service_path); 381 NET_LOG_USER("Configure: " + network->error(), service_path);
377 // If the network is in an error state, show the configuration UI 382 // If the network is in an error state, show the configuration UI
378 // directly to avoid a spurious notification. 383 // directly to avoid a spurious notification.
379 HandleUnconfiguredNetwork(service_path); 384 HandleUnconfiguredNetwork(service_path);
380 return; 385 return;
381 } else if (network->RequiresActivation()) { 386 } else if (network->RequiresActivation()) {
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
484 network_state_notifier_->ShowMobileActivationError(service_path); 489 network_state_notifier_->ShowMobileActivationError(service_path);
485 return; 490 return;
486 } 491 }
487 delegate_->ShowMobileSetupDialog(service_path); 492 delegate_->ShowMobileSetupDialog(service_path);
488 } 493 }
489 494
490 void NetworkConnectImpl::ConfigureNetworkAndConnect( 495 void NetworkConnectImpl::ConfigureNetworkAndConnect(
491 const std::string& service_path, 496 const std::string& service_path,
492 const base::DictionaryValue& properties, 497 const base::DictionaryValue& properties,
493 bool shared) { 498 bool shared) {
499 LOG(ERROR) << "*** QUICHE: " << __func__;
494 NET_LOG_USER("ConfigureNetworkAndConnect", service_path); 500 NET_LOG_USER("ConfigureNetworkAndConnect", service_path);
495 501
496 scoped_ptr<base::DictionaryValue> properties_to_set(properties.DeepCopy()); 502 scoped_ptr<base::DictionaryValue> properties_to_set(properties.DeepCopy());
497 503
498 std::string profile_path; 504 std::string profile_path;
499 if (!GetNetworkProfilePath(shared, &profile_path)) { 505 if (!GetNetworkProfilePath(shared, &profile_path)) {
500 network_state_notifier_->ShowNetworkConnectError( 506 network_state_notifier_->ShowNetworkConnectError(
501 NetworkConnectionHandler::kErrorConfigureFailed, service_path); 507 NetworkConnectionHandler::kErrorConfigureFailed, service_path);
502 return; 508 return;
503 } 509 }
510 LOG(ERROR) << "*** QUICHE: " << __func__;
504 NetworkHandler::Get()->network_configuration_handler()->SetNetworkProfile( 511 NetworkHandler::Get()->network_configuration_handler()->SetNetworkProfile(
505 service_path, profile_path, 512 service_path, profile_path,
506 NetworkConfigurationObserver::SOURCE_USER_ACTION, 513 NetworkConfigurationObserver::SOURCE_USER_ACTION,
507 base::Bind(&NetworkConnectImpl::ConfigureSetProfileSucceeded, 514 base::Bind(&NetworkConnectImpl::ConfigureSetProfileSucceeded,
508 weak_factory_.GetWeakPtr(), service_path, 515 weak_factory_.GetWeakPtr(), service_path,
509 base::Passed(&properties_to_set)), 516 base::Passed(&properties_to_set)),
510 base::Bind(&NetworkConnectImpl::SetPropertiesFailed, 517 base::Bind(&NetworkConnectImpl::SetPropertiesFailed,
511 weak_factory_.GetWeakPtr(), "SetProfile: " + profile_path, 518 weak_factory_.GetWeakPtr(), "SetProfile: " + profile_path,
512 service_path)); 519 service_path));
513 } 520 }
514 521
515 void NetworkConnectImpl::CreateConfigurationAndConnect( 522 void NetworkConnectImpl::CreateConfigurationAndConnect(
516 base::DictionaryValue* properties, 523 base::DictionaryValue* properties,
517 bool shared) { 524 bool shared) {
525 LOG(ERROR) << "*** QUICHE: " << __func__;
518 NET_LOG_USER("CreateConfigurationAndConnect", ""); 526 NET_LOG_USER("CreateConfigurationAndConnect", "");
519 CallCreateConfiguration(properties, shared, true /* connect_on_configure */); 527 CallCreateConfiguration(properties, shared, true /* connect_on_configure */);
520 } 528 }
521 529
522 void NetworkConnectImpl::CreateConfiguration(base::DictionaryValue* properties, 530 void NetworkConnectImpl::CreateConfiguration(base::DictionaryValue* properties,
523 bool shared) { 531 bool shared) {
532 LOG(ERROR) << "*** QUICHE: " << __func__;
524 NET_LOG_USER("CreateConfiguration", ""); 533 NET_LOG_USER("CreateConfiguration", "");
525 CallCreateConfiguration(properties, shared, false /* connect_on_configure */); 534 CallCreateConfiguration(properties, shared, false /* connect_on_configure */);
526 } 535 }
527 536
528 base::string16 NetworkConnectImpl::GetShillErrorString( 537 base::string16 NetworkConnectImpl::GetShillErrorString(
529 const std::string& error, 538 const std::string& error,
530 const std::string& service_path) { 539 const std::string& service_path) {
531 if (error.empty()) 540 if (error.empty())
532 return base::string16(); 541 return base::string16();
533 if (error == shill::kErrorOutOfRange) 542 if (error == shill::kErrorOutOfRange)
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
637 return g_network_connect; 646 return g_network_connect;
638 } 647 }
639 648
640 NetworkConnect::NetworkConnect() { 649 NetworkConnect::NetworkConnect() {
641 } 650 }
642 651
643 NetworkConnect::~NetworkConnect() { 652 NetworkConnect::~NetworkConnect() {
644 } 653 }
645 654
646 } // namespace ui 655 } // namespace ui
OLDNEW
« no previous file with comments | « extensions/shell/browser/shell_network_controller_chromeos.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698