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

Side by Side Diff: ash/system/locale/tray_locale.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: Fix single-letter typo :(. Created 8 years 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ash/system/locale/tray_locale.h ('k') | ash/system/logout_button/tray_logout_button.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ash/system/locale/tray_locale.h" 5 #include "ash/system/locale/tray_locale.h"
6 6
7 #include "ash/system/tray/tray_constants.h" 7 #include "ash/system/tray/tray_constants.h"
8 #include "ash/system/tray/tray_notification_view.h" 8 #include "ash/system/tray/tray_notification_view.h"
9 #include "ash/system/tray/tray_views.h" 9 #include "ash/system/tray/tray_views.h"
10 #include "base/string16.h" 10 #include "base/string16.h"
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 } 66 }
67 67
68 private: 68 private:
69 LocaleObserver::Delegate* delegate_; 69 LocaleObserver::Delegate* delegate_;
70 70
71 DISALLOW_COPY_AND_ASSIGN(LocaleMessageView); 71 DISALLOW_COPY_AND_ASSIGN(LocaleMessageView);
72 }; 72 };
73 73
74 class LocaleNotificationView : public TrayNotificationView { 74 class LocaleNotificationView : public TrayNotificationView {
75 public: 75 public:
76 LocaleNotificationView(TrayLocale* tray, 76 LocaleNotificationView(TrayLocale* owner,
77 LocaleObserver::Delegate* delegate, 77 LocaleObserver::Delegate* delegate,
78 const std::string& cur_locale, 78 const std::string& cur_locale,
79 const std::string& from_locale, 79 const std::string& from_locale,
80 const std::string& to_locale) 80 const std::string& to_locale)
81 : TrayNotificationView(tray, IDR_AURA_UBER_TRAY_LOCALE), 81 : TrayNotificationView(owner, IDR_AURA_UBER_TRAY_LOCALE),
82 delegate_(delegate) { 82 delegate_(delegate) {
83 views::View* container = new LocaleMessageView( 83 views::View* container = new LocaleMessageView(
84 delegate, cur_locale, from_locale, to_locale); 84 delegate, cur_locale, from_locale, to_locale);
85 InitView(container); 85 InitView(container);
86 } 86 }
87 87
88 void Update(LocaleObserver::Delegate* delegate, 88 void Update(LocaleObserver::Delegate* delegate,
89 const std::string& cur_locale, 89 const std::string& cur_locale,
90 const std::string& from_locale, 90 const std::string& from_locale,
91 const std::string& to_locale) { 91 const std::string& to_locale) {
(...skipping 10 matching lines...) Expand all
102 } 102 }
103 103
104 private: 104 private:
105 LocaleObserver::Delegate* delegate_; 105 LocaleObserver::Delegate* delegate_;
106 106
107 DISALLOW_COPY_AND_ASSIGN(LocaleNotificationView); 107 DISALLOW_COPY_AND_ASSIGN(LocaleNotificationView);
108 }; 108 };
109 109
110 } // namespace tray 110 } // namespace tray
111 111
112 TrayLocale::TrayLocale() 112 TrayLocale::TrayLocale(SystemTray* system_tray)
113 : notification_(NULL), 113 : SystemTrayItem(system_tray),
114 notification_(NULL),
114 delegate_(NULL) { 115 delegate_(NULL) {
115 } 116 }
116 117
117 TrayLocale::~TrayLocale() { 118 TrayLocale::~TrayLocale() {
118 } 119 }
119 120
120 views::View* TrayLocale::CreateNotificationView(user::LoginStatus status) { 121 views::View* TrayLocale::CreateNotificationView(user::LoginStatus status) {
121 if (!delegate_) 122 if (!delegate_)
122 return NULL; 123 return NULL;
123 CHECK(notification_ == NULL); 124 CHECK(notification_ == NULL);
(...skipping 15 matching lines...) Expand all
139 from_locale_ = from_locale; 140 from_locale_ = from_locale;
140 to_locale_ = to_locale; 141 to_locale_ = to_locale;
141 if (notification_) 142 if (notification_)
142 notification_->Update(delegate, cur_locale_, from_locale_, to_locale_); 143 notification_->Update(delegate, cur_locale_, from_locale_, to_locale_);
143 else 144 else
144 ShowNotificationView(); 145 ShowNotificationView();
145 } 146 }
146 147
147 } // namespace internal 148 } // namespace internal
148 } // namespace ash 149 } // namespace ash
OLDNEW
« no previous file with comments | « ash/system/locale/tray_locale.h ('k') | ash/system/logout_button/tray_logout_button.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698