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

Unified Diff: chrome/browser/ui/ash/system_tray_delegate_chromeos.cc

Issue 2166503003: Fix bluetooth adapter access in SystemTrayDelegateChromeOS. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Do not check on InputMethodManager::Get. Created 4 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/ash/system_tray_delegate_chromeos.cc
diff --git a/chrome/browser/ui/ash/system_tray_delegate_chromeos.cc b/chrome/browser/ui/ash/system_tray_delegate_chromeos.cc
index fa81d504c846b7b71d63866b266c1c73e4fc23fa..5860e51f6cf7ea788d54e210ea9fe422b6bd6716 100644
--- a/chrome/browser/ui/ash/system_tray_delegate_chromeos.cc
+++ b/chrome/browser/ui/ash/system_tray_delegate_chromeos.cc
@@ -262,7 +262,7 @@ void SystemTrayDelegateChromeOS::Initialize() {
void SystemTrayDelegateChromeOS::InitializeOnAdapterReady(
scoped_refptr<device::BluetoothAdapter> adapter) {
bluetooth_adapter_ = adapter;
- CHECK(bluetooth_adapter_.get());
+ CHECK(bluetooth_adapter_);
bluetooth_adapter_->AddObserver(this);
local_state_registrar_.reset(new PrefChangeRegistrar);
@@ -304,7 +304,8 @@ SystemTrayDelegateChromeOS::~SystemTrayDelegateChromeOS() {
DBusThreadManager::Get()->GetSessionManagerClient()->RemoveObserver(this);
input_method::InputMethodManager::Get()->RemoveObserver(this);
ui::ime::InputMethodMenuManager::GetInstance()->RemoveObserver(this);
- bluetooth_adapter_->RemoveObserver(this);
+ if (bluetooth_adapter_)
+ bluetooth_adapter_->RemoveObserver(this);
ash::WmShell::Get()->GetSessionStateDelegate()->RemoveSessionStateObserver(
this);
@@ -679,7 +680,7 @@ void SystemTrayDelegateChromeOS::ConnectToBluetoothDevice(
}
bool SystemTrayDelegateChromeOS::IsBluetoothDiscovering() {
- return bluetooth_adapter_->IsDiscovering();
+ return bluetooth_adapter_ && bluetooth_adapter_->IsDiscovering();
}
void SystemTrayDelegateChromeOS::GetCurrentIME(ash::IMEInfo* info) {
@@ -759,16 +760,16 @@ void SystemTrayDelegateChromeOS::ShowOtherNetworkDialog(
}
bool SystemTrayDelegateChromeOS::GetBluetoothAvailable() {
- return bluetooth_adapter_->IsPresent();
+ return bluetooth_adapter_ && bluetooth_adapter_->IsPresent();
}
bool SystemTrayDelegateChromeOS::GetBluetoothEnabled() {
- return bluetooth_adapter_->IsPowered();
+ return bluetooth_adapter_ && bluetooth_adapter_->IsPowered();
}
bool SystemTrayDelegateChromeOS::GetBluetoothDiscovering() {
- return (bluetooth_discovery_session_.get() &&
- bluetooth_discovery_session_->IsActive());
+ return bluetooth_discovery_session_ &&
+ bluetooth_discovery_session_->IsActive();
}
void SystemTrayDelegateChromeOS::ChangeProxySettings() {

Powered by Google App Engine
This is Rietveld 408576698