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 "ash/shell.h" | 7 #include "ash/shell.h" |
8 #include "ash/shell_window_ids.h" | 8 #include "ash/shell_window_ids.h" |
9 #include "ash/system/audio/audio_observer.h" | 9 #include "ash/system/audio/audio_observer.h" |
10 #include "ash/system/bluetooth/bluetooth_observer.h" | 10 #include "ash/system/bluetooth/bluetooth_observer.h" |
(...skipping 577 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
588 return bluetooth_adapter_->IsPowered(); | 588 return bluetooth_adapter_->IsPowered(); |
589 } | 589 } |
590 | 590 |
591 virtual bool GetCellularScanSupported() OVERRIDE { | 591 virtual bool GetCellularScanSupported() OVERRIDE { |
592 NetworkLibrary* crosnet = CrosLibrary::Get()->GetNetworkLibrary(); | 592 NetworkLibrary* crosnet = CrosLibrary::Get()->GetNetworkLibrary(); |
593 const NetworkDevice* cellular = crosnet->FindCellularDevice(); | 593 const NetworkDevice* cellular = crosnet->FindCellularDevice(); |
594 return cellular ? cellular->support_network_scan() : false; | 594 return cellular ? cellular->support_network_scan() : false; |
595 } | 595 } |
596 | 596 |
597 virtual bool GetCellularCarrierInfo(std::string* carrier_id, | 597 virtual bool GetCellularCarrierInfo(std::string* carrier_id, |
598 std::string* topup_url) OVERRIDE { | 598 std::string* topup_url, |
| 599 std::string* setup_url) OVERRIDE { |
| 600 bool result = false; |
599 NetworkLibrary* crosnet = CrosLibrary::Get()->GetNetworkLibrary(); | 601 NetworkLibrary* crosnet = CrosLibrary::Get()->GetNetworkLibrary(); |
600 const NetworkDevice* cellular = crosnet->FindCellularDevice(); | 602 const NetworkDevice* cellular = crosnet->FindCellularDevice(); |
601 if (cellular) { | 603 if (!cellular) |
602 MobileConfig* config = MobileConfig::GetInstance(); | 604 return false; |
603 if (config->IsReady()) { | 605 |
604 *carrier_id = crosnet->GetCellularHomeCarrierId(); | 606 MobileConfig* config = MobileConfig::GetInstance(); |
605 const MobileConfig::Carrier* carrier = config->GetCarrier(*carrier_id); | 607 if (config->IsReady()) { |
606 if (carrier) { | 608 *carrier_id = crosnet->GetCellularHomeCarrierId(); |
607 *topup_url = carrier->top_up_url(); | 609 const MobileConfig::Carrier* carrier = config->GetCarrier(*carrier_id); |
608 return true; | 610 if (carrier) { |
| 611 *topup_url = carrier->top_up_url(); |
| 612 result = true; |
| 613 } |
| 614 const MobileConfig::LocaleConfig* locale_config = |
| 615 config->GetLocaleConfig(); |
| 616 if (locale_config) { |
| 617 // Only link to setup URL if SIM card is not inserted. |
| 618 if (cellular->is_sim_absent()) { |
| 619 *setup_url = locale_config->setup_url(); |
| 620 result = true; |
609 } | 621 } |
610 } | 622 } |
611 } | 623 } |
612 return false; | 624 return result; |
613 } | 625 } |
614 | 626 |
615 virtual void ShowCellularTopupURL(const std::string& topup_url) OVERRIDE { | 627 virtual void ShowCellularURL(const std::string& url) OVERRIDE { |
616 GetAppropriateBrowser()->ShowSingletonTab(GURL(topup_url)); | 628 GetAppropriateBrowser()->ShowSingletonTab(GURL(url)); |
617 } | 629 } |
618 | 630 |
619 virtual void ChangeProxySettings() OVERRIDE { | 631 virtual void ChangeProxySettings() OVERRIDE { |
620 CHECK(GetUserLoginStatus() == ash::user::LOGGED_IN_NONE); | 632 CHECK(GetUserLoginStatus() == ash::user::LOGGED_IN_NONE); |
621 BaseLoginDisplayHost::default_host()->OpenProxySettings(); | 633 BaseLoginDisplayHost::default_host()->OpenProxySettings(); |
622 } | 634 } |
623 | 635 |
624 private: | 636 private: |
625 // Returns the last active browser. If there is no such browser, creates a new | 637 // Returns the last active browser. If there is no such browser, creates a new |
626 // browser window with an empty tab and returns it. | 638 // browser window with an empty tab and returns it. |
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
960 DISALLOW_COPY_AND_ASSIGN(SystemTrayDelegate); | 972 DISALLOW_COPY_AND_ASSIGN(SystemTrayDelegate); |
961 }; | 973 }; |
962 | 974 |
963 } // namespace | 975 } // namespace |
964 | 976 |
965 ash::SystemTrayDelegate* CreateSystemTrayDelegate(ash::SystemTray* tray) { | 977 ash::SystemTrayDelegate* CreateSystemTrayDelegate(ash::SystemTray* tray) { |
966 return new chromeos::SystemTrayDelegate(tray); | 978 return new chromeos::SystemTrayDelegate(tray); |
967 } | 979 } |
968 | 980 |
969 } // namespace chromeos | 981 } // namespace chromeos |
OLD | NEW |