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

Unified Diff: ash/system/chromeos/network/tray_sms.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_sms.cc
diff --git a/ash/system/chromeos/network/tray_sms.cc b/ash/system/chromeos/network/tray_sms.cc
index f2a32a3a95434be15834a568cbbd810802c50538..011bfaf60e07a551120f015cefc251772f28b634 100644
--- a/ash/system/chromeos/network/tray_sms.cc
+++ b/ash/system/chromeos/network/tray_sms.cc
@@ -5,7 +5,6 @@
#include "ash/system/chromeos/network/tray_sms.h"
#include "ash/ash_switches.h"
-#include "ash/shell.h"
#include "ash/system/tray/system_tray.h"
#include "ash/system/tray/tray_constants.h"
#include "ash/system/tray/tray_details_view.h"
@@ -52,8 +51,7 @@ namespace internal {
class TraySms::SmsDefaultView : public TrayItemMore {
public:
explicit SmsDefaultView(TraySms* tray)
- : TrayItemMore(tray, true),
- tray_(tray) {
+ : TrayItemMore(tray, true) {
SetImage(ResourceBundle::GetSharedInstance().GetImageSkiaNamed(
IDR_AURA_UBER_TRAY_SMS));
Update();
@@ -62,7 +60,7 @@ class TraySms::SmsDefaultView : public TrayItemMore {
virtual ~SmsDefaultView() {}
void Update() {
- int message_count = tray_->messages().GetSize();
+ int message_count = static_cast<TraySms*>(tray())->messages().GetSize();
string16 label = l10n_util::GetStringFUTF16(
IDS_ASH_STATUS_TRAY_SMS_MESSAGES, base::IntToString16(message_count));
SetLabel(label);
@@ -70,8 +68,6 @@ class TraySms::SmsDefaultView : public TrayItemMore {
}
private:
- TraySms* tray_;
-
DISALLOW_COPY_AND_ASSIGN(SmsDefaultView);
};
@@ -177,7 +173,7 @@ class TraySms::SmsDetailedView : public TrayDetailsView,
public ViewClickListener {
public:
explicit SmsDetailedView(TraySms* tray)
- : tray_(tray) {
+ : TrayDetailsView(tray) {
Init();
Update();
}
@@ -206,7 +202,7 @@ class TraySms::SmsDetailedView : public TrayDetailsView,
private:
void UpdateMessageList() {
- const base::ListValue& messages = tray_->messages();
+ const base::ListValue& messages = static_cast<TraySms*>(tray())->messages();
scroll_content()->RemoveAllChildViews(true);
for (size_t index = 0; index < messages.GetSize(); ++index) {
const base::DictionaryValue* message = NULL;
@@ -220,7 +216,8 @@ class TraySms::SmsDetailedView : public TrayDetailsView,
continue;
}
SmsMessageView* msgview = new SmsMessageView(
- tray_, SmsMessageView::VIEW_DETAILED, index, number, text);
+ static_cast<TraySms*>(tray()), SmsMessageView::VIEW_DETAILED, index,
+ number, text);
scroll_content()->AddChildView(msgview);
}
scroller()->Layout();
@@ -229,11 +226,9 @@ class TraySms::SmsDetailedView : public TrayDetailsView,
// Overridden from ViewClickListener.
virtual void ClickedOn(views::View* sender) OVERRIDE {
if (sender == footer()->content())
- Shell::GetInstance()->system_tray()->ShowDefaultView(BUBBLE_USE_EXISTING);
+ tray()->system_tray()->ShowDefaultView(BUBBLE_USE_EXISTING);
}
- TraySms* tray_;
-
DISALLOW_COPY_AND_ASSIGN(SmsDetailedView);
};
@@ -278,8 +273,9 @@ class TraySms::SmsNotificationView : public TrayNotificationView {
DISALLOW_COPY_AND_ASSIGN(SmsNotificationView);
};
-TraySms::TraySms()
- : default_(NULL),
+TraySms::TraySms(SystemTray* system_tray)
+ : SystemTrayItem(system_tray),
+ default_(NULL),
detailed_(NULL),
notification_(NULL) {
}

Powered by Google App Engine
This is Rietveld 408576698