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 472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
483 virtual void ShowDateSettings() OVERRIDE { | 483 virtual void ShowDateSettings() OVERRIDE { |
484 content::RecordAction(content::UserMetricsAction("ShowDateOptions")); | 484 content::RecordAction(content::UserMetricsAction("ShowDateOptions")); |
485 std::string sub_page = std::string(chrome::kSearchSubPage) + "#" + | 485 std::string sub_page = std::string(chrome::kSearchSubPage) + "#" + |
486 l10n_util::GetStringUTF8(IDS_OPTIONS_SETTINGS_SECTION_TITLE_DATETIME); | 486 l10n_util::GetStringUTF8(IDS_OPTIONS_SETTINGS_SECTION_TITLE_DATETIME); |
487 chrome::ShowSettingsSubPage(GetAppropriateBrowser(), sub_page); | 487 chrome::ShowSettingsSubPage(GetAppropriateBrowser(), sub_page); |
488 } | 488 } |
489 | 489 |
490 virtual void ShowNetworkSettings(const std::string& service_path) OVERRIDE { | 490 virtual void ShowNetworkSettings(const std::string& service_path) OVERRIDE { |
491 if (!LoginState::Get()->IsUserLoggedIn()) | 491 if (!LoginState::Get()->IsUserLoggedIn()) |
492 return; | 492 return; |
493 | 493 network_connect::ShowNetworkSettings(service_path); |
494 std::string page = chrome::kInternetOptionsSubPage; | |
495 const chromeos::NetworkState* network = service_path.empty() ? NULL : | |
496 NetworkHandler::Get()->network_state_handler()->GetNetworkState( | |
497 service_path); | |
498 if (network) { | |
499 std::string name(network->name()); | |
500 if (name.empty() && network->type() == flimflam::kTypeEthernet) | |
501 name = l10n_util::GetStringUTF8(IDS_STATUSBAR_NETWORK_DEVICE_ETHERNET); | |
502 page += base::StringPrintf( | |
503 "?servicePath=%s&networkType=%s&networkName=%s", | |
504 net::EscapeUrlEncodedData(service_path, true).c_str(), | |
505 net::EscapeUrlEncodedData(network->type(), true).c_str(), | |
506 net::EscapeUrlEncodedData(name, false).c_str()); | |
507 } | |
508 content::RecordAction( | |
509 content::UserMetricsAction("OpenInternetOptionsDialog")); | |
510 chrome::ShowSettingsSubPage(GetAppropriateBrowser(), page); | |
511 } | 494 } |
512 | 495 |
513 virtual void ShowBluetoothSettings() OVERRIDE { | 496 virtual void ShowBluetoothSettings() OVERRIDE { |
514 // TODO(sad): Make this work. | 497 // TODO(sad): Make this work. |
515 } | 498 } |
516 | 499 |
517 virtual void ShowDisplaySettings() OVERRIDE { | 500 virtual void ShowDisplaySettings() OVERRIDE { |
518 content::RecordAction(content::UserMetricsAction("ShowDisplayOptions")); | 501 content::RecordAction(content::UserMetricsAction("ShowDisplayOptions")); |
519 chrome::ShowSettingsSubPage(GetAppropriateBrowser(), | 502 chrome::ShowSettingsSubPage(GetAppropriateBrowser(), |
520 kDisplaySettingsSubPageName); | 503 kDisplaySettingsSubPageName); |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
761 return; | 744 return; |
762 | 745 |
763 *list = ConvertToDriveStatusList( | 746 *list = ConvertToDriveStatusList( |
764 integration_service->job_list()->GetJobInfoList()); | 747 integration_service->job_list()->GetJobInfoList()); |
765 } | 748 } |
766 | 749 |
767 virtual void ConfigureNetwork(const std::string& network_id) OVERRIDE { | 750 virtual void ConfigureNetwork(const std::string& network_id) OVERRIDE { |
768 network_connect::HandleUnconfiguredNetwork(network_id, GetNativeWindow()); | 751 network_connect::HandleUnconfiguredNetwork(network_id, GetNativeWindow()); |
769 } | 752 } |
770 | 753 |
771 virtual void ConnectToNetwork(const std::string& network_id) OVERRIDE { | 754 virtual void EnrollOrConfigureNetwork( |
772 DCHECK(!CommandLine::ForCurrentProcess()->HasSwitch( | 755 const std::string& network_id, |
773 chromeos::switches::kUseNewNetworkConnectionHandler)); | 756 gfx::NativeWindow parent_window) OVERRIDE { |
774 network_connect::ConnectResult result = | 757 if (network_connect::EnrollNetwork(network_id, parent_window)) |
775 network_connect::ConnectToNetwork(network_id, GetNativeWindow()); | 758 return; |
776 if (result == network_connect::NETWORK_NOT_FOUND) | 759 network_connect::HandleUnconfiguredNetwork(network_id, parent_window); |
777 ShowNetworkSettings(""); | |
778 else if (result == network_connect::CONNECT_NOT_STARTED) | |
779 ShowNetworkSettings(network_id); | |
780 } | 760 } |
781 | 761 |
782 virtual void ManageBluetoothDevices() OVERRIDE { | 762 virtual void ManageBluetoothDevices() OVERRIDE { |
783 content::RecordAction( | 763 content::RecordAction( |
784 content::UserMetricsAction("ShowBluetoothSettingsPage")); | 764 content::UserMetricsAction("ShowBluetoothSettingsPage")); |
785 std::string sub_page = std::string(chrome::kSearchSubPage) + "#" + | 765 std::string sub_page = std::string(chrome::kSearchSubPage) + "#" + |
786 l10n_util::GetStringUTF8(IDS_OPTIONS_SETTINGS_SECTION_TITLE_BLUETOOTH); | 766 l10n_util::GetStringUTF8(IDS_OPTIONS_SETTINGS_SECTION_TITLE_BLUETOOTH); |
787 chrome::ShowSettingsSubPage(GetAppropriateBrowser(), sub_page); | 767 chrome::ShowSettingsSubPage(GetAppropriateBrowser(), sub_page); |
788 } | 768 } |
789 | 769 |
790 virtual void ToggleBluetooth() OVERRIDE { | 770 virtual void ToggleBluetooth() OVERRIDE { |
791 bluetooth_adapter_->SetPowered(!bluetooth_adapter_->IsPowered(), | 771 bluetooth_adapter_->SetPowered(!bluetooth_adapter_->IsPowered(), |
792 base::Bind(&base::DoNothing), | 772 base::Bind(&base::DoNothing), |
793 base::Bind(&BluetoothPowerFailure)); | 773 base::Bind(&BluetoothPowerFailure)); |
794 } | 774 } |
795 | 775 |
796 virtual void ShowMobileSimDialog() OVERRIDE { | 776 virtual void ShowMobileSimDialog() OVERRIDE { |
797 SimDialogDelegate::ShowDialog(GetNativeWindow(), | 777 SimDialogDelegate::ShowDialog(GetNativeWindow(), |
798 SimDialogDelegate::SIM_DIALOG_UNLOCK); | 778 SimDialogDelegate::SIM_DIALOG_UNLOCK); |
799 } | 779 } |
800 | 780 |
| 781 virtual void ShowMobileSetup(const std::string& network_id) OVERRIDE { |
| 782 network_connect::ShowMobileSetup(network_id); |
| 783 } |
| 784 |
801 virtual void ShowOtherWifi() OVERRIDE { | 785 virtual void ShowOtherWifi() OVERRIDE { |
802 NetworkConfigView::ShowForType(chromeos::TYPE_WIFI, GetNativeWindow()); | 786 NetworkConfigView::ShowForType(flimflam::kTypeWifi, GetNativeWindow()); |
803 } | 787 } |
804 | 788 |
805 virtual void ShowOtherVPN() OVERRIDE { | 789 virtual void ShowOtherVPN() OVERRIDE { |
806 NetworkConfigView::ShowForType(chromeos::TYPE_VPN, GetNativeWindow()); | 790 NetworkConfigView::ShowForType(flimflam::kTypeVPN, GetNativeWindow()); |
807 } | 791 } |
808 | 792 |
809 virtual void ShowOtherCellular() OVERRIDE { | 793 virtual void ShowOtherCellular() OVERRIDE { |
810 ChooseMobileNetworkDialog::ShowDialog(GetNativeWindow()); | 794 ChooseMobileNetworkDialog::ShowDialog(GetNativeWindow()); |
811 } | 795 } |
812 | 796 |
813 virtual bool GetBluetoothAvailable() OVERRIDE { | 797 virtual bool GetBluetoothAvailable() OVERRIDE { |
814 return bluetooth_adapter_->IsPresent(); | 798 return bluetooth_adapter_->IsPresent(); |
815 } | 799 } |
816 | 800 |
(...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1246 search_mapped_to_caps_lock = true; | 1230 search_mapped_to_caps_lock = true; |
1247 GetSystemTrayNotifier()->NotifyCapsLockChanged( | 1231 GetSystemTrayNotifier()->NotifyCapsLockChanged( |
1248 enabled, search_mapped_to_caps_lock); | 1232 enabled, search_mapped_to_caps_lock); |
1249 } | 1233 } |
1250 | 1234 |
1251 // Overridden from ash::NetworkTrayDelegate | 1235 // Overridden from ash::NetworkTrayDelegate |
1252 virtual void NotificationLinkClicked( | 1236 virtual void NotificationLinkClicked( |
1253 ash::NetworkObserver::MessageType message_type, | 1237 ash::NetworkObserver::MessageType message_type, |
1254 size_t link_index) OVERRIDE { | 1238 size_t link_index) OVERRIDE { |
1255 if (message_type == ash::NetworkObserver::ERROR_OUT_OF_CREDITS) { | 1239 if (message_type == ash::NetworkObserver::ERROR_OUT_OF_CREDITS) { |
1256 const CellularNetwork* cellular = | 1240 const NetworkState* cellular = |
1257 NetworkLibrary::Get()->cellular_network(); | 1241 NetworkHandler::Get()->network_state_handler()-> |
1258 if (cellular) | 1242 FirstNetworkByType(flimflam::kTypeCellular); |
1259 ConnectToNetwork(cellular->service_path()); | 1243 std::string service_path = cellular ? cellular->path() : ""; |
| 1244 ShowNetworkSettings(service_path); |
| 1245 |
1260 ash::Shell::GetInstance()->system_tray_notifier()-> | 1246 ash::Shell::GetInstance()->system_tray_notifier()-> |
1261 NotifyClearNetworkMessage(message_type); | 1247 NotifyClearNetworkMessage(message_type); |
1262 } | 1248 } |
1263 if (message_type != ash::NetworkObserver::MESSAGE_DATA_PROMO) | 1249 if (message_type != ash::NetworkObserver::MESSAGE_DATA_PROMO) |
1264 return; | 1250 return; |
1265 // If we have deal info URL defined that means that there're | 1251 // If we have deal info URL defined that means that there're |
1266 // 2 links in bubble. Let the user close it manually then thus giving | 1252 // 2 links in bubble. Let the user close it manually then thus giving |
1267 // ability to navigate to second link. | 1253 // ability to navigate to second link. |
1268 // mobile_data_bubble_ will be set to NULL in BubbleClosing callback. | 1254 // mobile_data_bubble_ will be set to NULL in BubbleClosing callback. |
1269 std::string deal_info_url = data_promo_notification_->deal_info_url(); | 1255 std::string deal_info_url = data_promo_notification_->deal_info_url(); |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1369 DISALLOW_COPY_AND_ASSIGN(SystemTrayDelegate); | 1355 DISALLOW_COPY_AND_ASSIGN(SystemTrayDelegate); |
1370 }; | 1356 }; |
1371 | 1357 |
1372 } // namespace | 1358 } // namespace |
1373 | 1359 |
1374 ash::SystemTrayDelegate* CreateSystemTrayDelegate() { | 1360 ash::SystemTrayDelegate* CreateSystemTrayDelegate() { |
1375 return new chromeos::SystemTrayDelegate(); | 1361 return new chromeos::SystemTrayDelegate(); |
1376 } | 1362 } |
1377 | 1363 |
1378 } // namespace chromeos | 1364 } // namespace chromeos |
OLD | NEW |