| 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/chromeos/webui/internet_options_handler.h" | 5 #include "chrome/browser/chromeos/webui/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> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "base/base64.h" | 13 #include "base/base64.h" |
| 14 #include "base/basictypes.h" | 14 #include "base/basictypes.h" |
| 15 #include "base/callback.h" | 15 #include "base/callback.h" |
| 16 #include "base/i18n/time_formatting.h" | 16 #include "base/i18n/time_formatting.h" |
| 17 #include "base/string16.h" | 17 #include "base/string16.h" |
| 18 #include "base/string_number_conversions.h" | 18 #include "base/string_number_conversions.h" |
| 19 #include "base/time.h" | 19 #include "base/time.h" |
| 20 #include "base/utf_string_conversions.h" | 20 #include "base/utf_string_conversions.h" |
| 21 #include "base/values.h" | 21 #include "base/values.h" |
| 22 #include "chrome/browser/browser_list.h" | 22 #include "chrome/browser/browser_list.h" |
| 23 #include "chrome/browser/browser_process.h" |
| 23 #include "chrome/browser/browser_window.h" | 24 #include "chrome/browser/browser_window.h" |
| 24 #include "chrome/browser/chromeos/cros/cros_library.h" | 25 #include "chrome/browser/chromeos/cros/cros_library.h" |
| 25 #include "chrome/browser/chromeos/login/user_manager.h" | 26 #include "chrome/browser/chromeos/login/user_manager.h" |
| 26 #include "chrome/browser/chromeos/status/network_menu.h" | 27 #include "chrome/browser/chromeos/status/network_menu.h" |
| 28 #include "chrome/browser/chromeos/user_cros_settings_provider.h" |
| 29 #include "chrome/browser/prefs/pref_service.h" |
| 27 #include "chrome/browser/ui/browser.h" | 30 #include "chrome/browser/ui/browser.h" |
| 28 #include "chrome/browser/ui/views/window.h" | 31 #include "chrome/browser/ui/views/window.h" |
| 32 #include "chrome/common/pref_names.h" |
| 29 #include "chrome/common/time_format.h" | 33 #include "chrome/common/time_format.h" |
| 30 #include "content/browser/webui/web_ui_util.h" | 34 #include "content/browser/webui/web_ui_util.h" |
| 31 #include "grit/chromium_strings.h" | 35 #include "grit/chromium_strings.h" |
| 32 #include "grit/generated_resources.h" | 36 #include "grit/generated_resources.h" |
| 33 #include "grit/locale_settings.h" | 37 #include "grit/locale_settings.h" |
| 34 #include "grit/theme_resources.h" | 38 #include "grit/theme_resources.h" |
| 35 #include "third_party/skia/include/core/SkBitmap.h" | 39 #include "third_party/skia/include/core/SkBitmap.h" |
| 36 #include "ui/base/l10n/l10n_util.h" | 40 #include "ui/base/l10n/l10n_util.h" |
| 37 #include "ui/base/resource/resource_bundle.h" | 41 #include "ui/base/resource/resource_bundle.h" |
| 38 #include "views/window/window.h" | 42 #include "views/window/window.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 49 output.push_back(':'); | 53 output.push_back(':'); |
| 50 } | 54 } |
| 51 output.push_back(toupper(address[i])); | 55 output.push_back(toupper(address[i])); |
| 52 } | 56 } |
| 53 return output; | 57 return output; |
| 54 } | 58 } |
| 55 | 59 |
| 56 } // namespace | 60 } // namespace |
| 57 | 61 |
| 58 InternetOptionsHandler::InternetOptionsHandler() | 62 InternetOptionsHandler::InternetOptionsHandler() |
| 59 : use_settings_ui_(false) { | 63 : chromeos::CrosOptionsPageUIHandler( |
| 64 new chromeos::UserCrosSettingsProvider), |
| 65 use_settings_ui_(false) { |
| 60 chromeos::NetworkLibrary* netlib = | 66 chromeos::NetworkLibrary* netlib = |
| 61 chromeos::CrosLibrary::Get()->GetNetworkLibrary(); | 67 chromeos::CrosLibrary::Get()->GetNetworkLibrary(); |
| 62 netlib->AddNetworkManagerObserver(this); | 68 netlib->AddNetworkManagerObserver(this); |
| 63 netlib->AddCellularDataPlanObserver(this); | 69 netlib->AddCellularDataPlanObserver(this); |
| 64 MonitorNetworks(netlib); | 70 MonitorNetworks(netlib); |
| 65 } | 71 } |
| 66 | 72 |
| 67 InternetOptionsHandler::~InternetOptionsHandler() { | 73 InternetOptionsHandler::~InternetOptionsHandler() { |
| 68 chromeos::NetworkLibrary *netlib = | 74 chromeos::NetworkLibrary *netlib = |
| 69 chromeos::CrosLibrary::Get()->GetNetworkLibrary(); | 75 chromeos::CrosLibrary::Get()->GetNetworkLibrary(); |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 286 IDS_STATUSBAR_NETWORK_DEVICE_DISABLE, | 292 IDS_STATUSBAR_NETWORK_DEVICE_DISABLE, |
| 287 l10n_util::GetStringUTF16(IDS_STATUSBAR_NETWORK_DEVICE_WIFI))); | 293 l10n_util::GetStringUTF16(IDS_STATUSBAR_NETWORK_DEVICE_WIFI))); |
| 288 localized_strings->SetString("enableCellular", | 294 localized_strings->SetString("enableCellular", |
| 289 l10n_util::GetStringFUTF16( | 295 l10n_util::GetStringFUTF16( |
| 290 IDS_STATUSBAR_NETWORK_DEVICE_ENABLE, | 296 IDS_STATUSBAR_NETWORK_DEVICE_ENABLE, |
| 291 l10n_util::GetStringUTF16(IDS_STATUSBAR_NETWORK_DEVICE_CELLULAR))); | 297 l10n_util::GetStringUTF16(IDS_STATUSBAR_NETWORK_DEVICE_CELLULAR))); |
| 292 localized_strings->SetString("disableCellular", | 298 localized_strings->SetString("disableCellular", |
| 293 l10n_util::GetStringFUTF16( | 299 l10n_util::GetStringFUTF16( |
| 294 IDS_STATUSBAR_NETWORK_DEVICE_DISABLE, | 300 IDS_STATUSBAR_NETWORK_DEVICE_DISABLE, |
| 295 l10n_util::GetStringUTF16(IDS_STATUSBAR_NETWORK_DEVICE_CELLULAR))); | 301 l10n_util::GetStringUTF16(IDS_STATUSBAR_NETWORK_DEVICE_CELLULAR))); |
| 302 localized_strings->SetString("enableDataRoaming", |
| 303 l10n_util::GetStringUTF16(IDS_OPTIONS_SETTINGS_ENABLE_DATA_ROAMING)); |
| 296 localized_strings->SetString("generalNetworkingTitle", | 304 localized_strings->SetString("generalNetworkingTitle", |
| 297 l10n_util::GetStringUTF16( | 305 l10n_util::GetStringUTF16( |
| 298 IDS_OPTIONS_SETTINGS_INTERNET_CONTROL_TITLE)); | 306 IDS_OPTIONS_SETTINGS_INTERNET_CONTROL_TITLE)); |
| 299 localized_strings->SetString("detailsInternetDismiss", | 307 localized_strings->SetString("detailsInternetDismiss", |
| 300 l10n_util::GetStringUTF16(IDS_CLOSE)); | 308 l10n_util::GetStringUTF16(IDS_CLOSE)); |
| 309 localized_strings->SetString("ownerOnly", l10n_util::GetStringUTF16( |
| 310 IDS_OPTIONS_ACCOUNTS_OWNER_ONLY)); |
| 311 localized_strings->SetString("ownerUserId", UTF8ToUTF16( |
| 312 chromeos::UserCrosSettingsProvider::cached_owner())); |
| 301 | 313 |
| 302 chromeos::NetworkLibrary* cros = | 314 chromeos::NetworkLibrary* cros = |
| 303 chromeos::CrosLibrary::Get()->GetNetworkLibrary(); | 315 chromeos::CrosLibrary::Get()->GetNetworkLibrary(); |
| 304 FillNetworkInfo(localized_strings, cros); | 316 FillNetworkInfo(localized_strings, cros); |
| 305 | 317 |
| 306 localized_strings->SetBoolean("networkUseSettingsUI", use_settings_ui_); | 318 localized_strings->SetBoolean("networkUseSettingsUI", use_settings_ui_); |
| 307 } | 319 } |
| 308 | 320 |
| 309 void InternetOptionsHandler::Initialize() { | 321 void InternetOptionsHandler::Initialize() { |
| 310 chromeos::NetworkLibrary* cros = | 322 chromeos::NetworkLibrary* cros = |
| (...skipping 764 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1075 DictionaryValue* dictionary, chromeos::NetworkLibrary* cros) { | 1087 DictionaryValue* dictionary, chromeos::NetworkLibrary* cros) { |
| 1076 dictionary->SetBoolean("accessLocked", cros->IsLocked()); | 1088 dictionary->SetBoolean("accessLocked", cros->IsLocked()); |
| 1077 dictionary->Set("wiredList", GetWiredList()); | 1089 dictionary->Set("wiredList", GetWiredList()); |
| 1078 dictionary->Set("wirelessList", GetWirelessList()); | 1090 dictionary->Set("wirelessList", GetWirelessList()); |
| 1079 dictionary->Set("rememberedList", GetRememberedList()); | 1091 dictionary->Set("rememberedList", GetRememberedList()); |
| 1080 dictionary->SetBoolean("wifiAvailable", cros->wifi_available()); | 1092 dictionary->SetBoolean("wifiAvailable", cros->wifi_available()); |
| 1081 dictionary->SetBoolean("wifiEnabled", cros->wifi_enabled()); | 1093 dictionary->SetBoolean("wifiEnabled", cros->wifi_enabled()); |
| 1082 dictionary->SetBoolean("cellularAvailable", cros->cellular_available()); | 1094 dictionary->SetBoolean("cellularAvailable", cros->cellular_available()); |
| 1083 dictionary->SetBoolean("cellularEnabled", cros->cellular_enabled()); | 1095 dictionary->SetBoolean("cellularEnabled", cros->cellular_enabled()); |
| 1084 } | 1096 } |
| OLD | NEW |