Index: chrome/browser/chromeos/system/ash_system_tray_delegate.cc |
diff --git a/chrome/browser/chromeos/system/ash_system_tray_delegate.cc b/chrome/browser/chromeos/system/ash_system_tray_delegate.cc |
index 64ef92c61d8c01a46d949570c467563157749761..6172166b7814682f2e5eaaffcdc59b2aac68fe73 100644 |
--- a/chrome/browser/chromeos/system/ash_system_tray_delegate.cc |
+++ b/chrome/browser/chromeos/system/ash_system_tray_delegate.cc |
@@ -270,7 +270,14 @@ class SystemTrayDelegate : public ash::SystemTrayDelegate, |
network_icon_->SetResourceColorTheme(NetworkMenuIcon::COLOR_LIGHT); |
network_icon_dark_->SetResourceColorTheme(NetworkMenuIcon::COLOR_DARK); |
- bluetooth_adapter_ = device::BluetoothAdapterFactory::DefaultAdapter(); |
+ device::BluetoothAdapterFactory::RunCallbackOnAdapterReady( |
+ base::Bind(&SystemTrayDelegate::InitializeOnAdapterReady, |
+ base::Unretained(this))); |
bryeung
2013/01/08 22:24:27
Remind me why using an Unretained here is safe...?
youngki
2013/01/09 15:12:03
First of all my understanding is that AshSystemTra
bryeung
2013/01/09 15:28:01
And you're sure that:
- this is also true of the o
youngki
2013/01/09 19:32:24
I gave a second thought, and there might be race c
|
+ } |
+ |
+ bool InitializeOnAdapterReady( |
bryeung
2013/01/08 22:24:27
why does this need to return a value?
youngki
2013/01/09 15:12:03
This is @asargent's suggestion to make BluetoothEx
bryeung
2013/01/09 15:28:01
Makes sense. Okay.
youngki
2013/01/09 19:32:24
I actually changed it to void because weak pointer
|
+ scoped_refptr<device::BluetoothAdapter> adapter) { |
+ bluetooth_adapter_ = adapter; |
bluetooth_adapter_->AddObserver(this); |
local_state_registrar_.Init(g_browser_process->local_state()); |
@@ -294,6 +301,8 @@ class SystemTrayDelegate : public ash::SystemTrayDelegate, |
if (policy_manager) |
policy_manager->core()->store()->AddObserver(this); |
UpdateEnterpriseDomain(); |
+ |
+ return true; |
} |
virtual ~SystemTrayDelegate() { |