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

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

Issue 2469663002: [ash-md] Add on-screen keyboard toggle row in IME menu view. (Closed)
Patch Set: Addressed comments. Created 4 years, 1 month 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/material_design/material_design_controller.h" 7 #include "ash/common/material_design/material_design_controller.h"
8 #include "ash/common/system/tray/hover_highlight_view.h" 8 #include "ash/common/system/tray/hover_highlight_view.h"
9 #include "ash/common/system/tray/ime_info.h" 9 #include "ash/common/system/tray/ime_info.h"
10 #include "ash/common/system/tray/system_menu_button.h"
10 #include "ash/common/system/tray/system_tray_delegate.h" 11 #include "ash/common/system/tray/system_tray_delegate.h"
11 #include "ash/common/system/tray/tray_constants.h" 12 #include "ash/common/system/tray/tray_constants.h"
12 #include "ash/common/system/tray/tray_details_view.h" 13 #include "ash/common/system/tray/tray_details_view.h"
13 #include "ash/common/system/tray/tray_popup_header_button.h" 14 #include "ash/common/system/tray/tray_popup_header_button.h"
14 #include "ash/common/system/tray/tray_popup_item_style.h" 15 #include "ash/common/system/tray/tray_popup_item_style.h"
16 #include "ash/common/system/tray/tray_popup_utils.h"
17 #include "ash/common/system/tray/tri_view.h"
15 #include "ash/common/wm_shell.h" 18 #include "ash/common/wm_shell.h"
16 #include "grit/ash_resources.h" 19 #include "grit/ash_resources.h"
17 #include "grit/ash_strings.h" 20 #include "grit/ash_strings.h"
18 #include "ui/accessibility/ax_view_state.h" 21 #include "ui/accessibility/ax_view_state.h"
19 #include "ui/base/l10n/l10n_util.h" 22 #include "ui/base/l10n/l10n_util.h"
20 #include "ui/base/resource/resource_bundle.h" 23 #include "ui/base/resource/resource_bundle.h"
21 #include "ui/gfx/color_palette.h" 24 #include "ui/gfx/color_palette.h"
22 #include "ui/gfx/paint_vector_icon.h" 25 #include "ui/gfx/paint_vector_icon.h"
23 #include "ui/gfx/vector_icons_public.h" 26 #include "ui/gfx/vector_icons_public.h"
24 #include "ui/keyboard/keyboard_util.h" 27 #include "ui/keyboard/keyboard_util.h"
25 #include "ui/views/border.h" 28 #include "ui/views/border.h"
26 #include "ui/views/controls/button/label_button.h" 29 #include "ui/views/controls/button/toggle_button.h"
30 #include "ui/views/controls/image_view.h"
27 #include "ui/views/controls/label.h" 31 #include "ui/views/controls/label.h"
28 #include "ui/views/controls/separator.h" 32 #include "ui/views/controls/separator.h"
29 #include "ui/views/layout/box_layout.h" 33 #include "ui/views/layout/fill_layout.h"
34 #include "ui/views/painter.h"
35 #include "ui/views/view.h"
30 #include "ui/views/widget/widget.h" 36 #include "ui/views/widget/widget.h"
31 37
32 namespace ash { 38 namespace ash {
33 namespace { 39 namespace {
34 40
41 const int kKeyboardRowVerticalInset = 4;
42 const int kKeyboardRowSeparatorThickness = 1;
43 const int kMinFontSizeDelta = -10;
44
45 const SkColor kKeyboardRowSeparatorColor = SkColorSetA(SK_ColorBLACK, 0x1F);
46
35 // Creates a separator that will be used between the IME list items. 47 // Creates a separator that will be used between the IME list items.
36 views::Separator* CreateListItemSeparator() { 48 views::Separator* CreateListItemSeparator() {
37 views::Separator* separator = 49 views::Separator* separator =
38 new views::Separator(views::Separator::HORIZONTAL); 50 new views::Separator(views::Separator::HORIZONTAL);
39 separator->SetColor(kBorderLightColor); 51 separator->SetColor(kBorderLightColor);
40 separator->SetPreferredSize(kSeparatorWidth); 52 separator->SetPreferredSize(kSeparatorWidth);
41 separator->SetBorder(views::Border::CreateEmptyBorder( 53 separator->SetBorder(views::Border::CreateEmptyBorder(
42 kMenuSeparatorVerticalPadding, 0, kMenuSeparatorVerticalPadding, 0)); 54 kMenuSeparatorVerticalPadding, 0, kMenuSeparatorVerticalPadding, 0));
43 return separator; 55 return separator;
44 } 56 }
(...skipping 20 matching lines...) Expand all
65 if (selected_) 77 if (selected_)
66 state->AddStateFlag(ui::AX_STATE_CHECKED); 78 state->AddStateFlag(ui::AX_STATE_CHECKED);
67 } 79 }
68 80
69 private: 81 private:
70 bool selected_; 82 bool selected_;
71 83
72 DISALLOW_COPY_AND_ASSIGN(SelectableHoverHighlightView); 84 DISALLOW_COPY_AND_ASSIGN(SelectableHoverHighlightView);
73 }; 85 };
74 86
75 // The view that contains IME short name and the IME label.
76 class ImeInfoView : public views::View {
77 public:
78 ImeInfoView(const base::string16& id, const base::string16& text) {
79 views::BoxLayout* box_layout =
80 new views::BoxLayout(views::BoxLayout::kHorizontal, 0, 0, 0);
81 SetLayoutManager(box_layout);
82
83 // TODO(azurewei): Use TrayPopupItemStyle for |id_button|.
84 views::LabelButton* id_button = new views::LabelButton(nullptr, id);
85 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
86 id_button->SetFontList(rb.GetFontList(ui::ResourceBundle::MediumBoldFont));
87 id_button->SetTextColor(views::Button::STATE_NORMAL, kMenuIconColor);
88 id_button->SetMaxSize(gfx::Size(kMenuButtonSize, kMenuButtonSize));
89 id_button->SetMinSize(gfx::Size(kMenuButtonSize, kMenuButtonSize));
90 const int button_padding = (kMenuButtonSize - kMenuIconSize) / 2;
91 id_button->SetBorder(views::Border::CreateEmptyBorder(
92 button_padding, button_padding, button_padding, button_padding));
93 AddChildView(id_button);
94
95 views::Label* text_label = new views::Label(text);
96 TrayPopupItemStyle style(
97 GetNativeTheme(), TrayPopupItemStyle::FontStyle::DETAILED_VIEW_LABEL);
98 style.SetupLabel(text_label);
99 text_label->SetHorizontalAlignment(gfx::ALIGN_LEFT);
100 box_layout->set_cross_axis_alignment(
101 views::BoxLayout::CROSS_AXIS_ALIGNMENT_CENTER);
102 AddChildView(text_label);
103 box_layout->SetFlexForView(text_label, 1);
104 }
105
106 private:
107 DISALLOW_COPY_AND_ASSIGN(ImeInfoView);
108 };
109
110 // The IME list item view used in the material design. It contains IME info 87 // The IME list item view used in the material design. It contains IME info
111 // (name and label) and a check button if the item is selected. It's also used 88 // (name and label) and a check button if the item is selected. It's also used
112 // for IME property item, which has no name but label and a gray checked icon. 89 // for IME property item, which has no name but label and a gray checked icon.
113 class ImeListItemView : public ActionableView { 90 class ImeListItemView : public ActionableView {
114 public: 91 public:
115 ImeListItemView(SystemTrayItem* owner, 92 ImeListItemView(SystemTrayItem* owner,
116 ImeListView* list_view, 93 ImeListView* list_view,
117 const base::string16& id, 94 const base::string16& id,
118 const base::string16& label, 95 const base::string16& label,
119 bool selected, 96 bool selected,
120 const SkColor button_color) 97 const SkColor button_color)
121 : ActionableView(owner), ime_list_view_(list_view) { 98 : ActionableView(owner), ime_list_view_(list_view) {
122 views::BoxLayout* box_layout = 99 TriView* tri_view = TrayPopupUtils::CreateDefaultRowView();
123 new views::BoxLayout(views::BoxLayout::kHorizontal, 0, 0, 0); 100 AddChildView(tri_view);
124 SetLayoutManager(box_layout); 101 SetLayoutManager(new views::FillLayout);
125 102
126 ImeInfoView* info_view = new ImeInfoView(id, label); 103 // The id button shows the IME short name.
127 AddChildView(info_view); 104 views::Label* id_label = new views::Label(id);
128 box_layout->SetFlexForView(info_view, 1); 105 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
106 const gfx::FontList& base_font_list =
107 rb.GetFontList(ui::ResourceBundle::MediumBoldFont);
108 id_label->SetFontList(base_font_list);
109 id_label->SizeToFit(kMenuIconSize);
110 id_label->SetMaximumWidth(kMenuIconSize);
111
112 // For IMEs whose short name are more than 2 characters (INTL, EXTD, etc.),
113 // |kMenuIconSize| is not enough. The label will trigger eliding as "I..."
114 // or "...". So we shrink the font size until it fits within the bounds.
tdanderson 2016/11/04 19:01:04 Nice comment.
115 int size_delta = -1;
116 while (id_label->GetPreferredSize().width() > kMenuIconSize &&
117 size_delta >= kMinFontSizeDelta) {
118 id_label->SetFontList(base_font_list.DeriveWithSizeDelta(size_delta));
119 // In case we don't run into endless loop
tdanderson 2016/11/04 19:01:04 Since you changed the loop, I think you can remove
Azure Wei 2016/11/05 02:26:19 Done.
120 --size_delta;
121 }
122 tri_view->AddView(TriView::Container::START, id_label);
123
124 // The label shows the IME name.
125 label_ = new views::Label(label);
126 label_->SetHorizontalAlignment(gfx::ALIGN_LEFT);
127 tri_view->AddView(TriView::Container::CENTER, label_);
129 128
130 if (selected) { 129 if (selected) {
131 views::ImageButton* check_button = new views::ImageButton(nullptr); 130 // The checked button indicates the IME is selected.
132 gfx::ImageSkia icon_image = gfx::CreateVectorIcon( 131 views::ImageView* checked_image = TrayPopupUtils::CreateMainImageView();
133 gfx::VectorIconId::CHECK_CIRCLE, kMenuIconSize, button_color); 132 checked_image->SetImage(gfx::CreateVectorIcon(
134 check_button->SetImage(views::CustomButton::STATE_NORMAL, &icon_image); 133 gfx::VectorIconId::CHECK_CIRCLE, kMenuIconSize, button_color));
135 const int button_padding = (kMenuButtonSize - icon_image.width()) / 2; 134 tri_view->AddView(TriView::Container::END, checked_image);
136 check_button->SetBorder(views::Border::CreateEmptyBorder(
137 button_padding, button_padding, button_padding, button_padding));
138 AddChildView(check_button);
139 } 135 }
140 } 136 }
141 137
142 ~ImeListItemView() override {} 138 ~ImeListItemView() override {}
143 139
144 // ActionableView: 140 // ActionableView:
145 bool PerformAction(const ui::Event& event) override { 141 bool PerformAction(const ui::Event& event) override {
146 ime_list_view_->HandleViewClicked(this); 142 ime_list_view_->HandleViewClicked(this);
147 return true; 143 return true;
148 } 144 }
149 145
146 // views::View:
147 void OnNativeThemeChanged(const ui::NativeTheme* theme) override {
148 UpdateStyle();
149 }
150
150 private: 151 private:
152 // Updates the style of |label_| based on the current native theme.
153 void UpdateStyle() {
154 TrayPopupItemStyle style(
155 GetNativeTheme(), TrayPopupItemStyle::FontStyle::DETAILED_VIEW_LABEL);
156 style.SetupLabel(label_);
157 }
158
159 // The label shows the IME name.
160 views::Label* label_;
161
151 ImeListView* ime_list_view_; 162 ImeListView* ime_list_view_;
152 DISALLOW_COPY_AND_ASSIGN(ImeListItemView); 163 DISALLOW_COPY_AND_ASSIGN(ImeListItemView);
153 }; 164 };
154 165
155 } // namespace 166 } // namespace
156 167
168 // The view that contains a |KeyboardButtonView| and a toggle button.
169 class MaterialKeyboardStatusRowView : public views::View {
170 public:
171 MaterialKeyboardStatusRowView(views::ButtonListener* listener, bool enabled)
172 : listener_(listener), label_(nullptr), toggle_(nullptr) {
173 Init();
174 SetKeyboardStatusEnabled(enabled);
175 }
176
177 ~MaterialKeyboardStatusRowView() override {}
178
179 void SetKeyboardStatusEnabled(bool enabled) {
180 toggle_->SetIsOn(enabled, true);
181 SetKeyboardToggleText();
182 }
183
184 void SetKeyboardToggleText() {
185 // TODO (azurewei): Update this as 'On-screen keyboard', as the toggle will
186 // be updated as 'on/off switch'. (crbug.com/652677).
tdanderson 2016/11/04 19:01:04 nit: When you make this change, you should be able
187 toggle_->SetTooltipText(
tdanderson 2016/11/04 19:01:04 We've decided that we're not going to have tooltip
Azure Wei 2016/11/05 02:26:19 Done.
188 toggle_->is_on()
189 ? l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_DISABLE_KEYBOARD)
190 : l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_ENABLE_KEYBOARD));
191 }
192
193 const views::Button* toggle() const { return toggle_; }
194 bool is_toggled() const { return toggle_->is_on(); }
195
196 protected:
197 // views::View:
198 gfx::Size GetPreferredSize() const override {
199 gfx::Size size = views::View::GetPreferredSize();
200 size.set_height(kMenuButtonSize + kKeyboardRowVerticalInset * 2);
201 return size;
202 }
203
204 int GetHeightForWidth(int w) const override {
205 return GetPreferredSize().height();
206 }
207
208 void OnNativeThemeChanged(const ui::NativeTheme* theme) override {
209 UpdateStyle();
210 }
211
212 private:
213 void Init() {
214 SetBorder(views::Border::CreateSolidSidedBorder(
215 kKeyboardRowSeparatorThickness, 0, 0, 0, kKeyboardRowSeparatorColor));
216 TriView* tri_view = TrayPopupUtils::CreateDefaultRowView();
217 AddChildView(tri_view);
218 SetLayoutManager(new views::FillLayout);
219
220 // The on-screen keyboard image button.
221 views::ImageView* keyboard_image = TrayPopupUtils::CreateMainImageView();
222 keyboard_image->SetImage(gfx::CreateVectorIcon(
223 kImeMenuOnScreenKeyboardIcon, kMenuIconSize, kMenuIconColor));
224 tri_view->AddView(TriView::Container::START, keyboard_image);
225
226 // The on-screen keyboard label.
227 label_ = new views::Label(
228 ui::ResourceBundle::GetSharedInstance().GetLocalizedString(
229 IDS_ASH_STATUS_TRAY_ACCESSIBILITY_VIRTUAL_KEYBOARD));
230 label_->SetHorizontalAlignment(gfx::ALIGN_LEFT);
231 tri_view->AddView(TriView::Container::CENTER, label_);
232
233 // The on-screen keyboard toggle button.
234 toggle_ = new views::ToggleButton(listener_);
235 toggle_->SetFocusForPlatform();
236 SetKeyboardToggleText();
237 tri_view->AddView(TriView::Container::END, toggle_);
238 }
239
240 // Updates the style of |label_| based on the current native theme.
241 void UpdateStyle() {
tdanderson 2016/11/04 19:01:05 Thanks for changing this. I'm 99% sure this is the
Azure Wei 2016/11/05 02:26:19 Added calling of UpdateStyle() in Init() to make s
242 TrayPopupItemStyle style(
243 GetNativeTheme(), TrayPopupItemStyle::FontStyle::DETAILED_VIEW_LABEL);
244 style.SetupLabel(label_);
245 }
246
247 // ButtonListener to notify when |toggle_| is clicked.
248 views::ButtonListener* listener_;
249
250 // Label to with text 'On-screen keyboard'.
251 views::Label* label_;
252
253 // ToggleButton to toggle keyboard on or off.
254 views::ToggleButton* toggle_;
255
256 DISALLOW_COPY_AND_ASSIGN(MaterialKeyboardStatusRowView);
257 };
258
157 ImeListView::ImeListView(SystemTrayItem* owner, 259 ImeListView::ImeListView(SystemTrayItem* owner,
158 bool show_keyboard_toggle, 260 bool show_keyboard_toggle,
159 SingleImeBehavior single_ime_behavior) 261 SingleImeBehavior single_ime_behavior)
160 : TrayDetailsView(owner) { 262 : TrayDetailsView(owner) {
161 SystemTrayDelegate* delegate = WmShell::Get()->system_tray_delegate(); 263 SystemTrayDelegate* delegate = WmShell::Get()->system_tray_delegate();
162 IMEInfoList list; 264 IMEInfoList list;
163 delegate->GetAvailableIMEList(&list); 265 delegate->GetAvailableIMEList(&list);
164 IMEPropertyInfoList property_list; 266 IMEPropertyInfoList property_list;
165 delegate->GetCurrentIMEProperties(&property_list); 267 delegate->GetCurrentIMEProperties(&property_list);
166 Update(list, property_list, show_keyboard_toggle, single_ime_behavior); 268 Update(list, property_list, show_keyboard_toggle, single_ime_behavior);
167 } 269 }
168 270
169 ImeListView::~ImeListView() {} 271 ImeListView::~ImeListView() {}
170 272
171 void ImeListView::Update(const IMEInfoList& list, 273 void ImeListView::Update(const IMEInfoList& list,
172 const IMEPropertyInfoList& property_list, 274 const IMEPropertyInfoList& property_list,
173 bool show_keyboard_toggle, 275 bool show_keyboard_toggle,
174 SingleImeBehavior single_ime_behavior) { 276 SingleImeBehavior single_ime_behavior) {
175 Reset(); 277 ResetImeListView();
278 if (show_keyboard_toggle &&
279 MaterialDesignController::IsSystemTrayMenuMaterial()) {
280 AppendMaterialKeyboardStatus();
281 }
282
176 ime_map_.clear(); 283 ime_map_.clear();
177 property_map_.clear(); 284 property_map_.clear();
178 CreateScrollableList(); 285 CreateScrollableList();
179 286
180 // Appends IME list and IME properties. 287 // Appends IME list and IME properties.
181 if (single_ime_behavior == ImeListView::SHOW_SINGLE_IME || list.size() > 1) { 288 if (single_ime_behavior == ImeListView::SHOW_SINGLE_IME || list.size() > 1) {
182 if (MaterialDesignController::IsSystemTrayMenuMaterial()) { 289 if (MaterialDesignController::IsSystemTrayMenuMaterial()) {
183 AppendImeListAndProperties(list, property_list); 290 AppendImeListAndProperties(list, property_list);
184 } else { 291 } else {
185 AppendIMEList(list); 292 AppendIMEList(list);
186 if (!property_list.empty()) 293 if (!property_list.empty())
187 AppendIMEProperties(property_list); 294 AppendIMEProperties(property_list);
188 } 295 }
189 } 296 }
190 297
191 if (show_keyboard_toggle) { 298 if (show_keyboard_toggle) {
192 if (list.size() > 1 || !property_list.empty()) 299 if (list.size() > 1 || !property_list.empty())
193 AddScrollSeparator(); 300 AddScrollSeparator();
301 DCHECK(!MaterialDesignController::IsSystemTrayMenuMaterial());
tdanderson 2016/11/04 19:01:05 I think you will want to move this to the top of A
Azure Wei 2016/11/05 02:26:19 Sorry, I've got wrong about the scroll separator.
194 AppendKeyboardStatus(); 302 AppendKeyboardStatus();
195 } 303 }
196 304
197 Layout(); 305 Layout();
198 SchedulePaint(); 306 SchedulePaint();
199 } 307 }
200 308
309 void ImeListView::ResetImeListView() {
310 // Children are removed from the view hierarchy and deleted in Reset().
311 Reset();
312 material_keyboard_statuts_view_ = nullptr;
313 keyboard_status_ = nullptr;
314 }
315
201 void ImeListView::AppendIMEList(const IMEInfoList& list) { 316 void ImeListView::AppendIMEList(const IMEInfoList& list) {
202 DCHECK(ime_map_.empty()); 317 DCHECK(ime_map_.empty());
203 for (size_t i = 0; i < list.size(); i++) { 318 for (size_t i = 0; i < list.size(); i++) {
204 HoverHighlightView* container = 319 HoverHighlightView* container =
205 new SelectableHoverHighlightView(this, list[i].name, list[i].selected); 320 new SelectableHoverHighlightView(this, list[i].name, list[i].selected);
206 scroll_content()->AddChildView(container); 321 scroll_content()->AddChildView(container);
207 ime_map_[container] = list[i].id; 322 ime_map_[container] = list[i].id;
208 } 323 }
209 } 324 }
210 325
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 HoverHighlightView* container = new HoverHighlightView(this); 373 HoverHighlightView* container = new HoverHighlightView(this);
259 int id = keyboard::IsKeyboardEnabled() ? IDS_ASH_STATUS_TRAY_DISABLE_KEYBOARD 374 int id = keyboard::IsKeyboardEnabled() ? IDS_ASH_STATUS_TRAY_DISABLE_KEYBOARD
260 : IDS_ASH_STATUS_TRAY_ENABLE_KEYBOARD; 375 : IDS_ASH_STATUS_TRAY_ENABLE_KEYBOARD;
261 container->AddLabel( 376 container->AddLabel(
262 ui::ResourceBundle::GetSharedInstance().GetLocalizedString(id), 377 ui::ResourceBundle::GetSharedInstance().GetLocalizedString(id),
263 gfx::ALIGN_LEFT, false /* highlight */); 378 gfx::ALIGN_LEFT, false /* highlight */);
264 scroll_content()->AddChildView(container); 379 scroll_content()->AddChildView(container);
265 keyboard_status_ = container; 380 keyboard_status_ = container;
266 } 381 }
267 382
383 void ImeListView::AppendMaterialKeyboardStatus() {
384 DCHECK(MaterialDesignController::IsSystemTrayMenuMaterial());
385 if (material_keyboard_statuts_view_)
386 return;
387 MaterialKeyboardStatusRowView* view =
388 new MaterialKeyboardStatusRowView(this, keyboard::IsKeyboardEnabled());
389 view->SetKeyboardStatusEnabled(keyboard::IsKeyboardEnabled());
390 AddChildView(view);
391 material_keyboard_statuts_view_ = view;
392 }
393
268 void ImeListView::HandleViewClicked(views::View* view) { 394 void ImeListView::HandleViewClicked(views::View* view) {
269 if (view == keyboard_status_) { 395 if (view == keyboard_status_) {
270 WmShell::Get()->ToggleIgnoreExternalKeyboard(); 396 WmShell::Get()->ToggleIgnoreExternalKeyboard();
271 return; 397 return;
272 } 398 }
273 399
274 SystemTrayDelegate* delegate = WmShell::Get()->system_tray_delegate(); 400 SystemTrayDelegate* delegate = WmShell::Get()->system_tray_delegate();
275 std::map<views::View*, std::string>::const_iterator ime = ime_map_.find(view); 401 std::map<views::View*, std::string>::const_iterator ime = ime_map_.find(view);
276 if (ime != ime_map_.end()) { 402 if (ime != ime_map_.end()) {
277 WmShell::Get()->RecordUserMetricsAction(UMA_STATUS_AREA_IME_SWITCH_MODE); 403 WmShell::Get()->RecordUserMetricsAction(UMA_STATUS_AREA_IME_SWITCH_MODE);
278 std::string ime_id = ime->second; 404 std::string ime_id = ime->second;
279 delegate->SwitchIME(ime_id); 405 delegate->SwitchIME(ime_id);
280 } else { 406 } else {
281 std::map<views::View*, std::string>::const_iterator property = 407 std::map<views::View*, std::string>::const_iterator property =
282 property_map_.find(view); 408 property_map_.find(view);
283 if (property == property_map_.end()) 409 if (property == property_map_.end())
284 return; 410 return;
285 const std::string key = property->second; 411 const std::string key = property->second;
286 delegate->ActivateIMEProperty(key); 412 delegate->ActivateIMEProperty(key);
287 } 413 }
288 414
289 GetWidget()->Close(); 415 GetWidget()->Close();
290 } 416 }
291 417
418 void ImeListView::ButtonPressed(views::Button* sender, const ui::Event& event) {
419 if (material_keyboard_statuts_view_ &&
420 sender == material_keyboard_statuts_view_->toggle()) {
421 WmShell::Get()->ToggleIgnoreExternalKeyboard();
422 // Set the toggle's a11y text.
423 material_keyboard_statuts_view_->SetKeyboardToggleText();
424 }
425 }
426
292 } // namespace ash 427 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698