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

Side by Side Diff: chrome/browser/ui/webui/options2/chromeos/internet_options_handler2.cc

Issue 10407069: Fixed enable/disable handling for WiMAX. Removed Cellular section when not available. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixes Created 8 years, 7 months 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ui/webui/options2/chromeos/internet_options_handler2.h ('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) 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/ui/webui/options2/chromeos/internet_options_handler2.h" 5 #include "chrome/browser/ui/webui/options2/chromeos/internet_options_handler2.h"
6 6
7 #include <ctype.h> 7 #include <ctype.h>
8 8
9 #include <map> 9 #include <map>
10 #include <string> 10 #include <string>
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after
469 web_ui()->RegisterMessageCallback("setIPConfig", 469 web_ui()->RegisterMessageCallback("setIPConfig",
470 base::Bind(&InternetOptionsHandler::SetIPConfigCallback, 470 base::Bind(&InternetOptionsHandler::SetIPConfigCallback,
471 base::Unretained(this))); 471 base::Unretained(this)));
472 web_ui()->RegisterMessageCallback("enableWifi", 472 web_ui()->RegisterMessageCallback("enableWifi",
473 base::Bind(&InternetOptionsHandler::EnableWifiCallback, 473 base::Bind(&InternetOptionsHandler::EnableWifiCallback,
474 base::Unretained(this))); 474 base::Unretained(this)));
475 web_ui()->RegisterMessageCallback("disableWifi", 475 web_ui()->RegisterMessageCallback("disableWifi",
476 base::Bind(&InternetOptionsHandler::DisableWifiCallback, 476 base::Bind(&InternetOptionsHandler::DisableWifiCallback,
477 base::Unretained(this))); 477 base::Unretained(this)));
478 web_ui()->RegisterMessageCallback("enableCellular", 478 web_ui()->RegisterMessageCallback("enableCellular",
479 base::Bind(&InternetOptionsHandler::EnableMobileCallback, 479 base::Bind(&InternetOptionsHandler::EnableCellularCallback,
480 base::Unretained(this))); 480 base::Unretained(this)));
481 web_ui()->RegisterMessageCallback("disableCellular", 481 web_ui()->RegisterMessageCallback("disableCellular",
482 base::Bind(&InternetOptionsHandler::DisableMobileCallback, 482 base::Bind(&InternetOptionsHandler::DisableCellularCallback,
483 base::Unretained(this)));
484 web_ui()->RegisterMessageCallback("enableWimax",
485 base::Bind(&InternetOptionsHandler::EnableWimaxCallback,
486 base::Unretained(this)));
487 web_ui()->RegisterMessageCallback("disableWimax",
488 base::Bind(&InternetOptionsHandler::DisableWimaxCallback,
483 base::Unretained(this))); 489 base::Unretained(this)));
484 web_ui()->RegisterMessageCallback("buyDataPlan", 490 web_ui()->RegisterMessageCallback("buyDataPlan",
485 base::Bind(&InternetOptionsHandler::BuyDataPlanCallback, 491 base::Bind(&InternetOptionsHandler::BuyDataPlanCallback,
486 base::Unretained(this))); 492 base::Unretained(this)));
487 web_ui()->RegisterMessageCallback("showMorePlanInfo", 493 web_ui()->RegisterMessageCallback("showMorePlanInfo",
488 base::Bind(&InternetOptionsHandler::ShowMorePlanInfoCallback, 494 base::Bind(&InternetOptionsHandler::ShowMorePlanInfoCallback,
489 base::Unretained(this))); 495 base::Unretained(this)));
490 web_ui()->RegisterMessageCallback("setApn", 496 web_ui()->RegisterMessageCallback("setApn",
491 base::Bind(&InternetOptionsHandler::SetApnCallback, 497 base::Bind(&InternetOptionsHandler::SetApnCallback,
492 base::Unretained(this))); 498 base::Unretained(this)));
493 web_ui()->RegisterMessageCallback("setSimCardLock", 499 web_ui()->RegisterMessageCallback("setSimCardLock",
494 base::Bind(&InternetOptionsHandler::SetSimCardLockCallback, 500 base::Bind(&InternetOptionsHandler::SetSimCardLockCallback,
495 base::Unretained(this))); 501 base::Unretained(this)));
496 web_ui()->RegisterMessageCallback("changePin", 502 web_ui()->RegisterMessageCallback("changePin",
497 base::Bind(&InternetOptionsHandler::ChangePinCallback, 503 base::Bind(&InternetOptionsHandler::ChangePinCallback,
498 base::Unretained(this))); 504 base::Unretained(this)));
499 web_ui()->RegisterMessageCallback("toggleAirplaneMode", 505 web_ui()->RegisterMessageCallback("toggleAirplaneMode",
500 base::Bind(&InternetOptionsHandler::ToggleAirplaneModeCallback, 506 base::Bind(&InternetOptionsHandler::ToggleAirplaneModeCallback,
501 base::Unretained(this))); 507 base::Unretained(this)));
502 } 508 }
503 509
504 void InternetOptionsHandler::EnableWifiCallback(const ListValue* args) { 510 void InternetOptionsHandler::EnableWifiCallback(const ListValue* args) {
505 cros_->EnableWifiNetworkDevice(true); 511 cros_->EnableWifiNetworkDevice(true);
506 } 512 }
507 513
508 void InternetOptionsHandler::DisableWifiCallback(const ListValue* args) { 514 void InternetOptionsHandler::DisableWifiCallback(const ListValue* args) {
509 cros_->EnableWifiNetworkDevice(false); 515 cros_->EnableWifiNetworkDevice(false);
510 } 516 }
511 517
512 void InternetOptionsHandler::EnableMobileCallback(const ListValue* args) { 518 void InternetOptionsHandler::EnableCellularCallback(const ListValue* args) {
513 // TODO(nkostylev): Code duplication, see NetworkMenu::ToggleCellular(). 519 // TODO(nkostylev): Code duplication, see NetworkMenu::ToggleCellular().
514 const chromeos::NetworkDevice* mobile = cros_->FindMobileDevice(); 520 const chromeos::NetworkDevice* mobile = cros_->FindMobileDevice();
515 if (!mobile) { 521 if (!mobile) {
516 LOG(ERROR) << "Didn't find mobile device, it should have been available."; 522 LOG(ERROR) << "Didn't find mobile device, it should have been available.";
517 cros_->EnableMobileNetworkDevice(true); 523 cros_->EnableCellularNetworkDevice(true);
518 } else if (!mobile->is_sim_locked()) { 524 } else if (!mobile->is_sim_locked()) {
519 if (mobile->is_sim_absent()) { 525 if (mobile->is_sim_absent()) {
520 std::string setup_url; 526 std::string setup_url;
521 chromeos::MobileConfig* config = chromeos::MobileConfig::GetInstance(); 527 chromeos::MobileConfig* config = chromeos::MobileConfig::GetInstance();
522 if (config->IsReady()) { 528 if (config->IsReady()) {
523 const chromeos::MobileConfig::LocaleConfig* locale_config = 529 const chromeos::MobileConfig::LocaleConfig* locale_config =
524 config->GetLocaleConfig(); 530 config->GetLocaleConfig();
525 if (locale_config) 531 if (locale_config)
526 setup_url = locale_config->setup_url(); 532 setup_url = locale_config->setup_url();
527 } 533 }
528 if (!setup_url.empty()) { 534 if (!setup_url.empty()) {
529 GetAppropriateBrowser()->ShowSingletonTab(GURL(setup_url)); 535 GetAppropriateBrowser()->ShowSingletonTab(GURL(setup_url));
530 } else { 536 } else {
531 // TODO(nkostylev): Show generic error message. http://crosbug.com/15444 537 // TODO(nkostylev): Show generic error message. http://crosbug.com/15444
532 } 538 }
533 } else { 539 } else {
534 cros_->EnableMobileNetworkDevice(true); 540 cros_->EnableCellularNetworkDevice(true);
535 } 541 }
536 } else { 542 } else {
537 chromeos::SimDialogDelegate::ShowDialog(GetNativeWindow(), 543 chromeos::SimDialogDelegate::ShowDialog(GetNativeWindow(),
538 chromeos::SimDialogDelegate::SIM_DIALOG_UNLOCK); 544 chromeos::SimDialogDelegate::SIM_DIALOG_UNLOCK);
539 } 545 }
540 } 546 }
541 547
542 void InternetOptionsHandler::DisableMobileCallback(const ListValue* args) { 548 void InternetOptionsHandler::DisableCellularCallback(const ListValue* args) {
543 cros_->EnableMobileNetworkDevice(false); 549 cros_->EnableCellularNetworkDevice(false);
550 }
551
552 void InternetOptionsHandler::EnableWimaxCallback(const ListValue* args) {
553 cros_->EnableWimaxNetworkDevice(true);
554 }
555
556 void InternetOptionsHandler::DisableWimaxCallback(const ListValue* args) {
557 cros_->EnableWimaxNetworkDevice(false);
544 } 558 }
545 559
546 void InternetOptionsHandler::ShowMorePlanInfoCallback(const ListValue* args) { 560 void InternetOptionsHandler::ShowMorePlanInfoCallback(const ListValue* args) {
547 if (!web_ui()) 561 if (!web_ui())
548 return; 562 return;
549 Browser* browser = browser::FindBrowserWithFeature( 563 Browser* browser = browser::FindBrowserWithFeature(
550 Profile::FromWebUI(web_ui()), Browser::FEATURE_TABSTRIP); 564 Profile::FromWebUI(web_ui()), Browser::FEATURE_TABSTRIP);
551 if (!browser) 565 if (!browser)
552 return; 566 return;
553 567
(...skipping 842 matching lines...) Expand 10 before | Expand all | Expand 10 after
1396 1410
1397 void InternetOptionsHandler::FillNetworkInfo(DictionaryValue* dictionary) { 1411 void InternetOptionsHandler::FillNetworkInfo(DictionaryValue* dictionary) {
1398 dictionary->SetBoolean("accessLocked", cros_->IsLocked()); 1412 dictionary->SetBoolean("accessLocked", cros_->IsLocked());
1399 dictionary->Set("wiredList", GetWiredList()); 1413 dictionary->Set("wiredList", GetWiredList());
1400 dictionary->Set("wirelessList", GetWirelessList()); 1414 dictionary->Set("wirelessList", GetWirelessList());
1401 dictionary->Set("vpnList", GetVPNList()); 1415 dictionary->Set("vpnList", GetVPNList());
1402 dictionary->Set("rememberedList", GetRememberedList()); 1416 dictionary->Set("rememberedList", GetRememberedList());
1403 dictionary->SetBoolean("wifiAvailable", cros_->wifi_available()); 1417 dictionary->SetBoolean("wifiAvailable", cros_->wifi_available());
1404 dictionary->SetBoolean("wifiBusy", cros_->wifi_busy()); 1418 dictionary->SetBoolean("wifiBusy", cros_->wifi_busy());
1405 dictionary->SetBoolean("wifiEnabled", cros_->wifi_enabled()); 1419 dictionary->SetBoolean("wifiEnabled", cros_->wifi_enabled());
1406 dictionary->SetBoolean("cellularAvailable", cros_->mobile_available()); 1420 dictionary->SetBoolean("cellularAvailable", cros_->cellular_available());
1407 dictionary->SetBoolean("cellularBusy", cros_->mobile_busy()); 1421 dictionary->SetBoolean("cellularBusy", cros_->cellular_busy());
1408 dictionary->SetBoolean("cellularEnabled", cros_->mobile_enabled()); 1422 dictionary->SetBoolean("cellularEnabled", cros_->cellular_enabled());
1423 dictionary->SetBoolean("wimaxEnabled", cros_->wimax_enabled());
1424 dictionary->SetBoolean("wimaxAvailable", cros_->wimax_available());
1425 dictionary->SetBoolean("wimaxBusy", cros_->wimax_busy());
1409 // TODO(kevers): The use of 'offline_mode' is not quite correct. Update once 1426 // TODO(kevers): The use of 'offline_mode' is not quite correct. Update once
1410 // we have proper back-end support. 1427 // we have proper back-end support.
1411 dictionary->SetBoolean("airplaneMode", cros_->offline_mode()); 1428 dictionary->SetBoolean("airplaneMode", cros_->offline_mode());
1412 } 1429 }
1413 1430
1414 void InternetOptionsHandler::SetValueDictionary( 1431 void InternetOptionsHandler::SetValueDictionary(
1415 DictionaryValue* settings, 1432 DictionaryValue* settings,
1416 const char* key, 1433 const char* key,
1417 base::Value* value, 1434 base::Value* value,
1418 const chromeos::NetworkPropertyUIData& ui_data) { 1435 const chromeos::NetworkPropertyUIData& ui_data) {
1419 DictionaryValue* value_dict = new DictionaryValue(); 1436 DictionaryValue* value_dict = new DictionaryValue();
1420 // DictionaryValue::Set() takes ownership of |value|. 1437 // DictionaryValue::Set() takes ownership of |value|.
1421 if (value) 1438 if (value)
1422 value_dict->Set("value", value); 1439 value_dict->Set("value", value);
1423 const base::Value* default_value = ui_data.default_value(); 1440 const base::Value* default_value = ui_data.default_value();
1424 if (default_value) 1441 if (default_value)
1425 value_dict->Set("default", default_value->DeepCopy()); 1442 value_dict->Set("default", default_value->DeepCopy());
1426 if (ui_data.managed()) 1443 if (ui_data.managed())
1427 value_dict->SetString("controlledBy", "policy"); 1444 value_dict->SetString("controlledBy", "policy");
1428 else if (ui_data.recommended()) 1445 else if (ui_data.recommended())
1429 value_dict->SetString("controlledBy", "recommended"); 1446 value_dict->SetString("controlledBy", "recommended");
1430 settings->Set(key, value_dict); 1447 settings->Set(key, value_dict);
1431 } 1448 }
1432 1449
1433 } // namespace options2 1450 } // namespace options2
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/options2/chromeos/internet_options_handler2.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698