| 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 #include "grit/generated_resources.h" | 47 #include "grit/generated_resources.h" |
| 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) { | |
| 59 registrar_.Add(this, chrome::NOTIFICATION_REQUIRE_PIN_SETTING_CHANGE_ENDED, | 58 registrar_.Add(this, chrome::NOTIFICATION_REQUIRE_PIN_SETTING_CHANGE_ENDED, |
| 60 content::NotificationService::AllSources()); | 59 content::NotificationService::AllSources()); |
| 61 registrar_.Add(this, chrome::NOTIFICATION_ENTER_PIN_ENDED, | 60 registrar_.Add(this, chrome::NOTIFICATION_ENTER_PIN_ENDED, |
| 62 content::NotificationService::AllSources()); | 61 content::NotificationService::AllSources()); |
| 63 cros_ = chromeos::CrosLibrary::Get()->GetNetworkLibrary(); | 62 cros_ = chromeos::CrosLibrary::Get()->GetNetworkLibrary(); |
| 64 if (cros_) { | 63 if (cros_) { |
| 65 cros_->AddNetworkManagerObserver(this); | 64 cros_->AddNetworkManagerObserver(this); |
| 66 cros_->AddCellularDataPlanObserver(this); | 65 cros_->AddCellularDataPlanObserver(this); |
| 67 MonitorNetworks(); | 66 MonitorNetworks(); |
| 68 } | 67 } |
| (...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 342 l10n_util::GetStringUTF16(IDS_OPTIONS_SETTINGS_IMPORT_NETWORK_SETTINGS)); | 341 l10n_util::GetStringUTF16(IDS_OPTIONS_SETTINGS_IMPORT_NETWORK_SETTINGS)); |
| 343 localized_strings->SetString("invalidNetworkSettings", | 342 localized_strings->SetString("invalidNetworkSettings", |
| 344 l10n_util::GetStringUTF16(IDS_OPTIONS_SETTINGS_INVALID_NETWORK_SETTINGS)); | 343 l10n_util::GetStringUTF16(IDS_OPTIONS_SETTINGS_INVALID_NETWORK_SETTINGS)); |
| 345 localized_strings->SetString("generalNetworkingTitle", | 344 localized_strings->SetString("generalNetworkingTitle", |
| 346 l10n_util::GetStringUTF16( | 345 l10n_util::GetStringUTF16( |
| 347 IDS_OPTIONS_SETTINGS_INTERNET_CONTROL_TITLE)); | 346 IDS_OPTIONS_SETTINGS_INTERNET_CONTROL_TITLE)); |
| 348 localized_strings->SetString("detailsInternetDismiss", | 347 localized_strings->SetString("detailsInternetDismiss", |
| 349 l10n_util::GetStringUTF16(IDS_CLOSE)); | 348 l10n_util::GetStringUTF16(IDS_CLOSE)); |
| 350 localized_strings->SetString("ownerOnly", l10n_util::GetStringUTF16( | 349 localized_strings->SetString("ownerOnly", l10n_util::GetStringUTF16( |
| 351 IDS_OPTIONS_ACCOUNTS_OWNER_ONLY)); | 350 IDS_OPTIONS_ACCOUNTS_OWNER_ONLY)); |
| 352 localized_strings->SetString("ownerUserId", UTF8ToUTF16( | 351 std::string owner; |
| 353 chromeos::UserCrosSettingsProvider::cached_owner())); | 352 chromeos::CrosSettings::Get()->GetString(chromeos::kDeviceOwner, &owner); |
| 353 localized_strings->SetString("ownerUserId", UTF8ToUTF16(owner)); |
| 354 | 354 |
| 355 FillNetworkInfo(localized_strings); | 355 FillNetworkInfo(localized_strings); |
| 356 } | 356 } |
| 357 | 357 |
| 358 void InternetOptionsHandler::Initialize() { | 358 void InternetOptionsHandler::Initialize() { |
| 359 cros_->RequestNetworkScan(); | 359 cros_->RequestNetworkScan(); |
| 360 } | 360 } |
| 361 | 361 |
| 362 void InternetOptionsHandler::RegisterMessages() { | 362 void InternetOptionsHandler::RegisterMessages() { |
| 363 // Setup handlers specific to this panel. | 363 // Setup handlers specific to this panel. |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 578 SetActivationButtonVisibility(cellular, &connection_plans); | 578 SetActivationButtonVisibility(cellular, &connection_plans); |
| 579 web_ui_->CallJavascriptFunction( | 579 web_ui_->CallJavascriptFunction( |
| 580 "options.InternetOptions.updateCellularPlans", connection_plans); | 580 "options.InternetOptions.updateCellularPlans", connection_plans); |
| 581 } | 581 } |
| 582 | 582 |
| 583 | 583 |
| 584 void InternetOptionsHandler::Observe( | 584 void InternetOptionsHandler::Observe( |
| 585 int type, | 585 int type, |
| 586 const content::NotificationSource& source, | 586 const content::NotificationSource& source, |
| 587 const content::NotificationDetails& details) { | 587 const content::NotificationDetails& details) { |
| 588 chromeos::CrosOptionsPageUIHandler::Observe(type, source, details); | 588 OptionsPageUIHandler::Observe(type, source, details); |
| 589 if (type == chrome::NOTIFICATION_REQUIRE_PIN_SETTING_CHANGE_ENDED) { | 589 if (type == chrome::NOTIFICATION_REQUIRE_PIN_SETTING_CHANGE_ENDED) { |
| 590 base::FundamentalValue require_pin(*content::Details<bool>(details).ptr()); | 590 base::FundamentalValue require_pin(*content::Details<bool>(details).ptr()); |
| 591 web_ui_->CallJavascriptFunction( | 591 web_ui_->CallJavascriptFunction( |
| 592 "options.InternetOptions.updateSecurityTab", require_pin); | 592 "options.InternetOptions.updateSecurityTab", require_pin); |
| 593 } else if (type == chrome::NOTIFICATION_ENTER_PIN_ENDED) { | 593 } else if (type == chrome::NOTIFICATION_ENTER_PIN_ENDED) { |
| 594 // We make an assumption (which is valid for now) that the SIM | 594 // We make an assumption (which is valid for now) that the SIM |
| 595 // unlock dialog is put up only when the user is trying to enable | 595 // unlock dialog is put up only when the user is trying to enable |
| 596 // mobile data. | 596 // mobile data. |
| 597 bool cancelled = *content::Details<bool>(details).ptr(); | 597 bool cancelled = *content::Details<bool>(details).ptr(); |
| 598 if (cancelled) { | 598 if (cancelled) { |
| (...skipping 691 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1290 dictionary->Set("wirelessList", GetWirelessList()); | 1290 dictionary->Set("wirelessList", GetWirelessList()); |
| 1291 dictionary->Set("vpnList", GetVPNList()); | 1291 dictionary->Set("vpnList", GetVPNList()); |
| 1292 dictionary->Set("rememberedList", GetRememberedList()); | 1292 dictionary->Set("rememberedList", GetRememberedList()); |
| 1293 dictionary->SetBoolean("wifiAvailable", cros_->wifi_available()); | 1293 dictionary->SetBoolean("wifiAvailable", cros_->wifi_available()); |
| 1294 dictionary->SetBoolean("wifiBusy", cros_->wifi_busy()); | 1294 dictionary->SetBoolean("wifiBusy", cros_->wifi_busy()); |
| 1295 dictionary->SetBoolean("wifiEnabled", cros_->wifi_enabled()); | 1295 dictionary->SetBoolean("wifiEnabled", cros_->wifi_enabled()); |
| 1296 dictionary->SetBoolean("cellularAvailable", cros_->cellular_available()); | 1296 dictionary->SetBoolean("cellularAvailable", cros_->cellular_available()); |
| 1297 dictionary->SetBoolean("cellularBusy", cros_->cellular_busy()); | 1297 dictionary->SetBoolean("cellularBusy", cros_->cellular_busy()); |
| 1298 dictionary->SetBoolean("cellularEnabled", cros_->cellular_enabled()); | 1298 dictionary->SetBoolean("cellularEnabled", cros_->cellular_enabled()); |
| 1299 } | 1299 } |
| OLD | NEW |