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

Unified Diff: ash/system/chromeos/network/tray_network.cc

Issue 11415014: Stop using shell::GetInstance()->system_tray() in system tray items (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Modified CL to provide TrayItems and Tray*Views with parent pointers instead. Created 8 years, 1 month 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: ash/system/chromeos/network/tray_network.cc
diff --git a/ash/system/chromeos/network/tray_network.cc b/ash/system/chromeos/network/tray_network.cc
index 38818fa30df5633e52224db9d8f96b33f5f4383f..64f0dd0577f6ce357721c9826623931ff80d8a27 100644
--- a/ash/system/chromeos/network/tray_network.cc
+++ b/ash/system/chromeos/network/tray_network.cc
@@ -79,8 +79,8 @@ class NetworkMessages {
class NetworkTrayView : public TrayItemView {
public:
- NetworkTrayView(ColorTheme size, bool tray_icon)
- : color_theme_(size), tray_icon_(tray_icon) {
+ NetworkTrayView(SystemTrayItem* tray, ColorTheme size, bool tray_icon)
+ : TrayItemView(tray), color_theme_(size), tray_icon_(tray_icon) {
SetLayoutManager(
new views::BoxLayout(views::BoxLayout::kHorizontal, 0, 0, 0));
@@ -114,8 +114,8 @@ class NetworkTrayView : public TrayItemView {
class NetworkDefaultView : public TrayItemMore {
public:
- NetworkDefaultView(SystemTrayItem* owner, bool show_more)
- : TrayItemMore(owner, show_more) {
+ NetworkDefaultView(SystemTrayItem* tray, bool show_more)
+ : TrayItemMore(tray, show_more) {
Update();
}
@@ -136,8 +136,10 @@ class NetworkDefaultView : public TrayItemMore {
class NetworkListDetailedView : public NetworkListDetailedViewBase {
public:
- NetworkListDetailedView(user::LoginStatus login, int header_string_id)
- : NetworkListDetailedViewBase(login, header_string_id),
+ NetworkListDetailedView(SystemTrayItem* tray,
+ user::LoginStatus login,
+ int header_string_id)
+ : NetworkListDetailedViewBase(tray, login, header_string_id),
airplane_(NULL),
button_wifi_(NULL),
button_mobile_(NULL),
@@ -361,7 +363,8 @@ class NetworkListDetailedView : public NetworkListDetailedViewBase {
class NetworkWifiDetailedView : public NetworkDetailedView {
public:
- explicit NetworkWifiDetailedView(bool wifi_enabled) {
+ NetworkWifiDetailedView(SystemTrayItem* tray, bool wifi_enabled)
+ : NetworkDetailedView(tray) {
SetLayoutManager(new views::BoxLayout(views::BoxLayout::kHorizontal,
kTrayPopupPaddingHorizontal,
10,
@@ -505,8 +508,9 @@ class NetworkNotificationView : public TrayNotificationView {
} // namespace tray
-TrayNetwork::TrayNetwork()
- : tray_(NULL),
+TrayNetwork::TrayNetwork(SystemTray* system_tray)
+ : SystemTrayItem(system_tray),
+ tray_(NULL),
default_(NULL),
detailed_(NULL),
notification_(NULL),
@@ -519,7 +523,7 @@ TrayNetwork::~TrayNetwork() {
views::View* TrayNetwork::CreateTrayView(user::LoginStatus status) {
CHECK(tray_ == NULL);
- tray_ = new tray::NetworkTrayView(tray::LIGHT, true /*tray_icon*/);
+ tray_ = new tray::NetworkTrayView(this, tray::LIGHT, true /*tray_icon*/);
return tray_;
}
@@ -538,11 +542,12 @@ views::View* TrayNetwork::CreateDetailedView(user::LoginStatus status) {
if (request_wifi_view_) {
SystemTrayDelegate* delegate = Shell::GetInstance()->tray_delegate();
// The Wi-Fi state is not toggled yet at this point.
- detailed_ = new tray::NetworkWifiDetailedView(!delegate->GetWifiEnabled());
+ detailed_ = new tray::NetworkWifiDetailedView(this,
+ !delegate->GetWifiEnabled());
request_wifi_view_ = false;
} else {
detailed_ = new tray::NetworkListDetailedView(
- status, IDS_ASH_STATUS_TRAY_NETWORK);
+ this, status, IDS_ASH_STATUS_TRAY_NETWORK);
detailed_->Init();
}
return detailed_;

Powered by Google App Engine
This is Rietveld 408576698