Chromium Code Reviews| 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 MobileConfig* config = MobileConfig::GetInstance(); |
| 603 if (config->IsReady()) { | 605 if (config->IsReady()) { |
| 604 *carrier_id = crosnet->GetCellularHomeCarrierId(); | 606 *carrier_id = crosnet->GetCellularHomeCarrierId(); |
| 605 const MobileConfig::Carrier* carrier = config->GetCarrier(*carrier_id); | 607 const MobileConfig::Carrier* carrier = config->GetCarrier(*carrier_id); |
| 606 if (carrier) { | 608 if (carrier) { |
| 607 *topup_url = carrier->top_up_url(); | 609 *topup_url = carrier->top_up_url(); |
| 608 return true; | 610 result = true; |
| 611 } | |
| 612 const MobileConfig::LocaleConfig* locale_config = | |
| 613 config->GetLocaleConfig(); | |
| 614 if (locale_config) { | |
| 615 // Only link to setup URL if SIM card is not inserted. | |
| 616 if (cellular->technology_family() == TECHNOLOGY_FAMILY_GSM && | |
|
Nikita (slow)
2012/04/24 10:41:50
Based on http://code.google.com/p/chromium-os/issu
| |
| 617 !cellular->is_sim_locked() && | |
| 618 cellular->imsi().empty()) { | |
| 619 *setup_url = locale_config->setup_url(); | |
| 620 result = true; | |
| 621 } | |
| 609 } | 622 } |
| 610 } | 623 } |
| 611 } | 624 } |
| 612 return false; | 625 return result; |
| 613 } | 626 } |
| 614 | 627 |
| 615 virtual void ShowCellularTopupURL(const std::string& topup_url) OVERRIDE { | 628 virtual void ShowCellularURL(const std::string& url) OVERRIDE { |
| 616 GetAppropriateBrowser()->ShowSingletonTab(GURL(topup_url)); | 629 GetAppropriateBrowser()->ShowSingletonTab(GURL(url)); |
| 617 } | 630 } |
| 618 | 631 |
| 619 virtual void ChangeProxySettings() OVERRIDE { | 632 virtual void ChangeProxySettings() OVERRIDE { |
| 620 CHECK(GetUserLoginStatus() == ash::user::LOGGED_IN_NONE); | 633 CHECK(GetUserLoginStatus() == ash::user::LOGGED_IN_NONE); |
| 621 BaseLoginDisplayHost::default_host()->OpenProxySettings(); | 634 BaseLoginDisplayHost::default_host()->OpenProxySettings(); |
| 622 } | 635 } |
| 623 | 636 |
| 624 private: | 637 private: |
| 625 // Returns the last active browser. If there is no such browser, creates a new | 638 // Returns the last active browser. If there is no such browser, creates a new |
| 626 // browser window with an empty tab and returns it. | 639 // 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); | 973 DISALLOW_COPY_AND_ASSIGN(SystemTrayDelegate); |
| 961 }; | 974 }; |
| 962 | 975 |
| 963 } // namespace | 976 } // namespace |
| 964 | 977 |
| 965 ash::SystemTrayDelegate* CreateSystemTrayDelegate(ash::SystemTray* tray) { | 978 ash::SystemTrayDelegate* CreateSystemTrayDelegate(ash::SystemTray* tray) { |
| 966 return new chromeos::SystemTrayDelegate(tray); | 979 return new chromeos::SystemTrayDelegate(tray); |
| 967 } | 980 } |
| 968 | 981 |
| 969 } // namespace chromeos | 982 } // namespace chromeos |
| OLD | NEW |