Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(127)

Unified Diff: ash/common/system/chromeos/ime_menu/ime_menu_tray.cc

Issue 2277753006: Revert "Revert of Updates the IME list when the IME has refreshed. (patchset #7 id:120001 of https:… (Closed)
Patch Set: Add new test to cover the crash. Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ash/common/system/chromeos/ime_menu/ime_menu_tray.cc
diff --git a/ash/common/system/chromeos/ime_menu/ime_menu_tray.cc b/ash/common/system/chromeos/ime_menu/ime_menu_tray.cc
index b98267b3ed70db7041fcef23d01e7fca5ec3e55a..be185298a914225a73c72145b17f7191fe228e47 100644
--- a/ash/common/system/chromeos/ime_menu/ime_menu_tray.cc
+++ b/ash/common/system/chromeos/ime_menu/ime_menu_tray.cc
@@ -59,10 +59,10 @@ TrayPopupHeaderButton* CreateImeMenuButton(views::ButtonListener* listener,
int accessible_name_id,
int message_id,
int right_border) {
- TrayPopupHeaderButton* button = new ash::TrayPopupHeaderButton(
- listener, enabled_resource_id, disabled_resource_id,
- enabled_resource_id_hover, disabled_resource_id_hover,
- accessible_name_id);
+ TrayPopupHeaderButton* button =
+ new TrayPopupHeaderButton(listener, enabled_resource_id,
+ disabled_resource_id, enabled_resource_id_hover,
+ disabled_resource_id_hover, accessible_name_id);
button->SetTooltipText(l10n_util::GetStringUTF16(message_id));
button->SetBorder(views::Border::CreateSolidSidedBorder(0, 0, 0, right_border,
kBorderDarkColor));
@@ -154,12 +154,14 @@ ImeMenuTray::ImeMenuTray(WmShelf* wm_shelf)
}
ImeMenuTray::~ImeMenuTray() {
+ if (bubble_)
+ bubble_->bubble_view()->reset_delegate();
WmShell::Get()->system_tray_notifier()->RemoveIMEObserver(this);
}
void ImeMenuTray::SetShelfAlignment(ShelfAlignment alignment) {
TrayBackgroundView::SetShelfAlignment(alignment);
- if (!ash::MaterialDesignController::IsShelfMaterial())
+ if (!MaterialDesignController::IsShelfMaterial())
tray_container()->SetBorder(views::Border::NullBorder());
}
@@ -186,6 +188,15 @@ bool ImeMenuTray::PerformAction(const ui::Event& event) {
void ImeMenuTray::OnIMERefresh() {
UpdateTrayLabel();
+ if (bubble_ && ime_list_view_) {
+ SystemTrayDelegate* delegate = WmShell::Get()->system_tray_delegate();
+ IMEInfoList list;
+ delegate->GetAvailableIMEList(&list);
+ IMEPropertyInfoList property_list;
+ delegate->GetCurrentIMEProperties(&property_list);
+ ime_list_view_->Update(list, property_list, false,
+ ImeListView::SHOW_SINGLE_IME);
+ }
}
void ImeMenuTray::OnIMEMenuActivationChanged(bool is_activated) {
@@ -197,7 +208,6 @@ void ImeMenuTray::OnIMEMenuActivationChanged(bool is_activated) {
}
void ImeMenuTray::BubbleViewDestroyed() {
- SetDrawBackgroundAsActive(false);
}
void ImeMenuTray::OnMouseEnteredView() {}
@@ -267,14 +277,14 @@ void ImeMenuTray::ShowImeMenuBubble() {
bubble_view->set_margins(gfx::Insets(7, 0, 0, 0));
bubble_view->SetArrowPaintType(views::BubbleBorder::PAINT_NONE);
- ImeListView* ime_list_view =
+ // Adds IME list to the bubble.
+ ime_list_view_ =
new ImeListView(nullptr, false, ImeListView::SHOW_SINGLE_IME);
- if (ime_list_view->scroll_content()->height() > GetImeListViewMaxHeight()) {
- ime_list_view->scroller()->SetFixedSize(
+ if (ime_list_view_->scroll_content()->height() > GetImeListViewMaxHeight()) {
+ ime_list_view_->scroller()->SetFixedSize(
gfx::Size(kTrayPopupMaxWidth, GetImeListViewMaxHeight()));
}
- // Adds IME list to the bubble.
- bubble_view->AddChildView(ime_list_view);
+ bubble_view->AddChildView(ime_list_view_);
// Adds IME buttons to the bubble if needed.
LoginStatus login =
@@ -283,12 +293,13 @@ void ImeMenuTray::ShowImeMenuBubble() {
!WmShell::Get()->GetSessionStateDelegate()->IsInSecondaryLoginScreen())
bubble_view->AddChildView(new ImeButtonsView(false, false, false, true));
- bubble_.reset(new ash::TrayBubbleWrapper(this, bubble_view));
+ bubble_.reset(new TrayBubbleWrapper(this, bubble_view));
SetDrawBackgroundAsActive(true);
}
void ImeMenuTray::HideImeMenuBubble() {
bubble_.reset();
+ ime_list_view_ = nullptr;
SetDrawBackgroundAsActive(false);
}
« no previous file with comments | « ash/common/system/chromeos/ime_menu/ime_menu_tray.h ('k') | ash/common/system/chromeos/ime_menu/ime_menu_tray_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698