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

Side by Side Diff: ash/common/system/chromeos/ime_menu/ime_list_view.cc

Issue 2289223002: Make TrayDetailsView a ViewClickListener and ButtonListener (Closed)
Patch Set: rebase 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ash/common/system/chromeos/ime_menu/ime_list_view.h" 5 #include "ash/common/system/chromeos/ime_menu/ime_list_view.h"
6 6
7 #include "ash/common/system/tray/hover_highlight_view.h" 7 #include "ash/common/system/tray/hover_highlight_view.h"
8 #include "ash/common/system/tray/ime_info.h" 8 #include "ash/common/system/tray/ime_info.h"
9 #include "ash/common/system/tray/system_tray_delegate.h" 9 #include "ash/common/system/tray/system_tray_delegate.h"
10 #include "ash/common/system/tray/tray_constants.h" 10 #include "ash/common/system/tray/tray_constants.h"
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 HoverHighlightView* container = new HoverHighlightView(this); 122 HoverHighlightView* container = new HoverHighlightView(this);
123 int id = keyboard::IsKeyboardEnabled() ? IDS_ASH_STATUS_TRAY_DISABLE_KEYBOARD 123 int id = keyboard::IsKeyboardEnabled() ? IDS_ASH_STATUS_TRAY_DISABLE_KEYBOARD
124 : IDS_ASH_STATUS_TRAY_ENABLE_KEYBOARD; 124 : IDS_ASH_STATUS_TRAY_ENABLE_KEYBOARD;
125 container->AddLabel( 125 container->AddLabel(
126 ui::ResourceBundle::GetSharedInstance().GetLocalizedString(id), 126 ui::ResourceBundle::GetSharedInstance().GetLocalizedString(id),
127 gfx::ALIGN_LEFT, false /* highlight */); 127 gfx::ALIGN_LEFT, false /* highlight */);
128 scroll_content()->AddChildView(container); 128 scroll_content()->AddChildView(container);
129 keyboard_status_ = container; 129 keyboard_status_ = container;
130 } 130 }
131 131
132 void ImeListView::OnViewClicked(views::View* sender) { 132 void ImeListView::HandleViewClicked(views::View* view) {
133 if (view == keyboard_status_) {
134 WmShell::Get()->ToggleIgnoreExternalKeyboard();
135 return;
136 }
137
133 SystemTrayDelegate* delegate = WmShell::Get()->system_tray_delegate(); 138 SystemTrayDelegate* delegate = WmShell::Get()->system_tray_delegate();
134 if (sender == keyboard_status_) { 139 std::map<views::View*, std::string>::const_iterator ime_find;
varkha 2016/08/31 20:28:14 Merge those two lines? Here and below for prop_fin
tdanderson 2016/08/31 22:24:15 Done.
135 WmShell::Get()->ToggleIgnoreExternalKeyboard(); 140 ime_find = ime_map_.find(view);
141 if (ime_find != ime_map_.end()) {
142 WmShell::Get()->RecordUserMetricsAction(UMA_STATUS_AREA_IME_SWITCH_MODE);
143 std::string ime_id = ime_find->second;
144 delegate->SwitchIME(ime_id);
145 GetWidget()->Close();
varkha 2016/08/31 20:28:14 nit: This could be taken out of {} and done at the
tdanderson 2016/08/31 22:24:15 Done, but in a slightly different manner than sugg
136 } else { 146 } else {
137 std::map<views::View*, std::string>::const_iterator ime_find; 147 std::map<views::View*, std::string>::const_iterator prop_find;
138 ime_find = ime_map_.find(sender); 148 prop_find = property_map_.find(view);
139 if (ime_find != ime_map_.end()) { 149 if (prop_find != property_map_.end()) {
140 WmShell::Get()->RecordUserMetricsAction(UMA_STATUS_AREA_IME_SWITCH_MODE); 150 const std::string key = prop_find->second;
141 std::string ime_id = ime_find->second; 151 delegate->ActivateIMEProperty(key);
142 delegate->SwitchIME(ime_id);
143 GetWidget()->Close(); 152 GetWidget()->Close();
144 } else {
145 std::map<views::View*, std::string>::const_iterator prop_find;
146 prop_find = property_map_.find(sender);
147 if (prop_find != property_map_.end()) {
148 const std::string key = prop_find->second;
149 delegate->ActivateIMEProperty(key);
150 GetWidget()->Close();
151 }
152 } 153 }
153 } 154 }
154 } 155 }
155 156
156 } // namespace ash 157 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698