| 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 #include "grit/locale_settings.h" | 49 #include "grit/locale_settings.h" |
| 50 #include "grit/theme_resources.h" | 50 #include "grit/theme_resources.h" |
| 51 #include "third_party/skia/include/core/SkBitmap.h" | 51 #include "third_party/skia/include/core/SkBitmap.h" |
| 52 #include "ui/base/l10n/l10n_util.h" | 52 #include "ui/base/l10n/l10n_util.h" |
| 53 #include "ui/base/resource/resource_bundle.h" | 53 #include "ui/base/resource/resource_bundle.h" |
| 54 #include "views/widget/widget.h" | 54 #include "views/widget/widget.h" |
| 55 | 55 |
| 56 static const char kOtherNetworksFakePath[] = "?"; | 56 static const char kOtherNetworksFakePath[] = "?"; |
| 57 | 57 |
| 58 InternetOptionsHandler::InternetOptionsHandler() | 58 InternetOptionsHandler::InternetOptionsHandler() |
| 59 : chromeos::CrosOptionsPageUIHandler(NULL), | 59 : proxy_settings_(NULL) { |
| 60 proxy_settings_(NULL) { | |
| 61 registrar_.Add(this, chrome::NOTIFICATION_REQUIRE_PIN_SETTING_CHANGE_ENDED, | 60 registrar_.Add(this, chrome::NOTIFICATION_REQUIRE_PIN_SETTING_CHANGE_ENDED, |
| 62 NotificationService::AllSources()); | 61 NotificationService::AllSources()); |
| 63 registrar_.Add(this, chrome::NOTIFICATION_ENTER_PIN_ENDED, | 62 registrar_.Add(this, chrome::NOTIFICATION_ENTER_PIN_ENDED, |
| 64 NotificationService::AllSources()); | 63 NotificationService::AllSources()); |
| 65 cros_ = chromeos::CrosLibrary::Get()->GetNetworkLibrary(); | 64 cros_ = chromeos::CrosLibrary::Get()->GetNetworkLibrary(); |
| 66 if (cros_) { | 65 if (cros_) { |
| 67 cros_->AddNetworkManagerObserver(this); | 66 cros_->AddNetworkManagerObserver(this); |
| 68 cros_->AddCellularDataPlanObserver(this); | 67 cros_->AddCellularDataPlanObserver(this); |
| 69 MonitorNetworks(); | 68 MonitorNetworks(); |
| 70 } | 69 } |
| (...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 353 l10n_util::GetStringUTF16(IDS_OPTIONS_SETTINGS_USE_SHARED_PROXIES)); | 352 l10n_util::GetStringUTF16(IDS_OPTIONS_SETTINGS_USE_SHARED_PROXIES)); |
| 354 localized_strings->SetString("enableDataRoaming", | 353 localized_strings->SetString("enableDataRoaming", |
| 355 l10n_util::GetStringUTF16(IDS_OPTIONS_SETTINGS_ENABLE_DATA_ROAMING)); | 354 l10n_util::GetStringUTF16(IDS_OPTIONS_SETTINGS_ENABLE_DATA_ROAMING)); |
| 356 localized_strings->SetString("generalNetworkingTitle", | 355 localized_strings->SetString("generalNetworkingTitle", |
| 357 l10n_util::GetStringUTF16( | 356 l10n_util::GetStringUTF16( |
| 358 IDS_OPTIONS_SETTINGS_INTERNET_CONTROL_TITLE)); | 357 IDS_OPTIONS_SETTINGS_INTERNET_CONTROL_TITLE)); |
| 359 localized_strings->SetString("detailsInternetDismiss", | 358 localized_strings->SetString("detailsInternetDismiss", |
| 360 l10n_util::GetStringUTF16(IDS_CLOSE)); | 359 l10n_util::GetStringUTF16(IDS_CLOSE)); |
| 361 localized_strings->SetString("ownerOnly", l10n_util::GetStringUTF16( | 360 localized_strings->SetString("ownerOnly", l10n_util::GetStringUTF16( |
| 362 IDS_OPTIONS_ACCOUNTS_OWNER_ONLY)); | 361 IDS_OPTIONS_ACCOUNTS_OWNER_ONLY)); |
| 363 localized_strings->SetString("ownerUserId", UTF8ToUTF16( | 362 std::string owner; |
| 364 chromeos::UserCrosSettingsProvider::cached_owner())); | 363 chromeos::CrosSettings::Get()->GetString(chromeos::kDeviceOwner, &owner); |
| 364 localized_strings->SetString("ownerUserId", UTF8ToUTF16(owner)); |
| 365 | 365 |
| 366 FillNetworkInfo(localized_strings); | 366 FillNetworkInfo(localized_strings); |
| 367 } | 367 } |
| 368 | 368 |
| 369 void InternetOptionsHandler::Initialize() { | 369 void InternetOptionsHandler::Initialize() { |
| 370 cros_->RequestNetworkScan(); | 370 cros_->RequestNetworkScan(); |
| 371 } | 371 } |
| 372 | 372 |
| 373 void InternetOptionsHandler::RegisterMessages() { | 373 void InternetOptionsHandler::RegisterMessages() { |
| 374 // Setup handlers specific to this panel. | 374 // Setup handlers specific to this panel. |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 571 connection_plans.Set("plans", plan_list); | 571 connection_plans.Set("plans", plan_list); |
| 572 SetActivationButtonVisibility(cellular, &connection_plans); | 572 SetActivationButtonVisibility(cellular, &connection_plans); |
| 573 web_ui_->CallJavascriptFunction( | 573 web_ui_->CallJavascriptFunction( |
| 574 "options.InternetOptions.updateCellularPlans", connection_plans); | 574 "options.InternetOptions.updateCellularPlans", connection_plans); |
| 575 } | 575 } |
| 576 | 576 |
| 577 | 577 |
| 578 void InternetOptionsHandler::Observe(int type, | 578 void InternetOptionsHandler::Observe(int type, |
| 579 const NotificationSource& source, | 579 const NotificationSource& source, |
| 580 const NotificationDetails& details) { | 580 const NotificationDetails& details) { |
| 581 chromeos::CrosOptionsPageUIHandler::Observe(type, source, details); | 581 OptionsPageUIHandler::Observe(type, source, details); |
| 582 if (type == chrome::NOTIFICATION_REQUIRE_PIN_SETTING_CHANGE_ENDED) { | 582 if (type == chrome::NOTIFICATION_REQUIRE_PIN_SETTING_CHANGE_ENDED) { |
| 583 bool require_pin = *Details<bool>(details).ptr(); | 583 bool require_pin = *Details<bool>(details).ptr(); |
| 584 DictionaryValue dictionary; | 584 DictionaryValue dictionary; |
| 585 dictionary.SetBoolean("requirePin", require_pin); | 585 dictionary.SetBoolean("requirePin", require_pin); |
| 586 web_ui_->CallJavascriptFunction( | 586 web_ui_->CallJavascriptFunction( |
| 587 "options.InternetOptions.updateSecurityTab", dictionary); | 587 "options.InternetOptions.updateSecurityTab", dictionary); |
| 588 } else if (type == chrome::NOTIFICATION_ENTER_PIN_ENDED) { | 588 } else if (type == chrome::NOTIFICATION_ENTER_PIN_ENDED) { |
| 589 // We make an assumption (which is valid for now) that the SIM | 589 // We make an assumption (which is valid for now) that the SIM |
| 590 // unlock dialog is put up only when the user is trying to enable | 590 // unlock dialog is put up only when the user is trying to enable |
| 591 // mobile data. | 591 // mobile data. |
| (...skipping 731 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1323 dictionary->SetBoolean("accessLocked", cros_->IsLocked()); | 1323 dictionary->SetBoolean("accessLocked", cros_->IsLocked()); |
| 1324 dictionary->Set("wiredList", GetWiredList()); | 1324 dictionary->Set("wiredList", GetWiredList()); |
| 1325 dictionary->Set("wirelessList", GetWirelessList()); | 1325 dictionary->Set("wirelessList", GetWirelessList()); |
| 1326 dictionary->Set("vpnList", GetVPNList()); | 1326 dictionary->Set("vpnList", GetVPNList()); |
| 1327 dictionary->Set("rememberedList", GetRememberedList()); | 1327 dictionary->Set("rememberedList", GetRememberedList()); |
| 1328 dictionary->SetBoolean("wifiAvailable", cros_->wifi_available()); | 1328 dictionary->SetBoolean("wifiAvailable", cros_->wifi_available()); |
| 1329 dictionary->SetBoolean("wifiEnabled", cros_->wifi_enabled()); | 1329 dictionary->SetBoolean("wifiEnabled", cros_->wifi_enabled()); |
| 1330 dictionary->SetBoolean("cellularAvailable", cros_->cellular_available()); | 1330 dictionary->SetBoolean("cellularAvailable", cros_->cellular_available()); |
| 1331 dictionary->SetBoolean("cellularEnabled", cros_->cellular_enabled()); | 1331 dictionary->SetBoolean("cellularEnabled", cros_->cellular_enabled()); |
| 1332 } | 1332 } |
| OLD | NEW |