Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(341)

Side by Side Diff: chrome/browser/chromeos/system/ash_system_tray_delegate.cc

Issue 10201015: [cros] Add network tray item for mobile network setup. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: refactor Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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) {
stevenjb 2012/04/25 01:29:49 if (!cellular) return; would simplify this a bit.
Nikita (slow) 2012/04/25 14:01:38 Done.
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->is_sim_absent()) {
617 *setup_url = locale_config->setup_url();
618 result = true;
stevenjb 2012/04/25 01:29:49 The return logic seems flawed now. We can return t
Nikita (slow) 2012/04/25 14:01:38 LocaleConfig might be available even if current ca
stevenjb 2012/04/25 16:47:55 This seems fine with the updated header. I think i
619 }
609 } 620 }
610 } 621 }
611 } 622 }
612 return false; 623 return result;
613 } 624 }
614 625
615 virtual void ShowCellularTopupURL(const std::string& topup_url) OVERRIDE { 626 virtual void ShowCellularURL(const std::string& url) OVERRIDE {
616 GetAppropriateBrowser()->ShowSingletonTab(GURL(topup_url)); 627 GetAppropriateBrowser()->ShowSingletonTab(GURL(url));
617 } 628 }
618 629
619 virtual void ChangeProxySettings() OVERRIDE { 630 virtual void ChangeProxySettings() OVERRIDE {
620 CHECK(GetUserLoginStatus() == ash::user::LOGGED_IN_NONE); 631 CHECK(GetUserLoginStatus() == ash::user::LOGGED_IN_NONE);
621 BaseLoginDisplayHost::default_host()->OpenProxySettings(); 632 BaseLoginDisplayHost::default_host()->OpenProxySettings();
622 } 633 }
623 634
624 private: 635 private:
625 // Returns the last active browser. If there is no such browser, creates a new 636 // Returns the last active browser. If there is no such browser, creates a new
626 // browser window with an empty tab and returns it. 637 // browser window with an empty tab and returns it.
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after
960 DISALLOW_COPY_AND_ASSIGN(SystemTrayDelegate); 971 DISALLOW_COPY_AND_ASSIGN(SystemTrayDelegate);
961 }; 972 };
962 973
963 } // namespace 974 } // namespace
964 975
965 ash::SystemTrayDelegate* CreateSystemTrayDelegate(ash::SystemTray* tray) { 976 ash::SystemTrayDelegate* CreateSystemTrayDelegate(ash::SystemTray* tray) {
966 return new chromeos::SystemTrayDelegate(tray); 977 return new chromeos::SystemTrayDelegate(tray);
967 } 978 }
968 979
969 } // namespace chromeos 980 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698