Commit 43d43c98 authored by zork@chromium.org's avatar zork@chromium.org

Show the IME notification if the system shelf is hidden

BUG=120576


Review URL: https://chromiumcodereview.appspot.com/10830114

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@149578 0039d316-1c4b-4281-b951-d872f2087c98
parent 0f0e1555
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
#include "ash/system/tray/tray_item_view.h" #include "ash/system/tray/tray_item_view.h"
#include "ash/system/tray/tray_notification_view.h" #include "ash/system/tray/tray_notification_view.h"
#include "ash/system/tray/tray_views.h" #include "ash/system/tray/tray_views.h"
#include "ash/wm/shelf_layout_manager.h"
#include "base/logging.h" #include "base/logging.h"
#include "base/timer.h" #include "base/timer.h"
#include "base/utf_string_conversions.h" #include "base/utf_string_conversions.h"
...@@ -171,16 +172,12 @@ class IMENotificationView : public TrayNotificationView { ...@@ -171,16 +172,12 @@ class IMENotificationView : public TrayNotificationView {
public: public:
explicit IMENotificationView(TrayIME* tray) explicit IMENotificationView(TrayIME* tray)
: TrayNotificationView(tray, IDR_AURA_UBER_TRAY_IME) { : TrayNotificationView(tray, IDR_AURA_UBER_TRAY_IME) {
SystemTrayDelegate* delegate = Shell::GetInstance()->tray_delegate(); InitView(GetLabel());
IMEInfo current; }
delegate->GetCurrentIME(&current);
// TODO(zork): Use IDS_ASH_STATUS_TRAY_THIRD_PARTY_IME_TURNED_ON_BUBBLE for void UpdateLabel() {
// third party IMEs RestartAutoCloseTimer();
InitView(new views::Label( UpdateView(GetLabel());
l10n_util::GetStringFUTF16(
IDS_ASH_STATUS_TRAY_IME_TURNED_ON_BUBBLE,
current.short_name)));
} }
void StartAutoCloseTimer(int seconds) { void StartAutoCloseTimer(int seconds) {
...@@ -212,6 +209,20 @@ class IMENotificationView : public TrayNotificationView { ...@@ -212,6 +209,20 @@ class IMENotificationView : public TrayNotificationView {
tray()->HideNotificationView(); tray()->HideNotificationView();
} }
views::Label* GetLabel() {
SystemTrayDelegate* delegate = Shell::GetInstance()->tray_delegate();
IMEInfo current;
delegate->GetCurrentIME(&current);
// TODO(zork): Use IDS_ASH_STATUS_TRAY_THIRD_PARTY_IME_TURNED_ON_BUBBLE for
// third party IMEs
return new views::Label(
l10n_util::GetStringFUTF16(
IDS_ASH_STATUS_TRAY_IME_TURNED_ON_BUBBLE,
current.short_name));
}
int autoclose_delay_; int autoclose_delay_;
base::OneShotTimer<IMENotificationView> autoclose_; base::OneShotTimer<IMENotificationView> autoclose_;
...@@ -319,8 +330,12 @@ void TrayIME::OnIMERefresh(bool show_message) { ...@@ -319,8 +330,12 @@ void TrayIME::OnIMERefresh(bool show_message) {
if (detailed_) if (detailed_)
detailed_->Update(list, property_list); detailed_->Update(list, property_list);
if (list.size() > 1 && show_message && !message_shown_) { if (list.size() > 1 && show_message) {
if (!notification_) { // If the notification is still visible, hide it and clear the flag so it is
// refreshed.
if (notification_) {
notification_->UpdateLabel();
} else if (!Shell::GetInstance()->shelf()->IsVisible() || !message_shown_) {
ShowNotificationView(); ShowNotificationView();
message_shown_ = true; message_shown_ = true;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment