summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ash/ash_strings.grd6
-rw-r--r--ash/shell.cc15
-rw-r--r--ash/system/bluetooth/tray_bluetooth.cc16
-rw-r--r--ash/system/ime/tray_ime.cc163
-rw-r--r--ash/system/ime/tray_ime.h12
-rw-r--r--ash/system/network/tray_network.cc28
-rw-r--r--ash/system/tray/system_tray.cc15
-rw-r--r--ash/system/tray/system_tray_delegate.h12
-rw-r--r--ash/system/tray/tray_constants.cc3
-rw-r--r--ash/system/tray/tray_constants.h3
-rw-r--r--ash/system/tray/tray_views.cc19
-rw-r--r--ash/system/tray/tray_views.h5
-rw-r--r--chrome/browser/chromeos/system/ash_system_tray_delegate.cc39
-rw-r--r--ui/resources/ui_resources.grd1
14 files changed, 271 insertions, 66 deletions
diff --git a/ash/ash_strings.grd b/ash/ash_strings.grd
index 5801624..5728646 100644
--- a/ash/ash_strings.grd
+++ b/ash/ash_strings.grd
@@ -254,6 +254,12 @@ This file contains the strings for ash.
<message name="IDS_ASH_STATUS_TRAY_BLUETOOTH_ADD_DEVICE" desc="The label used in the tray popup to add a bluetooth device.">
Add device...
</message>
+ <message name="IDS_ASH_STATUS_TRAY_IME" desc="The label used as the header in the IME popup.">
+ Input methods
+ </message>
+ <message name="IDS_ASH_STATUS_TRAY_IME_SETTINGS" desc="The label used for IME settings entry.">
+ Customize languages and input...
+ </message>
<message name="IDS_ASH_STATUS_TRAY_BATTERY_FULL" desc="The label in the tray dialog to indicate that the battery is full.">
Battery full
</message>
diff --git a/ash/shell.cc b/ash/shell.cc
index 197808e..406d3a8 100644
--- a/ash/shell.cc
+++ b/ash/shell.cc
@@ -306,6 +306,9 @@ class DummySystemTrayDelegate : public SystemTrayDelegate {
virtual void ShowBluetoothSettings() OVERRIDE {
}
+ virtual void ShowIMESettings() OVERRIDE {
+ }
+
virtual void ShowHelp() OVERRIDE {
}
@@ -348,11 +351,17 @@ class DummySystemTrayDelegate : public SystemTrayDelegate {
virtual void ToggleBluetoothConnection(const std::string& address) OVERRIDE {
}
- virtual void GetAvailableIMEList(IMEInfoList* list) {
+ virtual void GetCurrentIME(IMEInfo* info) OVERRIDE {
+ }
+
+ virtual void GetAvailableIMEList(IMEInfoList* list) OVERRIDE {
+ }
+
+ virtual void SwitchIME(const std::string& ime_id) OVERRIDE {
}
- virtual NetworkIconInfo GetMostRelevantNetworkIcon(bool large) OVERRIDE {
- return NetworkIconInfo();
+ virtual void GetMostRelevantNetworkIcon(NetworkIconInfo* info,
+ bool large) OVERRIDE {
}
virtual void GetAvailableNetworks(
diff --git a/ash/system/bluetooth/tray_bluetooth.cc b/ash/system/bluetooth/tray_bluetooth.cc
index 9e4a715..7732e34 100644
--- a/ash/system/bluetooth/tray_bluetooth.cc
+++ b/ash/system/bluetooth/tray_bluetooth.cc
@@ -98,20 +98,8 @@ class BluetoothDetailedView : public views::View,
private:
void AppendHeaderEntry() {
- ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
- HoverHighlightView* container = new HoverHighlightView(this);
- container->SetLayoutManager(new
- views::BoxLayout(views::BoxLayout::kHorizontal, 0, 3, 5));
- views::ImageView* back = new FixedWidthImageView;
- back->SetImage(rb.GetImageNamed(IDR_AURA_UBER_TRAY_LESS).ToSkBitmap());
- container->AddChildView(back);
- views::Label* header = new views::Label(rb.GetLocalizedString(
- IDS_ASH_STATUS_TRAY_BLUETOOTH));
- header->SetHorizontalAlignment(views::Label::ALIGN_LEFT);
- header->SetFont(header->font().DeriveFont(4));
- container->AddChildView(header);
- AddChildView(container);
- header_ = container;
+ header_ = CreateDetailedHeaderEntry(IDS_ASH_STATUS_TRAY_BLUETOOTH, this);
+ AddChildView(header_);
}
void AppendDeviceList(const BluetoothDeviceList& list) {
diff --git a/ash/system/ime/tray_ime.cc b/ash/system/ime/tray_ime.cc
index b3694b2..ba62fe3 100644
--- a/ash/system/ime/tray_ime.cc
+++ b/ash/system/ime/tray_ime.cc
@@ -7,32 +7,154 @@
#include <vector>
#include "ash/shell.h"
+#include "ash/system/tray/system_tray.h"
#include "ash/system/tray/system_tray_delegate.h"
+#include "ash/system/tray/tray_constants.h"
+#include "ash/system/tray/tray_item_more.h"
#include "ash/system/tray/tray_views.h"
#include "base/logging.h"
#include "base/utf_string_conversions.h"
+#include "grit/ash_strings.h"
+#include "grit/ui_resources.h"
+#include "ui/base/resource/resource_bundle.h"
#include "ui/gfx/font.h"
+#include "ui/gfx/image/image.h"
#include "ui/views/controls/label.h"
+#include "ui/views/layout/box_layout.h"
namespace ash {
namespace internal {
+namespace tray {
+
+class IMEDefaultView : public TrayItemMore {
+ public:
+ explicit IMEDefaultView(SystemTrayItem* owner)
+ : TrayItemMore(owner) {
+ SetLayoutManager(new views::BoxLayout(views::BoxLayout::kHorizontal,
+ kTrayPopupPaddingHorizontal, 0, kTrayPopupPaddingBetweenItems));
+ ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance();
+
+ views::ImageView* icon = new views::ImageView;
+ icon->SetImage(bundle.GetImageNamed(
+ IDR_AURA_UBER_TRAY_IME).ToSkBitmap());
+ AddChildView(icon);
+
+ label_ = new views::Label;
+ AddChildView(label_);
+
+ IMEInfo info;
+ Shell::GetInstance()->tray_delegate()->GetCurrentIME(&info);
+ UpdateLabel(info);
+
+ AddMore();
+ }
+
+ virtual ~IMEDefaultView() {}
+
+ void UpdateLabel(const IMEInfo& info) {
+ label_->SetText(info.name);
+ }
+
+ private:
+ views::Label* label_;
+
+ DISALLOW_COPY_AND_ASSIGN(IMEDefaultView);
+};
+
+class IMEDetailedView : public views::View,
+ public ViewClickListener {
+ public:
+ explicit IMEDetailedView(SystemTrayItem* owner)
+ : header_(NULL) {
+ SetLayoutManager(new views::BoxLayout(
+ views::BoxLayout::kVertical, 1, 1, 1));
+ set_background(views::Background::CreateSolidBackground(kBackgroundColor));
+ IMEInfoList list;
+ Shell::GetInstance()->tray_delegate()->GetAvailableIMEList(&list);
+ Update(list);
+ }
+
+ virtual ~IMEDetailedView() {}
+
+ void Update(const IMEInfoList& list) {
+ RemoveAllChildViews(true);
+
+ header_ = NULL;
+
+ AppendHeaderEntry();
+ AppendIMEList(list);
+ AppendSettings();
+
+ Layout();
+ }
+
+ private:
+ void AppendHeaderEntry() {
+ header_ = CreateDetailedHeaderEntry(IDS_ASH_STATUS_TRAY_IME, this);
+ AddChildView(header_);
+ }
+
+ void AppendIMEList(const IMEInfoList& list) {
+ views::View* imes = new views::View;
+ imes->SetLayoutManager(new views::BoxLayout(
+ views::BoxLayout::kVertical, 0, 0, 1));
+ for (size_t i = 0; i < list.size(); i++) {
+ HoverHighlightView* container = new HoverHighlightView(this);
+ container->AddLabel(list[i].name,
+ list[i].selected ? gfx::Font::BOLD : gfx::Font::NORMAL);
+ imes->AddChildView(container);
+ ime_map_[container] = list[i].id;
+ }
+ imes->set_border(views::Border::CreateSolidSidedBorder(1, 0, 1, 0,
+ kBorderLightColor));
+ AddChildView(imes);
+ }
+
+ void AppendSettings() {
+ HoverHighlightView* container = new HoverHighlightView(this);
+ container->AddLabel(ui::ResourceBundle::GetSharedInstance().
+ GetLocalizedString(IDS_ASH_STATUS_TRAY_IME_SETTINGS),
+ gfx::Font::NORMAL);
+ AddChildView(container);
+ settings_ = container;
+ }
+
+ // Overridden from ViewClickListener.
+ virtual void ClickedOn(views::View* sender) OVERRIDE {
+ SystemTrayDelegate* delegate = Shell::GetInstance()->tray_delegate();
+ if (sender == header_) {
+ Shell::GetInstance()->tray()->ShowDefaultView();
+ } else if (sender == settings_) {
+ delegate->ShowIMESettings();
+ } else {
+ std::map<views::View*, std::string>::iterator find;
+ find = ime_map_.find(sender);
+ if (find != ime_map_.end()) {
+ std::string ime_id = find->second;
+ delegate->SwitchIME(ime_id);
+ }
+ }
+ }
+
+ std::map<views::View*, std::string> ime_map_;
+ views::View* header_;
+ views::View* settings_;
+
+ DISALLOW_COPY_AND_ASSIGN(IMEDetailedView);
+};
+
+} // namespace tray
+
TrayIME::TrayIME() {
}
TrayIME::~TrayIME() {
}
-void TrayIME::UpdateTrayLabel() {
- IMEInfoList list;
- ash::Shell::GetInstance()->tray_delegate()->GetAvailableIMEList(&list);
- for (size_t i = 0; i < list.size(); i++) {
- if (list[i].selected) {
- tray_label_->SetText(list[i].short_name);
- break;
- }
- }
- tray_label_->SetVisible(list.size() > 1);
+void TrayIME::UpdateTrayLabel(const IMEInfo& current, size_t count) {
+ tray_label_->SetText(current.short_name);
+ tray_label_->SetVisible(count > 1);
}
views::View* TrayIME::CreateTrayView(user::LoginStatus status) {
@@ -42,11 +164,13 @@ views::View* TrayIME::CreateTrayView(user::LoginStatus status) {
}
views::View* TrayIME::CreateDefaultView(user::LoginStatus status) {
- return NULL;
+ default_.reset(new tray::IMEDefaultView(this));
+ return default_.get();
}
views::View* TrayIME::CreateDetailedView(user::LoginStatus status) {
- return NULL;
+ detailed_.reset(new tray::IMEDetailedView(this));
+ return detailed_.get();
}
void TrayIME::DestroyTrayView() {
@@ -54,13 +178,26 @@ void TrayIME::DestroyTrayView() {
}
void TrayIME::DestroyDefaultView() {
+ default_.reset();
}
void TrayIME::DestroyDetailedView() {
+ detailed_.reset();
}
void TrayIME::OnIMERefresh() {
- UpdateTrayLabel();
+ SystemTrayDelegate* delegate = Shell::GetInstance()->tray_delegate();
+ IMEInfoList list;
+ IMEInfo current;
+ delegate->GetCurrentIME(&current);
+ delegate->GetAvailableIMEList(&list);
+
+ UpdateTrayLabel(current, list.size());
+
+ if (default_.get())
+ default_->UpdateLabel(current);
+ if (detailed_.get())
+ detailed_->Update(list);
}
} // namespace internal
diff --git a/ash/system/ime/tray_ime.h b/ash/system/ime/tray_ime.h
index e7c42d1..264944e 100644
--- a/ash/system/ime/tray_ime.h
+++ b/ash/system/ime/tray_ime.h
@@ -15,8 +15,16 @@ class Label;
}
namespace ash {
+
+struct IMEInfo;
+
namespace internal {
+namespace tray {
+class IMEDefaultView;
+class IMEDetailedView;
+};
+
class TrayIME : public SystemTrayItem,
public IMEObserver {
public:
@@ -24,7 +32,7 @@ class TrayIME : public SystemTrayItem,
virtual ~TrayIME();
private:
- void UpdateTrayLabel();
+ void UpdateTrayLabel(const IMEInfo& info, size_t count);
// Overridden from SystemTrayItem.
virtual views::View* CreateTrayView(user::LoginStatus status) OVERRIDE;
@@ -38,6 +46,8 @@ class TrayIME : public SystemTrayItem,
virtual void OnIMERefresh() OVERRIDE;
scoped_ptr<views::Label> tray_label_;
+ scoped_ptr<tray::IMEDefaultView> default_;
+ scoped_ptr<tray::IMEDetailedView> detailed_;
DISALLOW_COPY_AND_ASSIGN(TrayIME);
};
diff --git a/ash/system/network/tray_network.cc b/ash/system/network/tray_network.cc
index ea670b4..400f6ae 100644
--- a/ash/system/network/tray_network.cc
+++ b/ash/system/network/tray_network.cc
@@ -49,8 +49,10 @@ class NetworkTrayView : public views::View {
image_view_ = new views::ImageView;
AddChildView(image_view_);
- Update(Shell::GetInstance()->tray_delegate()->
- GetMostRelevantNetworkIcon(resource_size_ == LARGE));
+ NetworkIconInfo info;
+ Shell::GetInstance()->tray_delegate()->
+ GetMostRelevantNetworkIcon(&info, resource_size_ == LARGE);
+ Update(info);
}
virtual ~NetworkTrayView() {}
@@ -82,8 +84,10 @@ class NetworkDefaultView : public TrayItemMore {
AddMore();
- Update(Shell::GetInstance()->tray_delegate()->
- GetMostRelevantNetworkIcon(true));
+ NetworkIconInfo info;
+ Shell::GetInstance()->tray_delegate()->
+ GetMostRelevantNetworkIcon(&info, true);
+ Update(info);
}
virtual ~NetworkDefaultView() {}
@@ -139,20 +143,8 @@ class NetworkDetailedView : public views::View,
private:
void AppendHeaderEntry() {
- ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
- HoverHighlightView* container = new HoverHighlightView(this);
- container->SetLayoutManager(new
- views::BoxLayout(views::BoxLayout::kHorizontal, 0, 3, 5));
- views::ImageView* back = new FixedWidthImageView;
- back->SetImage(rb.GetImageNamed(IDR_AURA_UBER_TRAY_LESS).ToSkBitmap());
- container->AddChildView(back);
- views::Label* header = new views::Label(rb.GetLocalizedString(
- IDS_ASH_STATUS_TRAY_NETWORK));
- header->SetHorizontalAlignment(views::Label::ALIGN_LEFT);
- header->SetFont(header->font().DeriveFont(4));
- container->AddChildView(header);
- AddChildView(container);
- header_ = container;
+ header_ = CreateDetailedHeaderEntry(IDS_ASH_STATUS_TRAY_NETWORK, this);
+ AddChildView(header_);
}
void AppendNetworkEntries() {
diff --git a/ash/system/tray/system_tray.cc b/ash/system/tray/system_tray.cc
index 62b7cae..b41c56c 100644
--- a/ash/system/tray/system_tray.cc
+++ b/ash/system/tray/system_tray.cc
@@ -52,8 +52,6 @@ const int kShadowHeight = 3;
const int kLeftPadding = 4;
const int kBottomLineHeight = 1;
-const SkColor kDarkColor = SkColorSetRGB(120, 120, 120);
-const SkColor kLightColor = SkColorSetRGB(240, 240, 240);
const SkColor kShadowColor = SkColorSetARGB(25, 0, 0, 0);
const SkColor kTrayBackgroundAlpha = 100;
@@ -167,17 +165,18 @@ class SystemTrayBubbleBackground : public views::Background {
if (!v->border()) {
canvas->DrawLine(gfx::Point(v->x() - 1, v->y() - 1),
gfx::Point(v->x() + v->width() + 1, v->y() - 1),
- !last_view || last_view->border() ? kDarkColor : kLightColor);
+ !last_view || last_view->border() ? kBorderDarkColor :
+ kBorderLightColor);
canvas->DrawLine(gfx::Point(v->x() - 1, v->y() - 1),
gfx::Point(v->x() - 1, v->y() + v->height() + 1),
- kDarkColor);
+ kBorderDarkColor);
canvas->DrawLine(gfx::Point(v->x() + v->width(), v->y() - 1),
gfx::Point(v->x() + v->width(), v->y() + v->height() + 1),
- kDarkColor);
+ kBorderDarkColor);
} else if (last_view && !last_view->border()) {
canvas->DrawLine(gfx::Point(v->x() - 1, v->y() - 1),
gfx::Point(v->x() + v->width() + 1, v->y() - 1),
- kDarkColor);
+ kBorderDarkColor);
}
last_view = v;
@@ -204,7 +203,7 @@ class SystemTrayBubbleBorder : public views::Border {
// Draw a line first.
int y = owner_->height() + 1;
canvas->FillRect(gfx::Rect(kLeftPadding, y, owner_->width(),
- kBottomLineHeight), kDarkColor);
+ kBottomLineHeight), kBorderDarkColor);
// Now, draw a shadow.
canvas->FillRect(gfx::Rect(kLeftPadding + kShadowOffset, y,
@@ -230,7 +229,7 @@ class SystemTrayBubbleBorder : public views::Border {
// Now the draw the outline.
paint.setStyle(SkPaint::kStroke_Style);
- paint.setColor(kDarkColor);
+ paint.setColor(kBorderDarkColor);
canvas->sk_canvas()->drawPath(path, paint);
}
diff --git a/ash/system/tray/system_tray_delegate.h b/ash/system/tray/system_tray_delegate.h
index d665081..01258cb 100644
--- a/ash/system/tray/system_tray_delegate.h
+++ b/ash/system/tray/system_tray_delegate.h
@@ -92,6 +92,9 @@ class SystemTrayDelegate {
// Shows the settings related to bluetooth.
virtual void ShowBluetoothSettings() = 0;
+ // Shows settings related to input methods.
+ virtual void ShowIMESettings() = 0;
+
// Shows help.
virtual void ShowHelp() = 0;
@@ -128,13 +131,20 @@ class SystemTrayDelegate {
// Toggles connection to a specific bluetooth device.
virtual void ToggleBluetoothConnection(const std::string& address) = 0;
+ // Returns the currently selected IME.
+ virtual void GetCurrentIME(IMEInfo* info) = 0;
+
// Returns a list of availble IMEs.
virtual void GetAvailableIMEList(IMEInfoList* list) = 0;
+ // Switches to the selected input method.
+ virtual void SwitchIME(const std::string& ime_id) = 0;
+
// Returns information about the most relevant network. Relevance is
// determined by the implementor (e.g. a connecting network may be more
// relevant over a connected network etc.)
- virtual NetworkIconInfo GetMostRelevantNetworkIcon(bool large) = 0;
+ virtual void GetMostRelevantNetworkIcon(NetworkIconInfo* info,
+ bool large) = 0;
// Returns information about the available networks.
virtual void GetAvailableNetworks(std::vector<NetworkIconInfo>* list) = 0;
diff --git a/ash/system/tray/tray_constants.cc b/ash/system/tray/tray_constants.cc
index f4b091e..b5879a0 100644
--- a/ash/system/tray/tray_constants.cc
+++ b/ash/system/tray/tray_constants.cc
@@ -18,6 +18,9 @@ const int kTrayPopupDetailsIconWidth = 27;
const SkColor kBackgroundColor = SK_ColorWHITE;
const SkColor kHoverBackgroundColor = SkColorSetRGB(0xfb, 0xfc, 0xfb);
+const SkColor kBorderDarkColor = SkColorSetRGB(120, 120, 120);
+const SkColor kBorderLightColor = SkColorSetRGB(240, 240, 240);
+
const int kTrayPopupWidth = 300;
} // namespace ash
diff --git a/ash/system/tray/tray_constants.h b/ash/system/tray/tray_constants.h
index b9c1f4a..022ab46 100644
--- a/ash/system/tray/tray_constants.h
+++ b/ash/system/tray/tray_constants.h
@@ -20,6 +20,9 @@ extern const int kTrayPopupDetailsIconWidth;
extern const SkColor kBackgroundColor;
extern const SkColor kHoverBackgroundColor;
+extern const SkColor kBorderDarkColor;
+extern const SkColor kBorderLightColor;
+
extern const int kTrayPopupWidth;
} // namespace ash
diff --git a/ash/system/tray/tray_views.cc b/ash/system/tray/tray_views.cc
index 1cdf525..214a83d 100644
--- a/ash/system/tray/tray_views.cc
+++ b/ash/system/tray/tray_views.cc
@@ -6,6 +6,9 @@
#include "ash/system/tray/tray_constants.h"
#include "third_party/skia/include/core/SkBitmap.h"
+#include "grit/ui_resources.h"
+#include "ui/base/resource/resource_bundle.h"
+#include "ui/gfx/image/image.h"
#include "ui/views/controls/label.h"
#include "ui/views/layout/box_layout.h"
#include "ui/views/layout/fill_layout.h"
@@ -124,6 +127,22 @@ void FixedSizedScrollView::OnPaintFocusBorder(gfx::Canvas* canvas) {
// Do not paint the focus border.
}
+views::View* CreateDetailedHeaderEntry(int string_id,
+ ViewClickListener* listener) {
+ ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
+ HoverHighlightView* container = new HoverHighlightView(listener);
+ container->SetLayoutManager(new
+ views::BoxLayout(views::BoxLayout::kHorizontal, 0, 3, 5));
+ views::ImageView* back = new FixedWidthImageView;
+ back->SetImage(rb.GetImageNamed(IDR_AURA_UBER_TRAY_LESS).ToSkBitmap());
+ container->AddChildView(back);
+ views::Label* header = new views::Label(rb.GetLocalizedString(string_id));
+ header->SetHorizontalAlignment(views::Label::ALIGN_LEFT);
+ header->SetFont(header->font().DeriveFont(4));
+ container->AddChildView(header);
+ return container;
+}
+
void SetupLabelForTray(views::Label* label) {
label->SetFont(
label->font().DeriveFont(2, gfx::Font::BOLD));
diff --git a/ash/system/tray/tray_views.h b/ash/system/tray/tray_views.h
index 44127f6..94b1c97 100644
--- a/ash/system/tray/tray_views.h
+++ b/ash/system/tray/tray_views.h
@@ -89,6 +89,11 @@ class FixedSizedScrollView : public views::ScrollView {
DISALLOW_COPY_AND_ASSIGN(FixedSizedScrollView);
};
+// Creates a container for the various detailed popups. Clicking on the view
+// triggers the callback in ViewClickListener.
+views::View* CreateDetailedHeaderEntry(int string_id,
+ ViewClickListener* listener);
+
// Sets up a Label properly for the tray (sets color, font etc.).
void SetupLabelForTray(views::Label* label);
diff --git a/chrome/browser/chromeos/system/ash_system_tray_delegate.cc b/chrome/browser/chromeos/system/ash_system_tray_delegate.cc
index 9cc7d80..81ae4a4 100644
--- a/chrome/browser/chromeos/system/ash_system_tray_delegate.cc
+++ b/chrome/browser/chromeos/system/ash_system_tray_delegate.cc
@@ -69,6 +69,15 @@ ash::NetworkIconInfo CreateNetworkIconInfo(const Network* network,
return info;
}
+void ExtractIMEInfo(const input_method::InputMethodDescriptor& ime,
+ const input_method::InputMethodUtil& util,
+ ash::IMEInfo* info) {
+ info->id = ime.id();
+ info->name = UTF8ToUTF16(util.GetInputMethodDisplayNameFromId(info->id));
+ info->short_name = util.GetInputMethodShortName(ime);
+}
+
+
void BluetoothPowerFailure() {
// TODO(sad): Show an error bubble?
}
@@ -229,6 +238,10 @@ class SystemTrayDelegate : public ash::SystemTrayDelegate,
// TODO(sad): Make this work.
}
+ virtual void ShowIMESettings() OVERRIDE {
+ GetAppropriateBrowser()->OpenLanguageOptionsDialog();
+ }
+
virtual void ShowHelp() OVERRIDE {
GetAppropriateBrowser()->ShowHelpTab();
}
@@ -297,6 +310,15 @@ class SystemTrayDelegate : public ash::SystemTrayDelegate,
device->Connect(NULL, base::Bind(&BluetoothDeviceConnectError));
}
+ virtual void GetCurrentIME(ash::IMEInfo* info) OVERRIDE {
+ input_method::InputMethodManager* manager =
+ input_method::InputMethodManager::GetInstance();
+ input_method::InputMethodUtil* util = manager->GetInputMethodUtil();
+ input_method::InputMethodDescriptor ime = manager->GetCurrentInputMethod();
+ ExtractIMEInfo(ime, *util, info);
+ info->selected = true;
+ }
+
virtual void GetAvailableIMEList(ash::IMEInfoList* list) OVERRIDE {
input_method::InputMethodManager* manager =
input_method::InputMethodManager::GetInstance();
@@ -307,19 +329,20 @@ class SystemTrayDelegate : public ash::SystemTrayDelegate,
for (size_t i = 0; i < ime_descriptors->size(); i++) {
input_method::InputMethodDescriptor& ime = ime_descriptors->at(i);
ash::IMEInfo info;
- info.id = ime.id();
- info.name = UTF8ToUTF16(util->GetInputMethodDisplayNameFromId(info.id));
- info.short_name = util->GetInputMethodShortName(ime);
+ ExtractIMEInfo(ime, *util, &info);
info.selected = ime.id() == current;
list->push_back(info);
}
}
- virtual ash::NetworkIconInfo GetMostRelevantNetworkIcon(bool large) OVERRIDE {
- ash::NetworkIconInfo info;
- info.image = !large ? network_icon_->GetIconAndText(&info.description) :
- network_icon_large_->GetIconAndText(&info.description);
- return info;
+ virtual void SwitchIME(const std::string& ime_id) OVERRIDE {
+ input_method::InputMethodManager::GetInstance()->ChangeInputMethod(ime_id);
+ }
+
+ virtual void GetMostRelevantNetworkIcon(ash::NetworkIconInfo* info,
+ bool large) OVERRIDE {
+ info->image = !large ? network_icon_->GetIconAndText(&info->description) :
+ network_icon_large_->GetIconAndText(&info->description);
}
virtual void GetAvailableNetworks(
diff --git a/ui/resources/ui_resources.grd b/ui/resources/ui_resources.grd
index a5b0c43..fd9a330 100644
--- a/ui/resources/ui_resources.grd
+++ b/ui/resources/ui_resources.grd
@@ -359,6 +359,7 @@
<include name="IDR_AURA_UBER_TRAY_CAPS_LOCK" file="aura/status_capslock.png" type="BINDATA" />
<include name="IDR_AURA_UBER_TRAY_BLUETOOTH_SMALL" file="aura/status_bluetooth_small.png" type="BINDATA" />
<include name="IDR_AURA_UBER_TRAY_BLUETOOTH_LARGE" file="aura/status_bluetooth_large.png" type="BINDATA" />
+ <include name="IDR_AURA_UBER_TRAY_IME" file="aura/status_ime_large.png" type="BINDATA" />
<include name="IDR_OAK" file="oak.png" type="BINDATA"/>
</if>