OLD | NEW |
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/ime/tray_ime.h" | 5 #include "ash/system/ime/tray_ime.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "ash/metrics/user_metrics_recorder.h" | 9 #include "ash/metrics/user_metrics_recorder.h" |
10 #include "ash/root_window_controller.h" | 10 #include "ash/root_window_controller.h" |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 DISALLOW_COPY_AND_ASSIGN(IMEDetailedView); | 183 DISALLOW_COPY_AND_ASSIGN(IMEDetailedView); |
184 }; | 184 }; |
185 | 185 |
186 } // namespace tray | 186 } // namespace tray |
187 | 187 |
188 TrayIME::TrayIME(SystemTray* system_tray) | 188 TrayIME::TrayIME(SystemTray* system_tray) |
189 : SystemTrayItem(system_tray), | 189 : SystemTrayItem(system_tray), |
190 tray_label_(NULL), | 190 tray_label_(NULL), |
191 default_(NULL), | 191 default_(NULL), |
192 detailed_(NULL), | 192 detailed_(NULL), |
193 message_shown_(false) { | 193 message_shown_(false), |
| 194 weak_factory_(this) { |
194 Shell::GetInstance()->system_tray_notifier()->AddIMEObserver(this); | 195 Shell::GetInstance()->system_tray_notifier()->AddIMEObserver(this); |
195 } | 196 } |
196 | 197 |
197 TrayIME::~TrayIME() { | 198 TrayIME::~TrayIME() { |
198 Shell::GetInstance()->system_tray_notifier()->RemoveIMEObserver(this); | 199 Shell::GetInstance()->system_tray_notifier()->RemoveIMEObserver(this); |
199 message_center::MessageCenter::Get()->RemoveNotification( | 200 message_center::MessageCenter::Get()->RemoveNotification( |
200 kIMENotificationId, false /* by_user */); | 201 kIMENotificationId, false /* by_user */); |
201 } | 202 } |
202 | 203 |
203 void TrayIME::UpdateTrayLabel(const IMEInfo& current, size_t count) { | 204 void TrayIME::UpdateTrayLabel(const IMEInfo& current, size_t count) { |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 current.medium_name), | 237 current.medium_name), |
237 base::string16(), // message | 238 base::string16(), // message |
238 bundle.GetImageNamed(IDR_AURA_UBER_TRAY_IME), | 239 bundle.GetImageNamed(IDR_AURA_UBER_TRAY_IME), |
239 base::string16(), // display_source | 240 base::string16(), // display_source |
240 message_center::NotifierId( | 241 message_center::NotifierId( |
241 message_center::NotifierId::SYSTEM_COMPONENT, | 242 message_center::NotifierId::SYSTEM_COMPONENT, |
242 system_notifier::kNotifierInputMethod), | 243 system_notifier::kNotifierInputMethod), |
243 message_center::RichNotificationData(), | 244 message_center::RichNotificationData(), |
244 new message_center::HandleNotificationClickedDelegate( | 245 new message_center::HandleNotificationClickedDelegate( |
245 base::Bind(&TrayIME::PopupDetailedView, | 246 base::Bind(&TrayIME::PopupDetailedView, |
246 base::Unretained(this), 0, true)))); | 247 weak_factory_.GetWeakPtr(), 0, true)))); |
247 message_center->AddNotification(notification.Pass()); | 248 message_center->AddNotification(notification.Pass()); |
248 message_shown_ = true; | 249 message_shown_ = true; |
249 } | 250 } |
250 | 251 |
251 views::View* TrayIME::CreateTrayView(user::LoginStatus status) { | 252 views::View* TrayIME::CreateTrayView(user::LoginStatus status) { |
252 CHECK(tray_label_ == NULL); | 253 CHECK(tray_label_ == NULL); |
253 tray_label_ = new TrayItemView(this); | 254 tray_label_ = new TrayItemView(this); |
254 tray_label_->CreateLabel(); | 255 tray_label_->CreateLabel(); |
255 SetupLabelForTray(tray_label_->label()); | 256 SetupLabelForTray(tray_label_->label()); |
256 // Hide IME tray when it is created, it will be updated when it is notified | 257 // Hide IME tray when it is created, it will be updated when it is notified |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
313 default_->UpdateLabel(current); | 314 default_->UpdateLabel(current); |
314 if (detailed_) | 315 if (detailed_) |
315 detailed_->Update(list, property_list); | 316 detailed_->Update(list, property_list); |
316 | 317 |
317 if (list.size() > 1 && show_message) | 318 if (list.size() > 1 && show_message) |
318 UpdateOrCreateNotification(); | 319 UpdateOrCreateNotification(); |
319 } | 320 } |
320 | 321 |
321 } // namespace internal | 322 } // namespace internal |
322 } // namespace ash | 323 } // namespace ash |
OLD | NEW |