| 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.h" | 10 #include "ash/system/tray/system_tray.h" |
| 11 #include "ash/system/tray/system_tray_delegate.h" | 11 #include "ash/system/tray/system_tray_delegate.h" |
| 12 #include "ash/system/tray/tray_constants.h" | 12 #include "ash/system/tray/tray_constants.h" |
| 13 #include "ash/system/tray/tray_item_more.h" | 13 #include "ash/system/tray/tray_item_more.h" |
| 14 #include "ash/system/tray/tray_item_view.h" |
| 14 #include "ash/system/tray/tray_views.h" | 15 #include "ash/system/tray/tray_views.h" |
| 15 #include "base/logging.h" | 16 #include "base/logging.h" |
| 16 #include "base/utf_string_conversions.h" | 17 #include "base/utf_string_conversions.h" |
| 17 #include "grit/ash_strings.h" | 18 #include "grit/ash_strings.h" |
| 18 #include "grit/ui_resources.h" | 19 #include "grit/ui_resources.h" |
| 19 #include "ui/base/resource/resource_bundle.h" | 20 #include "ui/base/resource/resource_bundle.h" |
| 20 #include "ui/gfx/font.h" | 21 #include "ui/gfx/font.h" |
| 21 #include "ui/gfx/image/image.h" | 22 #include "ui/gfx/image/image.h" |
| 22 #include "ui/views/controls/label.h" | 23 #include "ui/views/controls/label.h" |
| 23 #include "ui/views/layout/box_layout.h" | 24 #include "ui/views/layout/box_layout.h" |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 | 180 |
| 180 } // namespace tray | 181 } // namespace tray |
| 181 | 182 |
| 182 TrayIME::TrayIME() { | 183 TrayIME::TrayIME() { |
| 183 } | 184 } |
| 184 | 185 |
| 185 TrayIME::~TrayIME() { | 186 TrayIME::~TrayIME() { |
| 186 } | 187 } |
| 187 | 188 |
| 188 void TrayIME::UpdateTrayLabel(const IMEInfo& current, size_t count) { | 189 void TrayIME::UpdateTrayLabel(const IMEInfo& current, size_t count) { |
| 189 tray_label_->SetText(current.short_name); | 190 tray_label_->label()->SetText(current.short_name); |
| 190 tray_label_->SetVisible(count > 1); | 191 tray_label_->SetVisible(count > 1); |
| 191 } | 192 } |
| 192 | 193 |
| 193 views::View* TrayIME::CreateTrayView(user::LoginStatus status) { | 194 views::View* TrayIME::CreateTrayView(user::LoginStatus status) { |
| 194 tray_label_.reset(new views::Label); | 195 tray_label_.reset(new TrayItemView); |
| 195 SetupLabelForTray(tray_label_.get()); | 196 tray_label_->CreateLabel(); |
| 197 SetupLabelForTray(tray_label_->label()); |
| 196 tray_label_->set_border( | 198 tray_label_->set_border( |
| 197 views::Border::CreateEmptyBorder(0, 2, 0, 2)); | 199 views::Border::CreateEmptyBorder(0, 2, 0, 2)); |
| 198 return tray_label_.get(); | 200 return tray_label_.get(); |
| 199 } | 201 } |
| 200 | 202 |
| 201 views::View* TrayIME::CreateDefaultView(user::LoginStatus status) { | 203 views::View* TrayIME::CreateDefaultView(user::LoginStatus status) { |
| 202 SystemTrayDelegate* delegate = Shell::GetInstance()->tray_delegate(); | 204 SystemTrayDelegate* delegate = Shell::GetInstance()->tray_delegate(); |
| 203 IMEInfoList list; | 205 IMEInfoList list; |
| 204 IMEPropertyInfoList property_list; | 206 IMEPropertyInfoList property_list; |
| 205 delegate->GetAvailableIMEList(&list); | 207 delegate->GetAvailableIMEList(&list); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 239 UpdateTrayLabel(current, list.size()); | 241 UpdateTrayLabel(current, list.size()); |
| 240 | 242 |
| 241 if (default_.get()) | 243 if (default_.get()) |
| 242 default_->UpdateLabel(current); | 244 default_->UpdateLabel(current); |
| 243 if (detailed_.get()) | 245 if (detailed_.get()) |
| 244 detailed_->Update(list, property_list); | 246 detailed_->Update(list, property_list); |
| 245 } | 247 } |
| 246 | 248 |
| 247 } // namespace internal | 249 } // namespace internal |
| 248 } // namespace ash | 250 } // namespace ash |
| OLD | NEW |