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/shell.h" | 9 #include "ash/shell.h" |
10 #include "ash/system/tray/system_tray_delegate.h" | 10 #include "ash/system/tray/system_tray_delegate.h" |
| 11 #include "ash/system/tray/tray_views.h" |
11 #include "base/logging.h" | 12 #include "base/logging.h" |
12 #include "base/utf_string_conversions.h" | 13 #include "base/utf_string_conversions.h" |
13 #include "ui/gfx/font.h" | 14 #include "ui/gfx/font.h" |
14 #include "ui/views/controls/label.h" | 15 #include "ui/views/controls/label.h" |
15 | 16 |
16 namespace ash { | 17 namespace ash { |
17 namespace internal { | 18 namespace internal { |
18 | 19 |
19 TrayIME::TrayIME() { | 20 TrayIME::TrayIME() { |
20 } | 21 } |
21 | 22 |
22 TrayIME::~TrayIME() { | 23 TrayIME::~TrayIME() { |
23 } | 24 } |
24 | 25 |
25 void TrayIME::UpdateTrayLabel() { | 26 void TrayIME::UpdateTrayLabel() { |
26 IMEInfoList list; | 27 IMEInfoList list; |
27 ash::Shell::GetInstance()->tray_delegate()->GetAvailableIMEList(&list); | 28 ash::Shell::GetInstance()->tray_delegate()->GetAvailableIMEList(&list); |
28 for (size_t i = 0; i < list.size(); i++) { | 29 for (size_t i = 0; i < list.size(); i++) { |
29 if (list[i].selected) { | 30 if (list[i].selected) { |
30 tray_label_->SetText(list[i].short_name); | 31 tray_label_->SetText(list[i].short_name); |
31 break; | 32 break; |
32 } | 33 } |
33 } | 34 } |
34 tray_label_->SetVisible(list.size() > 1); | 35 tray_label_->SetVisible(list.size() > 1); |
35 } | 36 } |
36 | 37 |
37 views::View* TrayIME::CreateTrayView(user::LoginStatus status) { | 38 views::View* TrayIME::CreateTrayView(user::LoginStatus status) { |
38 tray_label_.reset(new views::Label); | 39 tray_label_.reset(new views::Label); |
39 tray_label_->SetFont( | 40 SetupLabelForTray(tray_label_.get()); |
40 tray_label_->font().DeriveFont(2, gfx::Font::BOLD)); | |
41 tray_label_->SetAutoColorReadabilityEnabled(false); | |
42 tray_label_->SetEnabledColor(SK_ColorWHITE); | |
43 return tray_label_.get(); | 41 return tray_label_.get(); |
44 } | 42 } |
45 | 43 |
46 views::View* TrayIME::CreateDefaultView(user::LoginStatus status) { | 44 views::View* TrayIME::CreateDefaultView(user::LoginStatus status) { |
47 return NULL; | 45 return NULL; |
48 } | 46 } |
49 | 47 |
50 views::View* TrayIME::CreateDetailedView(user::LoginStatus status) { | 48 views::View* TrayIME::CreateDetailedView(user::LoginStatus status) { |
51 return NULL; | 49 return NULL; |
52 } | 50 } |
53 | 51 |
54 void TrayIME::DestroyTrayView() { | 52 void TrayIME::DestroyTrayView() { |
55 tray_label_.reset(); | 53 tray_label_.reset(); |
56 } | 54 } |
57 | 55 |
58 void TrayIME::DestroyDefaultView() { | 56 void TrayIME::DestroyDefaultView() { |
59 } | 57 } |
60 | 58 |
61 void TrayIME::DestroyDetailedView() { | 59 void TrayIME::DestroyDetailedView() { |
62 } | 60 } |
63 | 61 |
64 void TrayIME::OnIMERefresh() { | 62 void TrayIME::OnIMERefresh() { |
65 UpdateTrayLabel(); | 63 UpdateTrayLabel(); |
66 } | 64 } |
67 | 65 |
68 } // namespace internal | 66 } // namespace internal |
69 } // namespace ash | 67 } // namespace ash |
OLD | NEW |