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 12 matching lines...) Expand all Loading... |
23 #include "chrome/browser/chromeos/choose_mobile_network_dialog.h" | 23 #include "chrome/browser/chromeos/choose_mobile_network_dialog.h" |
24 #include "chrome/browser/chromeos/cros/cros_library.h" | 24 #include "chrome/browser/chromeos/cros/cros_library.h" |
25 #include "chrome/browser/chromeos/cros_settings.h" | 25 #include "chrome/browser/chromeos/cros_settings.h" |
26 #include "chrome/browser/chromeos/customization_document.h" | 26 #include "chrome/browser/chromeos/customization_document.h" |
27 #include "chrome/browser/chromeos/login/user_manager.h" | 27 #include "chrome/browser/chromeos/login/user_manager.h" |
28 #include "chrome/browser/chromeos/options/network_config_view.h" | 28 #include "chrome/browser/chromeos/options/network_config_view.h" |
29 #include "chrome/browser/chromeos/sim_dialog_delegate.h" | 29 #include "chrome/browser/chromeos/sim_dialog_delegate.h" |
30 #include "chrome/browser/chromeos/status/network_menu_icon.h" | 30 #include "chrome/browser/chromeos/status/network_menu_icon.h" |
31 #include "chrome/browser/chromeos/user_cros_settings_provider.h" | 31 #include "chrome/browser/chromeos/user_cros_settings_provider.h" |
32 #include "chrome/browser/prefs/pref_service.h" | 32 #include "chrome/browser/prefs/pref_service.h" |
| 33 #include "chrome/browser/profiles/profile.h" |
33 #include "chrome/browser/ui/browser.h" | 34 #include "chrome/browser/ui/browser.h" |
34 #include "chrome/browser/ui/browser_list.h" | 35 #include "chrome/browser/ui/browser_list.h" |
35 #include "chrome/browser/ui/browser_window.h" | 36 #include "chrome/browser/ui/browser_window.h" |
36 #include "chrome/browser/ui/views/window.h" | 37 #include "chrome/browser/ui/views/window.h" |
37 #include "chrome/browser/ui/webui/web_ui_util.h" | 38 #include "chrome/browser/ui/webui/web_ui_util.h" |
38 #include "chrome/common/chrome_notification_types.h" | 39 #include "chrome/common/chrome_notification_types.h" |
39 #include "chrome/common/pref_names.h" | 40 #include "chrome/common/pref_names.h" |
40 #include "chrome/common/time_format.h" | 41 #include "chrome/common/time_format.h" |
| 42 #include "content/browser/tab_contents/tab_contents.h" |
41 #include "content/common/notification_service.h" | 43 #include "content/common/notification_service.h" |
42 #include "grit/chromium_strings.h" | 44 #include "grit/chromium_strings.h" |
43 #include "grit/generated_resources.h" | 45 #include "grit/generated_resources.h" |
44 #include "grit/locale_settings.h" | 46 #include "grit/locale_settings.h" |
45 #include "grit/theme_resources.h" | 47 #include "grit/theme_resources.h" |
46 #include "third_party/skia/include/core/SkBitmap.h" | 48 #include "third_party/skia/include/core/SkBitmap.h" |
47 #include "ui/base/l10n/l10n_util.h" | 49 #include "ui/base/l10n/l10n_util.h" |
48 #include "ui/base/resource/resource_bundle.h" | 50 #include "ui/base/resource/resource_bundle.h" |
49 #include "views/widget/widget.h" | 51 #include "views/widget/widget.h" |
50 | 52 |
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
410 } | 412 } |
411 } | 413 } |
412 | 414 |
413 void InternetOptionsHandler::DisableCellularCallback(const ListValue* args) { | 415 void InternetOptionsHandler::DisableCellularCallback(const ListValue* args) { |
414 cros_->EnableCellularNetworkDevice(false); | 416 cros_->EnableCellularNetworkDevice(false); |
415 } | 417 } |
416 | 418 |
417 void InternetOptionsHandler::BuyDataPlanCallback(const ListValue* args) { | 419 void InternetOptionsHandler::BuyDataPlanCallback(const ListValue* args) { |
418 if (!web_ui_) | 420 if (!web_ui_) |
419 return; | 421 return; |
| 422 Profile* profile = |
| 423 Profile::FromBrowserContext(web_ui_->tab_contents()->browser_context()); |
420 Browser* browser = BrowserList::FindBrowserWithFeature( | 424 Browser* browser = BrowserList::FindBrowserWithFeature( |
421 web_ui_->GetProfile(), Browser::FEATURE_TABSTRIP); | 425 profile, Browser::FEATURE_TABSTRIP); |
422 if (browser) | 426 if (browser) |
423 browser->OpenMobilePlanTabAndActivate(); | 427 browser->OpenMobilePlanTabAndActivate(); |
424 } | 428 } |
425 | 429 |
426 void InternetOptionsHandler::SetApnCallback(const ListValue* args) { | 430 void InternetOptionsHandler::SetApnCallback(const ListValue* args) { |
427 std::string service_path; | 431 std::string service_path; |
428 std::string apn; | 432 std::string apn; |
429 std::string username; | 433 std::string username; |
430 std::string password; | 434 std::string password; |
431 if (args->GetSize() != 4 || | 435 if (args->GetSize() != 4 || |
(...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
879 | 883 |
880 void InternetOptionsHandler::CreateModalPopup(views::WidgetDelegate* view) { | 884 void InternetOptionsHandler::CreateModalPopup(views::WidgetDelegate* view) { |
881 views::Widget* window = browser::CreateViewsWindow(GetNativeWindow(), view); | 885 views::Widget* window = browser::CreateViewsWindow(GetNativeWindow(), view); |
882 window->SetAlwaysOnTop(true); | 886 window->SetAlwaysOnTop(true); |
883 window->Show(); | 887 window->Show(); |
884 } | 888 } |
885 | 889 |
886 gfx::NativeWindow InternetOptionsHandler::GetNativeWindow() const { | 890 gfx::NativeWindow InternetOptionsHandler::GetNativeWindow() const { |
887 // TODO(beng): This is an improper direct dependency on Browser. Route this | 891 // TODO(beng): This is an improper direct dependency on Browser. Route this |
888 // through some sort of delegate. | 892 // through some sort of delegate. |
889 Browser* browser = BrowserList::FindBrowserWithProfile(web_ui_->GetProfile()); | 893 Profile* profile = |
| 894 Profile::FromBrowserContext(web_ui_->tab_contents()->browser_context()); |
| 895 Browser* browser = BrowserList::FindBrowserWithProfile(profile); |
890 return browser->window()->GetNativeHandle(); | 896 return browser->window()->GetNativeHandle(); |
891 } | 897 } |
892 | 898 |
893 void InternetOptionsHandler::ButtonClickCallback(const ListValue* args) { | 899 void InternetOptionsHandler::ButtonClickCallback(const ListValue* args) { |
894 std::string str_type; | 900 std::string str_type; |
895 std::string service_path; | 901 std::string service_path; |
896 std::string command; | 902 std::string command; |
897 if (args->GetSize() != 3 || | 903 if (args->GetSize() != 3 || |
898 !args->GetString(0, &str_type) || | 904 !args->GetString(0, &str_type) || |
899 !args->GetString(1, &service_path) || | 905 !args->GetString(1, &service_path) || |
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1266 dictionary->SetBoolean("accessLocked", cros_->IsLocked()); | 1272 dictionary->SetBoolean("accessLocked", cros_->IsLocked()); |
1267 dictionary->Set("wiredList", GetWiredList()); | 1273 dictionary->Set("wiredList", GetWiredList()); |
1268 dictionary->Set("wirelessList", GetWirelessList()); | 1274 dictionary->Set("wirelessList", GetWirelessList()); |
1269 dictionary->Set("vpnList", GetVPNList()); | 1275 dictionary->Set("vpnList", GetVPNList()); |
1270 dictionary->Set("rememberedList", GetRememberedList()); | 1276 dictionary->Set("rememberedList", GetRememberedList()); |
1271 dictionary->SetBoolean("wifiAvailable", cros_->wifi_available()); | 1277 dictionary->SetBoolean("wifiAvailable", cros_->wifi_available()); |
1272 dictionary->SetBoolean("wifiEnabled", cros_->wifi_enabled()); | 1278 dictionary->SetBoolean("wifiEnabled", cros_->wifi_enabled()); |
1273 dictionary->SetBoolean("cellularAvailable", cros_->cellular_available()); | 1279 dictionary->SetBoolean("cellularAvailable", cros_->cellular_available()); |
1274 dictionary->SetBoolean("cellularEnabled", cros_->cellular_enabled()); | 1280 dictionary->SetBoolean("cellularEnabled", cros_->cellular_enabled()); |
1275 } | 1281 } |
OLD | NEW |