| 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 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 } | 196 } |
| 197 | 197 |
| 198 TrayIME::~TrayIME() { | 198 TrayIME::~TrayIME() { |
| 199 Shell::GetInstance()->system_tray_notifier()->RemoveIMEObserver(this); | 199 Shell::GetInstance()->system_tray_notifier()->RemoveIMEObserver(this); |
| 200 message_center::MessageCenter::Get()->RemoveNotification( | 200 message_center::MessageCenter::Get()->RemoveNotification( |
| 201 kIMENotificationId, false /* by_user */); | 201 kIMENotificationId, false /* by_user */); |
| 202 } | 202 } |
| 203 | 203 |
| 204 void TrayIME::UpdateTrayLabel(const IMEInfo& current, size_t count) { | 204 void TrayIME::UpdateTrayLabel(const IMEInfo& current, size_t count) { |
| 205 if (tray_label_) { | 205 if (tray_label_) { |
| 206 bool visible = count > 1; |
| 207 tray_label_->SetVisible(visible); |
| 208 // Do not change label before hiding because this change is noticeable. |
| 209 if (!visible) |
| 210 return; |
| 206 if (current.third_party) { | 211 if (current.third_party) { |
| 207 tray_label_->label()->SetText( | 212 tray_label_->label()->SetText( |
| 208 current.short_name + base::UTF8ToUTF16("*")); | 213 current.short_name + base::UTF8ToUTF16("*")); |
| 209 } else { | 214 } else { |
| 210 tray_label_->label()->SetText(current.short_name); | 215 tray_label_->label()->SetText(current.short_name); |
| 211 } | 216 } |
| 212 tray_label_->SetVisible(count > 1); | |
| 213 SetTrayLabelItemBorder(tray_label_, system_tray()->shelf_alignment()); | 217 SetTrayLabelItemBorder(tray_label_, system_tray()->shelf_alignment()); |
| 214 tray_label_->Layout(); | 218 tray_label_->Layout(); |
| 215 } | 219 } |
| 216 } | 220 } |
| 217 | 221 |
| 218 void TrayIME::UpdateOrCreateNotification() { | 222 void TrayIME::UpdateOrCreateNotification() { |
| 219 message_center::MessageCenter* message_center = | 223 message_center::MessageCenter* message_center = |
| 220 message_center::MessageCenter::Get(); | 224 message_center::MessageCenter::Get(); |
| 221 | 225 |
| 222 if (!message_center->HasNotification(kIMENotificationId) && message_shown_) | 226 if (!message_center->HasNotification(kIMENotificationId) && message_shown_) |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 314 default_->UpdateLabel(current); | 318 default_->UpdateLabel(current); |
| 315 if (detailed_) | 319 if (detailed_) |
| 316 detailed_->Update(list, property_list); | 320 detailed_->Update(list, property_list); |
| 317 | 321 |
| 318 if (list.size() > 1 && show_message) | 322 if (list.size() > 1 && show_message) |
| 319 UpdateOrCreateNotification(); | 323 UpdateOrCreateNotification(); |
| 320 } | 324 } |
| 321 | 325 |
| 322 } // namespace internal | 326 } // namespace internal |
| 323 } // namespace ash | 327 } // namespace ash |
| OLD | NEW |