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 18 matching lines...) Expand all Loading... |
29 #include "chrome/browser/chromeos/status/network_menu.h" | 29 #include "chrome/browser/chromeos/status/network_menu.h" |
30 #include "chrome/browser/chromeos/user_cros_settings_provider.h" | 30 #include "chrome/browser/chromeos/user_cros_settings_provider.h" |
31 #include "chrome/browser/prefs/pref_service.h" | 31 #include "chrome/browser/prefs/pref_service.h" |
32 #include "chrome/browser/ui/browser.h" | 32 #include "chrome/browser/ui/browser.h" |
33 #include "chrome/browser/ui/browser_list.h" | 33 #include "chrome/browser/ui/browser_list.h" |
34 #include "chrome/browser/ui/browser_window.h" | 34 #include "chrome/browser/ui/browser_window.h" |
35 #include "chrome/browser/ui/views/window.h" | 35 #include "chrome/browser/ui/views/window.h" |
36 #include "chrome/browser/ui/webui/web_ui_util.h" | 36 #include "chrome/browser/ui/webui/web_ui_util.h" |
37 #include "chrome/common/pref_names.h" | 37 #include "chrome/common/pref_names.h" |
38 #include "chrome/common/time_format.h" | 38 #include "chrome/common/time_format.h" |
| 39 #include "content/common/content_notification_types.h" |
39 #include "content/common/notification_service.h" | 40 #include "content/common/notification_service.h" |
40 #include "content/common/notification_type.h" | |
41 #include "grit/chromium_strings.h" | 41 #include "grit/chromium_strings.h" |
42 #include "grit/generated_resources.h" | 42 #include "grit/generated_resources.h" |
43 #include "grit/locale_settings.h" | 43 #include "grit/locale_settings.h" |
44 #include "grit/theme_resources.h" | 44 #include "grit/theme_resources.h" |
45 #include "third_party/skia/include/core/SkBitmap.h" | 45 #include "third_party/skia/include/core/SkBitmap.h" |
46 #include "ui/base/l10n/l10n_util.h" | 46 #include "ui/base/l10n/l10n_util.h" |
47 #include "ui/base/resource/resource_bundle.h" | 47 #include "ui/base/resource/resource_bundle.h" |
48 #include "views/widget/widget.h" | 48 #include "views/widget/widget.h" |
49 | 49 |
50 static const char kOtherNetworksFakePath[] = "?"; | 50 static const char kOtherNetworksFakePath[] = "?"; |
51 | 51 |
52 InternetOptionsHandler::InternetOptionsHandler() | 52 InternetOptionsHandler::InternetOptionsHandler() |
53 : chromeos::CrosOptionsPageUIHandler( | 53 : chromeos::CrosOptionsPageUIHandler( |
54 new chromeos::UserCrosSettingsProvider) { | 54 new chromeos::UserCrosSettingsProvider) { |
55 registrar_.Add(this, NotificationType::REQUIRE_PIN_SETTING_CHANGE_ENDED, | 55 registrar_.Add(this, chrome::REQUIRE_PIN_SETTING_CHANGE_ENDED, |
56 NotificationService::AllSources()); | 56 NotificationService::AllSources()); |
57 registrar_.Add(this, NotificationType::ENTER_PIN_ENDED, | 57 registrar_.Add(this, chrome::ENTER_PIN_ENDED, |
58 NotificationService::AllSources()); | 58 NotificationService::AllSources()); |
59 cros_ = chromeos::CrosLibrary::Get()->GetNetworkLibrary(); | 59 cros_ = chromeos::CrosLibrary::Get()->GetNetworkLibrary(); |
60 if (cros_) { | 60 if (cros_) { |
61 cros_->AddNetworkManagerObserver(this); | 61 cros_->AddNetworkManagerObserver(this); |
62 cros_->AddCellularDataPlanObserver(this); | 62 cros_->AddCellularDataPlanObserver(this); |
63 MonitorNetworks(); | 63 MonitorNetworks(); |
64 } | 64 } |
65 } | 65 } |
66 | 66 |
67 InternetOptionsHandler::~InternetOptionsHandler() { | 67 InternetOptionsHandler::~InternetOptionsHandler() { |
(...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
520 connection_plans.SetBoolean("needsPlan", cellular->needs_new_plan()); | 520 connection_plans.SetBoolean("needsPlan", cellular->needs_new_plan()); |
521 connection_plans.SetBoolean("activated", | 521 connection_plans.SetBoolean("activated", |
522 cellular->activation_state() == chromeos::ACTIVATION_STATE_ACTIVATED); | 522 cellular->activation_state() == chromeos::ACTIVATION_STATE_ACTIVATED); |
523 connection_plans.Set("plans", plan_list); | 523 connection_plans.Set("plans", plan_list); |
524 SetActivationButtonVisibility(cellular, &connection_plans); | 524 SetActivationButtonVisibility(cellular, &connection_plans); |
525 web_ui_->CallJavascriptFunction( | 525 web_ui_->CallJavascriptFunction( |
526 "options.InternetOptions.updateCellularPlans", connection_plans); | 526 "options.InternetOptions.updateCellularPlans", connection_plans); |
527 } | 527 } |
528 | 528 |
529 | 529 |
530 void InternetOptionsHandler::Observe(NotificationType type, | 530 void InternetOptionsHandler::Observe(int type, |
531 const NotificationSource& source, | 531 const NotificationSource& source, |
532 const NotificationDetails& details) { | 532 const NotificationDetails& details) { |
533 chromeos::CrosOptionsPageUIHandler::Observe(type, source, details); | 533 chromeos::CrosOptionsPageUIHandler::Observe(type, source, details); |
534 if (type == NotificationType::REQUIRE_PIN_SETTING_CHANGE_ENDED) { | 534 if (type == chrome::REQUIRE_PIN_SETTING_CHANGE_ENDED) { |
535 bool require_pin = *Details<bool>(details).ptr(); | 535 bool require_pin = *Details<bool>(details).ptr(); |
536 DictionaryValue dictionary; | 536 DictionaryValue dictionary; |
537 dictionary.SetBoolean("requirePin", require_pin); | 537 dictionary.SetBoolean("requirePin", require_pin); |
538 web_ui_->CallJavascriptFunction( | 538 web_ui_->CallJavascriptFunction( |
539 "options.InternetOptions.updateSecurityTab", dictionary); | 539 "options.InternetOptions.updateSecurityTab", dictionary); |
540 } else if (type == NotificationType::ENTER_PIN_ENDED) { | 540 } else if (type == chrome::ENTER_PIN_ENDED) { |
541 // We make an assumption (which is valid for now) that the SIM | 541 // We make an assumption (which is valid for now) that the SIM |
542 // unlock dialog is put up only when the user is trying to enable | 542 // unlock dialog is put up only when the user is trying to enable |
543 // mobile data. | 543 // mobile data. |
544 bool cancelled = *Details<bool>(details).ptr(); | 544 bool cancelled = *Details<bool>(details).ptr(); |
545 if (cancelled) { | 545 if (cancelled) { |
546 DictionaryValue dictionary; | 546 DictionaryValue dictionary; |
547 FillNetworkInfo(&dictionary); | 547 FillNetworkInfo(&dictionary); |
548 web_ui_->CallJavascriptFunction( | 548 web_ui_->CallJavascriptFunction( |
549 "options.InternetOptions.setupAttributes", dictionary); | 549 "options.InternetOptions.setupAttributes", dictionary); |
550 } | 550 } |
(...skipping 653 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1204 dictionary->SetBoolean("accessLocked", cros_->IsLocked()); | 1204 dictionary->SetBoolean("accessLocked", cros_->IsLocked()); |
1205 dictionary->Set("wiredList", GetWiredList()); | 1205 dictionary->Set("wiredList", GetWiredList()); |
1206 dictionary->Set("wirelessList", GetWirelessList()); | 1206 dictionary->Set("wirelessList", GetWirelessList()); |
1207 dictionary->Set("vpnList", GetVPNList()); | 1207 dictionary->Set("vpnList", GetVPNList()); |
1208 dictionary->Set("rememberedList", GetRememberedList()); | 1208 dictionary->Set("rememberedList", GetRememberedList()); |
1209 dictionary->SetBoolean("wifiAvailable", cros_->wifi_available()); | 1209 dictionary->SetBoolean("wifiAvailable", cros_->wifi_available()); |
1210 dictionary->SetBoolean("wifiEnabled", cros_->wifi_enabled()); | 1210 dictionary->SetBoolean("wifiEnabled", cros_->wifi_enabled()); |
1211 dictionary->SetBoolean("cellularAvailable", cros_->cellular_available()); | 1211 dictionary->SetBoolean("cellularAvailable", cros_->cellular_available()); |
1212 dictionary->SetBoolean("cellularEnabled", cros_->cellular_enabled()); | 1212 dictionary->SetBoolean("cellularEnabled", cros_->cellular_enabled()); |
1213 } | 1213 } |
OLD | NEW |