OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/system/ash_system_tray_delegate.h" | 5 #include "chrome/browser/chromeos/system/ash_system_tray_delegate.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
481 virtual void ShowDateSettings() OVERRIDE { | 481 virtual void ShowDateSettings() OVERRIDE { |
482 content::RecordAction(content::UserMetricsAction("ShowDateOptions")); | 482 content::RecordAction(content::UserMetricsAction("ShowDateOptions")); |
483 std::string sub_page = std::string(chrome::kSearchSubPage) + "#" + | 483 std::string sub_page = std::string(chrome::kSearchSubPage) + "#" + |
484 l10n_util::GetStringUTF8(IDS_OPTIONS_SETTINGS_SECTION_TITLE_DATETIME); | 484 l10n_util::GetStringUTF8(IDS_OPTIONS_SETTINGS_SECTION_TITLE_DATETIME); |
485 chrome::ShowSettingsSubPage(GetAppropriateBrowser(), sub_page); | 485 chrome::ShowSettingsSubPage(GetAppropriateBrowser(), sub_page); |
486 } | 486 } |
487 | 487 |
488 virtual void ShowNetworkSettings(const std::string& service_path) OVERRIDE { | 488 virtual void ShowNetworkSettings(const std::string& service_path) OVERRIDE { |
489 if (!LoginState::Get()->IsUserLoggedIn()) | 489 if (!LoginState::Get()->IsUserLoggedIn()) |
490 return; | 490 return; |
491 | 491 network_connect::ShowNetworkSettings(service_path); |
492 std::string page = chrome::kInternetOptionsSubPage; | |
493 const chromeos::NetworkState* network = service_path.empty() ? NULL : | |
494 NetworkHandler::Get()->network_state_handler()->GetNetworkState( | |
495 service_path); | |
496 if (network) { | |
497 std::string name(network->name()); | |
498 if (name.empty() && network->type() == flimflam::kTypeEthernet) | |
499 name = l10n_util::GetStringUTF8(IDS_STATUSBAR_NETWORK_DEVICE_ETHERNET); | |
500 page += base::StringPrintf( | |
501 "?servicePath=%s&networkType=%s&networkName=%s", | |
502 net::EscapeUrlEncodedData(service_path, true).c_str(), | |
503 net::EscapeUrlEncodedData(network->type(), true).c_str(), | |
504 net::EscapeUrlEncodedData(name, false).c_str()); | |
505 } | |
506 content::RecordAction( | |
507 content::UserMetricsAction("OpenInternetOptionsDialog")); | |
508 chrome::ShowSettingsSubPage(GetAppropriateBrowser(), page); | |
509 } | 492 } |
510 | 493 |
511 virtual void ShowBluetoothSettings() OVERRIDE { | 494 virtual void ShowBluetoothSettings() OVERRIDE { |
512 // TODO(sad): Make this work. | 495 // TODO(sad): Make this work. |
513 } | 496 } |
514 | 497 |
515 virtual void ShowDisplaySettings() OVERRIDE { | 498 virtual void ShowDisplaySettings() OVERRIDE { |
516 content::RecordAction(content::UserMetricsAction("ShowDisplayOptions")); | 499 content::RecordAction(content::UserMetricsAction("ShowDisplayOptions")); |
517 chrome::ShowSettingsSubPage(GetAppropriateBrowser(), | 500 chrome::ShowSettingsSubPage(GetAppropriateBrowser(), |
518 kDisplaySettingsSubPageName); | 501 kDisplaySettingsSubPageName); |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
759 return; | 742 return; |
760 | 743 |
761 *list = ConvertToDriveStatusList( | 744 *list = ConvertToDriveStatusList( |
762 integration_service->job_list()->GetJobInfoList()); | 745 integration_service->job_list()->GetJobInfoList()); |
763 } | 746 } |
764 | 747 |
765 virtual void ConfigureNetwork(const std::string& network_id) OVERRIDE { | 748 virtual void ConfigureNetwork(const std::string& network_id) OVERRIDE { |
766 network_connect::HandleUnconfiguredNetwork(network_id, GetNativeWindow()); | 749 network_connect::HandleUnconfiguredNetwork(network_id, GetNativeWindow()); |
767 } | 750 } |
768 | 751 |
769 virtual void ConnectToNetwork(const std::string& network_id) OVERRIDE { | 752 virtual void EnrollOrConfigureNetwork( |
770 DCHECK(!CommandLine::ForCurrentProcess()->HasSwitch( | 753 const std::string& network_id, |
771 chromeos::switches::kUseNewNetworkConnectionHandler)); | 754 gfx::NativeWindow parent_window) OVERRIDE { |
772 network_connect::ConnectResult result = | 755 if (network_connect::EnrollNetwork(network_id, parent_window)) |
773 network_connect::ConnectToNetwork(network_id, GetNativeWindow()); | 756 return; |
774 if (result == network_connect::NETWORK_NOT_FOUND) | 757 network_connect::HandleUnconfiguredNetwork(network_id, parent_window); |
775 ShowNetworkSettings(""); | |
776 else if (result == network_connect::CONNECT_NOT_STARTED) | |
777 ShowNetworkSettings(network_id); | |
778 } | 758 } |
779 | 759 |
780 virtual void ManageBluetoothDevices() OVERRIDE { | 760 virtual void ManageBluetoothDevices() OVERRIDE { |
781 content::RecordAction( | 761 content::RecordAction( |
782 content::UserMetricsAction("ShowBluetoothSettingsPage")); | 762 content::UserMetricsAction("ShowBluetoothSettingsPage")); |
783 std::string sub_page = std::string(chrome::kSearchSubPage) + "#" + | 763 std::string sub_page = std::string(chrome::kSearchSubPage) + "#" + |
784 l10n_util::GetStringUTF8(IDS_OPTIONS_SETTINGS_SECTION_TITLE_BLUETOOTH); | 764 l10n_util::GetStringUTF8(IDS_OPTIONS_SETTINGS_SECTION_TITLE_BLUETOOTH); |
785 chrome::ShowSettingsSubPage(GetAppropriateBrowser(), sub_page); | 765 chrome::ShowSettingsSubPage(GetAppropriateBrowser(), sub_page); |
786 } | 766 } |
787 | 767 |
788 virtual void ToggleBluetooth() OVERRIDE { | 768 virtual void ToggleBluetooth() OVERRIDE { |
789 bluetooth_adapter_->SetPowered(!bluetooth_adapter_->IsPowered(), | 769 bluetooth_adapter_->SetPowered(!bluetooth_adapter_->IsPowered(), |
790 base::Bind(&base::DoNothing), | 770 base::Bind(&base::DoNothing), |
791 base::Bind(&BluetoothPowerFailure)); | 771 base::Bind(&BluetoothPowerFailure)); |
792 } | 772 } |
793 | 773 |
794 virtual void ShowMobileSimDialog() OVERRIDE { | 774 virtual void ShowMobileSimDialog() OVERRIDE { |
795 SimDialogDelegate::ShowDialog(GetNativeWindow(), | 775 SimDialogDelegate::ShowDialog(GetNativeWindow(), |
796 SimDialogDelegate::SIM_DIALOG_UNLOCK); | 776 SimDialogDelegate::SIM_DIALOG_UNLOCK); |
797 } | 777 } |
798 | 778 |
| 779 virtual void ShowMobileSetup(const std::string& network_id) OVERRIDE { |
| 780 network_connect::ShowMobileSetup(network_id); |
| 781 } |
| 782 |
799 virtual void ShowOtherWifi() OVERRIDE { | 783 virtual void ShowOtherWifi() OVERRIDE { |
800 NetworkConfigView::ShowForType(chromeos::TYPE_WIFI, GetNativeWindow()); | 784 NetworkConfigView::ShowForType(flimflam::kTypeWifi, GetNativeWindow()); |
801 } | 785 } |
802 | 786 |
803 virtual void ShowOtherVPN() OVERRIDE { | 787 virtual void ShowOtherVPN() OVERRIDE { |
804 NetworkConfigView::ShowForType(chromeos::TYPE_VPN, GetNativeWindow()); | 788 NetworkConfigView::ShowForType(flimflam::kTypeVPN, GetNativeWindow()); |
805 } | 789 } |
806 | 790 |
807 virtual void ShowOtherCellular() OVERRIDE { | 791 virtual void ShowOtherCellular() OVERRIDE { |
808 ChooseMobileNetworkDialog::ShowDialog(GetNativeWindow()); | 792 ChooseMobileNetworkDialog::ShowDialog(GetNativeWindow()); |
809 } | 793 } |
810 | 794 |
811 virtual bool GetBluetoothAvailable() OVERRIDE { | 795 virtual bool GetBluetoothAvailable() OVERRIDE { |
812 return bluetooth_adapter_->IsPresent(); | 796 return bluetooth_adapter_->IsPresent(); |
813 } | 797 } |
814 | 798 |
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1217 search_mapped_to_caps_lock = true; | 1201 search_mapped_to_caps_lock = true; |
1218 GetSystemTrayNotifier()->NotifyCapsLockChanged( | 1202 GetSystemTrayNotifier()->NotifyCapsLockChanged( |
1219 enabled, search_mapped_to_caps_lock); | 1203 enabled, search_mapped_to_caps_lock); |
1220 } | 1204 } |
1221 | 1205 |
1222 // Overridden from ash::NetworkTrayDelegate | 1206 // Overridden from ash::NetworkTrayDelegate |
1223 virtual void NotificationLinkClicked( | 1207 virtual void NotificationLinkClicked( |
1224 ash::NetworkObserver::MessageType message_type, | 1208 ash::NetworkObserver::MessageType message_type, |
1225 size_t link_index) OVERRIDE { | 1209 size_t link_index) OVERRIDE { |
1226 if (message_type == ash::NetworkObserver::ERROR_OUT_OF_CREDITS) { | 1210 if (message_type == ash::NetworkObserver::ERROR_OUT_OF_CREDITS) { |
1227 const CellularNetwork* cellular = | 1211 const NetworkState* cellular = |
1228 NetworkLibrary::Get()->cellular_network(); | 1212 NetworkHandler::Get()->network_state_handler()-> |
1229 if (cellular) | 1213 FirstNetworkByType(flimflam::kTypeCellular); |
1230 ConnectToNetwork(cellular->service_path()); | 1214 std::string service_path = cellular ? cellular->path() : ""; |
| 1215 ShowNetworkSettings(service_path); |
| 1216 |
1231 ash::Shell::GetInstance()->system_tray_notifier()-> | 1217 ash::Shell::GetInstance()->system_tray_notifier()-> |
1232 NotifyClearNetworkMessage(message_type); | 1218 NotifyClearNetworkMessage(message_type); |
1233 } | 1219 } |
1234 if (message_type != ash::NetworkObserver::MESSAGE_DATA_PROMO) | 1220 if (message_type != ash::NetworkObserver::MESSAGE_DATA_PROMO) |
1235 return; | 1221 return; |
1236 // If we have deal info URL defined that means that there're | 1222 // If we have deal info URL defined that means that there're |
1237 // 2 links in bubble. Let the user close it manually then thus giving | 1223 // 2 links in bubble. Let the user close it manually then thus giving |
1238 // ability to navigate to second link. | 1224 // ability to navigate to second link. |
1239 // mobile_data_bubble_ will be set to NULL in BubbleClosing callback. | 1225 // mobile_data_bubble_ will be set to NULL in BubbleClosing callback. |
1240 std::string deal_info_url = data_promo_notification_->deal_info_url(); | 1226 std::string deal_info_url = data_promo_notification_->deal_info_url(); |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1340 DISALLOW_COPY_AND_ASSIGN(SystemTrayDelegate); | 1326 DISALLOW_COPY_AND_ASSIGN(SystemTrayDelegate); |
1341 }; | 1327 }; |
1342 | 1328 |
1343 } // namespace | 1329 } // namespace |
1344 | 1330 |
1345 ash::SystemTrayDelegate* CreateSystemTrayDelegate() { | 1331 ash::SystemTrayDelegate* CreateSystemTrayDelegate() { |
1346 return new chromeos::SystemTrayDelegate(); | 1332 return new chromeos::SystemTrayDelegate(); |
1347 } | 1333 } |
1348 | 1334 |
1349 } // namespace chromeos | 1335 } // namespace chromeos |
OLD | NEW |