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

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

Issue 2300423002: Reland of Make TrayDetailsView a ViewClickListener and ButtonListener (Closed)
Patch Set: for review Created 4 years, 3 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_list_view.cc
diff --git a/ash/common/system/chromeos/ime_menu/ime_list_view.cc b/ash/common/system/chromeos/ime_menu/ime_list_view.cc
index a60d3106ad213a8ce81b13c79ffee3a32d607696..fd8a852dc2ca7737a47f2c545924bce8d4aceb5c 100644
--- a/ash/common/system/chromeos/ime_menu/ime_list_view.cc
+++ b/ash/common/system/chromeos/ime_menu/ime_list_view.cc
@@ -129,28 +129,28 @@ void ImeListView::AppendKeyboardStatus() {
keyboard_status_ = container;
}
-void ImeListView::OnViewClicked(views::View* sender) {
- SystemTrayDelegate* delegate = WmShell::Get()->system_tray_delegate();
- if (sender == keyboard_status_) {
+void ImeListView::HandleViewClicked(views::View* view) {
+ if (view == keyboard_status_) {
WmShell::Get()->ToggleIgnoreExternalKeyboard();
+ return;
+ }
+
+ SystemTrayDelegate* delegate = WmShell::Get()->system_tray_delegate();
+ std::map<views::View*, std::string>::const_iterator ime = ime_map_.find(view);
+ if (ime != ime_map_.end()) {
+ WmShell::Get()->RecordUserMetricsAction(UMA_STATUS_AREA_IME_SWITCH_MODE);
+ std::string ime_id = ime->second;
+ delegate->SwitchIME(ime_id);
} else {
- std::map<views::View*, std::string>::const_iterator ime_find;
- ime_find = ime_map_.find(sender);
- if (ime_find != ime_map_.end()) {
- WmShell::Get()->RecordUserMetricsAction(UMA_STATUS_AREA_IME_SWITCH_MODE);
- std::string ime_id = ime_find->second;
- delegate->SwitchIME(ime_id);
- GetWidget()->Close();
- } else {
- std::map<views::View*, std::string>::const_iterator prop_find;
- prop_find = property_map_.find(sender);
- if (prop_find != property_map_.end()) {
- const std::string key = prop_find->second;
- delegate->ActivateIMEProperty(key);
- GetWidget()->Close();
- }
- }
+ std::map<views::View*, std::string>::const_iterator property =
+ property_map_.find(view);
+ if (property == property_map_.end())
+ return;
+ const std::string key = property->second;
+ delegate->ActivateIMEProperty(key);
}
+
+ GetWidget()->Close();
}
} // namespace ash

Powered by Google App Engine
This is Rietveld 408576698