diff options
author | bartfab@chromium.org <bartfab@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-11-21 21:41:59 +0000 |
---|---|---|
committer | bartfab@chromium.org <bartfab@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-11-21 21:41:59 +0000 |
commit | 1dbddf4b88912f16467936fdebd710d3cd6597ec (patch) | |
tree | bb2c01957180bf2d3b545158988749055b161fb1 /ash/system/bluetooth | |
parent | e91c7bf88c8deb035f98a70925184749e3135ad6 (diff) | |
download | chromium_src-1dbddf4b88912f16467936fdebd710d3cd6597ec.zip chromium_src-1dbddf4b88912f16467936fdebd710d3cd6597ec.tar.gz chromium_src-1dbddf4b88912f16467936fdebd710d3cd6597ec.tar.bz2 |
Stop using shell::GetInstance()->system_tray() in system tray items
This CL provides all SystemTrayItem objects with a pointer to the parent
SystemTray and all Tray*View objects with a pointer to the parent
SystemTrayItem. This allows the objects to walk up the chain and access
the correct system tray once multiple system trays are introduced.
UpdateNagger::~UpdateNagger() in tray_update.cc continues to go through
shell::GetInstance() as the refactoring needed to support multiple system
trays here is more complex and out of my expertise.
BUG=152928
Review URL: https://chromiumcodereview.appspot.com/11415014
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@169141 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash/system/bluetooth')
-rw-r--r-- | ash/system/bluetooth/tray_bluetooth.cc | 14 | ||||
-rw-r--r-- | ash/system/bluetooth/tray_bluetooth.h | 2 |
2 files changed, 9 insertions, 7 deletions
diff --git a/ash/system/bluetooth/tray_bluetooth.cc b/ash/system/bluetooth/tray_bluetooth.cc index 5ef15f7..bb86270 100644 --- a/ash/system/bluetooth/tray_bluetooth.cc +++ b/ash/system/bluetooth/tray_bluetooth.cc @@ -62,8 +62,9 @@ class BluetoothDetailedView : public TrayDetailsView, public ViewClickListener, public views::ButtonListener { public: - explicit BluetoothDetailedView(user::LoginStatus login) - : login_(login), + BluetoothDetailedView(SystemTrayItem* owner, user::LoginStatus login) + : TrayDetailsView(owner), + login_(login), add_device_(NULL), toggle_bluetooth_(NULL), enable_bluetooth_(NULL) { @@ -212,7 +213,7 @@ class BluetoothDetailedView : public TrayDetailsView, ash::SystemTrayDelegate* delegate = ash::Shell::GetInstance()->tray_delegate(); if (sender == footer()->content()) { - Shell::GetInstance()->system_tray()->ShowDefaultView(BUBBLE_USE_EXISTING); + owner()->system_tray()->ShowDefaultView(BUBBLE_USE_EXISTING); } else if (sender == add_device_) { if (!delegate->GetBluetoothEnabled()) delegate->ToggleBluetooth(); @@ -254,8 +255,9 @@ class BluetoothDetailedView : public TrayDetailsView, } // namespace tray -TrayBluetooth::TrayBluetooth() - : default_(NULL), +TrayBluetooth::TrayBluetooth(SystemTray* system_tray) + : SystemTrayItem(system_tray), + default_(NULL), detailed_(NULL) { } @@ -276,7 +278,7 @@ views::View* TrayBluetooth::CreateDetailedView(user::LoginStatus status) { if (!Shell::GetInstance()->tray_delegate()->GetBluetoothAvailable()) return NULL; CHECK(detailed_ == NULL); - detailed_ = new tray::BluetoothDetailedView(status); + detailed_ = new tray::BluetoothDetailedView(this, status); return detailed_; } diff --git a/ash/system/bluetooth/tray_bluetooth.h b/ash/system/bluetooth/tray_bluetooth.h index 2ae655b..2e452c6 100644 --- a/ash/system/bluetooth/tray_bluetooth.h +++ b/ash/system/bluetooth/tray_bluetooth.h @@ -19,7 +19,7 @@ class BluetoothDetailedView; class TrayBluetooth : public SystemTrayItem, public BluetoothObserver { public: - TrayBluetooth(); + explicit TrayBluetooth(SystemTray* system_tray); virtual ~TrayBluetooth(); private: |