| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/options/chromeos/internet_options_handler.h" | 5 #include "chrome/browser/ui/webui/options/chromeos/internet_options_handler.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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 #include "grit/locale_settings.h" | 48 #include "grit/locale_settings.h" |
| 49 #include "grit/theme_resources.h" | 49 #include "grit/theme_resources.h" |
| 50 #include "third_party/skia/include/core/SkBitmap.h" | 50 #include "third_party/skia/include/core/SkBitmap.h" |
| 51 #include "ui/base/l10n/l10n_util.h" | 51 #include "ui/base/l10n/l10n_util.h" |
| 52 #include "ui/base/resource/resource_bundle.h" | 52 #include "ui/base/resource/resource_bundle.h" |
| 53 #include "views/widget/widget.h" | 53 #include "views/widget/widget.h" |
| 54 | 54 |
| 55 static const char kOtherNetworksFakePath[] = "?"; | 55 static const char kOtherNetworksFakePath[] = "?"; |
| 56 | 56 |
| 57 InternetOptionsHandler::InternetOptionsHandler() | 57 InternetOptionsHandler::InternetOptionsHandler() |
| 58 : chromeos::CrosOptionsPageUIHandler(NULL), | 58 : proxy_settings_(NULL) { |
| 59 proxy_settings_(NULL) { | |
| 60 registrar_.Add(this, chrome::NOTIFICATION_REQUIRE_PIN_SETTING_CHANGE_ENDED, | 59 registrar_.Add(this, chrome::NOTIFICATION_REQUIRE_PIN_SETTING_CHANGE_ENDED, |
| 61 NotificationService::AllSources()); | 60 NotificationService::AllSources()); |
| 62 registrar_.Add(this, chrome::NOTIFICATION_ENTER_PIN_ENDED, | 61 registrar_.Add(this, chrome::NOTIFICATION_ENTER_PIN_ENDED, |
| 63 NotificationService::AllSources()); | 62 NotificationService::AllSources()); |
| 64 cros_ = chromeos::CrosLibrary::Get()->GetNetworkLibrary(); | 63 cros_ = chromeos::CrosLibrary::Get()->GetNetworkLibrary(); |
| 65 if (cros_) { | 64 if (cros_) { |
| 66 cros_->AddNetworkManagerObserver(this); | 65 cros_->AddNetworkManagerObserver(this); |
| 67 cros_->AddCellularDataPlanObserver(this); | 66 cros_->AddCellularDataPlanObserver(this); |
| 68 MonitorNetworks(); | 67 MonitorNetworks(); |
| 69 } | 68 } |
| (...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 352 l10n_util::GetStringUTF16(IDS_OPTIONS_SETTINGS_USE_SHARED_PROXIES)); | 351 l10n_util::GetStringUTF16(IDS_OPTIONS_SETTINGS_USE_SHARED_PROXIES)); |
| 353 localized_strings->SetString("enableDataRoaming", | 352 localized_strings->SetString("enableDataRoaming", |
| 354 l10n_util::GetStringUTF16(IDS_OPTIONS_SETTINGS_ENABLE_DATA_ROAMING)); | 353 l10n_util::GetStringUTF16(IDS_OPTIONS_SETTINGS_ENABLE_DATA_ROAMING)); |
| 355 localized_strings->SetString("generalNetworkingTitle", | 354 localized_strings->SetString("generalNetworkingTitle", |
| 356 l10n_util::GetStringUTF16( | 355 l10n_util::GetStringUTF16( |
| 357 IDS_OPTIONS_SETTINGS_INTERNET_CONTROL_TITLE)); | 356 IDS_OPTIONS_SETTINGS_INTERNET_CONTROL_TITLE)); |
| 358 localized_strings->SetString("detailsInternetDismiss", | 357 localized_strings->SetString("detailsInternetDismiss", |
| 359 l10n_util::GetStringUTF16(IDS_CLOSE)); | 358 l10n_util::GetStringUTF16(IDS_CLOSE)); |
| 360 localized_strings->SetString("ownerOnly", l10n_util::GetStringUTF16( | 359 localized_strings->SetString("ownerOnly", l10n_util::GetStringUTF16( |
| 361 IDS_OPTIONS_ACCOUNTS_OWNER_ONLY)); | 360 IDS_OPTIONS_ACCOUNTS_OWNER_ONLY)); |
| 362 localized_strings->SetString("ownerUserId", UTF8ToUTF16( | 361 std::string owner; |
| 363 chromeos::UserCrosSettingsProvider::cached_owner())); | 362 chromeos::CrosSettings::Get()->GetString(chromeos::kDeviceOwner, &owner); |
| 363 localized_strings->SetString("ownerUserId", UTF8ToUTF16(owner)); |
| 364 | 364 |
| 365 FillNetworkInfo(localized_strings); | 365 FillNetworkInfo(localized_strings); |
| 366 } | 366 } |
| 367 | 367 |
| 368 void InternetOptionsHandler::Initialize() { | 368 void InternetOptionsHandler::Initialize() { |
| 369 cros_->RequestNetworkScan(); | 369 cros_->RequestNetworkScan(); |
| 370 } | 370 } |
| 371 | 371 |
| 372 void InternetOptionsHandler::RegisterMessages() { | 372 void InternetOptionsHandler::RegisterMessages() { |
| 373 // Setup handlers specific to this panel. | 373 // Setup handlers specific to this panel. |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 556 connection_plans.Set("plans", plan_list); | 556 connection_plans.Set("plans", plan_list); |
| 557 SetActivationButtonVisibility(cellular, &connection_plans); | 557 SetActivationButtonVisibility(cellular, &connection_plans); |
| 558 web_ui_->CallJavascriptFunction( | 558 web_ui_->CallJavascriptFunction( |
| 559 "options.InternetOptions.updateCellularPlans", connection_plans); | 559 "options.InternetOptions.updateCellularPlans", connection_plans); |
| 560 } | 560 } |
| 561 | 561 |
| 562 | 562 |
| 563 void InternetOptionsHandler::Observe(int type, | 563 void InternetOptionsHandler::Observe(int type, |
| 564 const NotificationSource& source, | 564 const NotificationSource& source, |
| 565 const NotificationDetails& details) { | 565 const NotificationDetails& details) { |
| 566 chromeos::CrosOptionsPageUIHandler::Observe(type, source, details); | 566 OptionsPageUIHandler::Observe(type, source, details); |
| 567 if (type == chrome::NOTIFICATION_REQUIRE_PIN_SETTING_CHANGE_ENDED) { | 567 if (type == chrome::NOTIFICATION_REQUIRE_PIN_SETTING_CHANGE_ENDED) { |
| 568 bool require_pin = *Details<bool>(details).ptr(); | 568 bool require_pin = *Details<bool>(details).ptr(); |
| 569 DictionaryValue dictionary; | 569 DictionaryValue dictionary; |
| 570 dictionary.SetBoolean("requirePin", require_pin); | 570 dictionary.SetBoolean("requirePin", require_pin); |
| 571 web_ui_->CallJavascriptFunction( | 571 web_ui_->CallJavascriptFunction( |
| 572 "options.InternetOptions.updateSecurityTab", dictionary); | 572 "options.InternetOptions.updateSecurityTab", dictionary); |
| 573 } else if (type == chrome::NOTIFICATION_ENTER_PIN_ENDED) { | 573 } else if (type == chrome::NOTIFICATION_ENTER_PIN_ENDED) { |
| 574 // We make an assumption (which is valid for now) that the SIM | 574 // We make an assumption (which is valid for now) that the SIM |
| 575 // unlock dialog is put up only when the user is trying to enable | 575 // unlock dialog is put up only when the user is trying to enable |
| 576 // mobile data. | 576 // mobile data. |
| (...skipping 730 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1307 dictionary->SetBoolean("accessLocked", cros_->IsLocked()); | 1307 dictionary->SetBoolean("accessLocked", cros_->IsLocked()); |
| 1308 dictionary->Set("wiredList", GetWiredList()); | 1308 dictionary->Set("wiredList", GetWiredList()); |
| 1309 dictionary->Set("wirelessList", GetWirelessList()); | 1309 dictionary->Set("wirelessList", GetWirelessList()); |
| 1310 dictionary->Set("vpnList", GetVPNList()); | 1310 dictionary->Set("vpnList", GetVPNList()); |
| 1311 dictionary->Set("rememberedList", GetRememberedList()); | 1311 dictionary->Set("rememberedList", GetRememberedList()); |
| 1312 dictionary->SetBoolean("wifiAvailable", cros_->wifi_available()); | 1312 dictionary->SetBoolean("wifiAvailable", cros_->wifi_available()); |
| 1313 dictionary->SetBoolean("wifiEnabled", cros_->wifi_enabled()); | 1313 dictionary->SetBoolean("wifiEnabled", cros_->wifi_enabled()); |
| 1314 dictionary->SetBoolean("cellularAvailable", cros_->cellular_available()); | 1314 dictionary->SetBoolean("cellularAvailable", cros_->cellular_available()); |
| 1315 dictionary->SetBoolean("cellularEnabled", cros_->cellular_enabled()); | 1315 dictionary->SetBoolean("cellularEnabled", cros_->cellular_enabled()); |
| 1316 } | 1316 } |
| OLD | NEW |