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

Unified Diff: ash/system/ime/tray_ime.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/ime/tray_ime.cc
diff --git a/ash/system/ime/tray_ime.cc b/ash/system/ime/tray_ime.cc
index bcf4c35760743c4f68295939529455f515d8f70f..fd1089b7e6a0f89dbadb10cfb9cab2f113a226c3 100644
--- a/ash/system/ime/tray_ime.cc
+++ b/ash/system/ime/tray_ime.cc
@@ -37,8 +37,8 @@ namespace tray {
class IMEDefaultView : public TrayItemMore {
public:
- explicit IMEDefaultView(SystemTrayItem* owner)
- : TrayItemMore(owner, true) {
+ explicit IMEDefaultView(SystemTrayItem* tray)
+ : TrayItemMore(tray, true) {
ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance();
SetImage(bundle.GetImageNamed(
@@ -63,8 +63,9 @@ class IMEDefaultView : public TrayItemMore {
class IMEDetailedView : public TrayDetailsView,
public ViewClickListener {
public:
- IMEDetailedView(SystemTrayItem* owner, user::LoginStatus login)
- : login_(login) {
+ IMEDetailedView(SystemTrayItem* tray, user::LoginStatus login)
+ : TrayDetailsView(tray),
+ login_(login) {
SystemTrayDelegate* delegate = Shell::GetInstance()->tray_delegate();
IMEInfoList list;
delegate->GetAvailableIMEList(&list);
@@ -138,7 +139,7 @@ class IMEDetailedView : public TrayDetailsView,
virtual void ClickedOn(views::View* sender) OVERRIDE {
SystemTrayDelegate* delegate = Shell::GetInstance()->tray_delegate();
if (sender == footer()->content()) {
- Shell::GetInstance()->system_tray()->ShowDefaultView(BUBBLE_USE_EXISTING);
+ tray()->system_tray()->ShowDefaultView(BUBBLE_USE_EXISTING);
} else if (sender == settings_) {
delegate->ShowIMESettings();
} else {
@@ -236,8 +237,9 @@ class IMENotificationView : public TrayNotificationView {
} // namespace tray
-TrayIME::TrayIME()
- : tray_label_(NULL),
+TrayIME::TrayIME(SystemTray* system_tray)
+ : SystemTrayItem(system_tray),
+ tray_label_(NULL),
default_(NULL),
detailed_(NULL),
notification_(NULL),
@@ -255,15 +257,14 @@ void TrayIME::UpdateTrayLabel(const IMEInfo& current, size_t count) {
tray_label_->label()->SetText(current.short_name);
}
tray_label_->SetVisible(count > 1);
- SetTrayLabelItemBorder(tray_label_,
- ash::Shell::GetInstance()->system_tray()->shelf_alignment());
+ SetTrayLabelItemBorder(tray_label_, system_tray()->shelf_alignment());
tray_label_->Layout();
}
}
views::View* TrayIME::CreateTrayView(user::LoginStatus status) {
CHECK(tray_label_ == NULL);
- tray_label_ = new TrayItemView;
+ tray_label_ = new TrayItemView(this);
tray_label_->CreateLabel();
SetupLabelForTray(tray_label_->label());
return tray_label_;

Powered by Google App Engine
This is Rietveld 408576698