summaryrefslogtreecommitdiffstats
path: root/ash
diff options
context:
space:
mode:
authorazurewei <azurewei@chromium.org>2016-03-16 02:00:23 -0700
committerCommit bot <commit-bot@chromium.org>2016-03-16 09:01:56 +0000
commit048e27baed82c694a44889c1c3c8693d3f830293 (patch)
tree2340f827fe41619f3fd4457e35fced31ba076b76 /ash
parenta0c8fd907f48ef36195b20cf02e4da9483fdc543 (diff)
downloadchromium_src-048e27baed82c694a44889c1c3c8693d3f830293.zip
chromium_src-048e27baed82c694a44889c1c3c8693d3f830293.tar.gz
chromium_src-048e27baed82c694a44889c1c3c8693d3f830293.tar.bz2
Remove the IME items in the status tray when the IME menu is activated.
BUG=570761 TEST=None Review URL: https://codereview.chromium.org/1765383003 Cr-Commit-Position: refs/heads/master@{#381422}
Diffstat (limited to 'ash')
-rw-r--r--ash/system/ime/ime_observer.h6
-rw-r--r--ash/system/ime/tray_ime_chromeos.cc17
-rw-r--r--ash/system/ime/tray_ime_chromeos.h3
-rw-r--r--ash/system/tray/system_tray_notifier.cc6
-rw-r--r--ash/system/tray/system_tray_notifier.h1
5 files changed, 29 insertions, 4 deletions
diff --git a/ash/system/ime/ime_observer.h b/ash/system/ime/ime_observer.h
index a7f938c..1707062 100644
--- a/ash/system/ime/ime_observer.h
+++ b/ash/system/ime/ime_observer.h
@@ -14,6 +14,12 @@ class IMEObserver {
// Notify the observer that the IME state has changed, and should be
// refreshed.
virtual void OnIMERefresh() = 0;
+
+ // Notify the observer that the IME menu activation state has changed, and
+ // should be refreshed. |is_active| represents whether the new IME menu is
+ // active, and IME related items in system tray should be removed if
+ // |is_active| is true.
+ virtual void OnIMEMenuActivationChanged(bool is_active) = 0;
};
} // namespace ash
diff --git a/ash/system/ime/tray_ime_chromeos.cc b/ash/system/ime/tray_ime_chromeos.cc
index 4896a59..fad9d20 100644
--- a/ash/system/ime/tray_ime_chromeos.cc
+++ b/ash/system/ime/tray_ime_chromeos.cc
@@ -236,7 +236,8 @@ TrayIME::TrayIME(SystemTray* system_tray)
tray_label_(NULL),
default_(NULL),
detailed_(NULL),
- keyboard_suppressed_(false) {
+ keyboard_suppressed_(false),
+ is_visible_(true) {
Shell::GetInstance()->system_tray_notifier()->AddIMEObserver(this);
Shell::GetInstance()->system_tray_notifier()->AddVirtualKeyboardObserver(
this);
@@ -273,7 +274,7 @@ void TrayIME::Update() {
void TrayIME::UpdateTrayLabel(const IMEInfo& current, size_t count) {
if (tray_label_) {
- bool visible = count > 1;
+ bool visible = count > 1 && is_visible_;
tray_label_->SetVisible(visible);
// Do not change label before hiding because this change is noticeable.
if (!visible)
@@ -368,9 +369,17 @@ void TrayIME::OnIMERefresh() {
Update();
}
+void TrayIME::OnIMEMenuActivationChanged(bool is_active) {
+ is_visible_ = !is_active;
+ if (is_visible_)
+ OnIMERefresh();
+ else
+ Update();
+}
+
bool TrayIME::ShouldDefaultViewBeVisible() {
- return ime_list_.size() > 1 || property_list_.size() > 1 ||
- ShouldShowKeyboardToggle();
+ return is_visible_ && (ime_list_.size() > 1 || property_list_.size() > 1 ||
+ ShouldShowKeyboardToggle());
}
} // namespace ash
diff --git a/ash/system/ime/tray_ime_chromeos.h b/ash/system/ime/tray_ime_chromeos.h
index 7cf60cc..aad4afb 100644
--- a/ash/system/ime/tray_ime_chromeos.h
+++ b/ash/system/ime/tray_ime_chromeos.h
@@ -69,6 +69,7 @@ class ASH_EXPORT TrayIME : public SystemTrayItem,
// Overridden from IMEObserver.
void OnIMERefresh() override;
+ void OnIMEMenuActivationChanged(bool is_active) override;
// Whether the default view should be shown.
bool ShouldDefaultViewBeVisible();
@@ -82,6 +83,8 @@ class ASH_EXPORT TrayIME : public SystemTrayItem,
IMEInfoList ime_list_;
IMEInfo current_ime_;
IMEPropertyInfoList property_list_;
+ // Whether the IME label and tray items should be visible.
+ bool is_visible_;
DISALLOW_COPY_AND_ASSIGN(TrayIME);
};
diff --git a/ash/system/tray/system_tray_notifier.cc b/ash/system/tray/system_tray_notifier.cc
index ec5bd8d..9432bf8 100644
--- a/ash/system/tray/system_tray_notifier.cc
+++ b/ash/system/tray/system_tray_notifier.cc
@@ -275,6 +275,12 @@ void SystemTrayNotifier::NotifyRefreshIME() {
OnIMERefresh());
}
+void SystemTrayNotifier::NotifyRefreshIMEMenu(bool is_active) {
+ FOR_EACH_OBSERVER(IMEObserver,
+ ime_observers_,
+ OnIMEMenuActivationChanged(is_active));
+}
+
void SystemTrayNotifier::NotifyLocaleChanged(
LocaleObserver::Delegate* delegate,
const std::string& cur_locale,
diff --git a/ash/system/tray/system_tray_notifier.h b/ash/system/tray/system_tray_notifier.h
index 6e92a7d..44e7c29 100644
--- a/ash/system/tray/system_tray_notifier.h
+++ b/ash/system/tray/system_tray_notifier.h
@@ -126,6 +126,7 @@ class ASH_EXPORT SystemTrayNotifier {
void NotifySystemClockTimeUpdated();
void NotifySystemClockCanSetTimeChanged(bool can_set_time);
void NotifyRefreshIME();
+ void NotifyRefreshIMEMenu(bool is_active);
void NotifyLocaleChanged(LocaleObserver::Delegate* delegate,
const std::string& cur_locale,
const std::string& from_locale,