| OLD | NEW |
| 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_menu_button.h" |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 220 | 220 |
| 221 // ButtonListener to notify when |toggle_| is clicked. | 221 // ButtonListener to notify when |toggle_| is clicked. |
| 222 views::ButtonListener* listener_; | 222 views::ButtonListener* listener_; |
| 223 | 223 |
| 224 // ToggleButton to toggle keyboard on or off. | 224 // ToggleButton to toggle keyboard on or off. |
| 225 views::ToggleButton* toggle_; | 225 views::ToggleButton* toggle_; |
| 226 | 226 |
| 227 DISALLOW_COPY_AND_ASSIGN(MaterialKeyboardStatusRowView); | 227 DISALLOW_COPY_AND_ASSIGN(MaterialKeyboardStatusRowView); |
| 228 }; | 228 }; |
| 229 | 229 |
| 230 ImeListView::ImeListView(SystemTrayItem* owner, | 230 ImeListView::ImeListView(SystemTrayItem* owner) |
| 231 bool show_keyboard_toggle, | |
| 232 SingleImeBehavior single_ime_behavior) | |
| 233 : TrayDetailsView(owner), | 231 : TrayDetailsView(owner), |
| 234 last_item_selected_with_keyboard_(false), | 232 last_item_selected_with_keyboard_(false), |
| 235 should_focus_ime_after_selection_with_keyboard_(false), | 233 should_focus_ime_after_selection_with_keyboard_(false), |
| 236 current_ime_view_(nullptr) { | 234 current_ime_view_(nullptr) {} |
| 235 |
| 236 ImeListView::~ImeListView() {} |
| 237 |
| 238 void ImeListView::Init(bool show_keyboard_toggle, |
| 239 SingleImeBehavior single_ime_behavior) { |
| 237 SystemTrayDelegate* delegate = WmShell::Get()->system_tray_delegate(); | 240 SystemTrayDelegate* delegate = WmShell::Get()->system_tray_delegate(); |
| 238 IMEInfoList list; | 241 IMEInfoList list; |
| 239 delegate->GetAvailableIMEList(&list); | 242 delegate->GetAvailableIMEList(&list); |
| 240 IMEPropertyInfoList property_list; | 243 IMEPropertyInfoList property_list; |
| 241 delegate->GetCurrentIMEProperties(&property_list); | 244 delegate->GetCurrentIMEProperties(&property_list); |
| 242 Update(list, property_list, show_keyboard_toggle, single_ime_behavior); | 245 Update(list, property_list, show_keyboard_toggle, single_ime_behavior); |
| 243 } | 246 } |
| 244 | 247 |
| 245 ImeListView::~ImeListView() {} | |
| 246 | |
| 247 void ImeListView::Update(const IMEInfoList& list, | 248 void ImeListView::Update(const IMEInfoList& list, |
| 248 const IMEPropertyInfoList& property_list, | 249 const IMEPropertyInfoList& property_list, |
| 249 bool show_keyboard_toggle, | 250 bool show_keyboard_toggle, |
| 250 SingleImeBehavior single_ime_behavior) { | 251 SingleImeBehavior single_ime_behavior) { |
| 251 ResetImeListView(); | 252 ResetImeListView(); |
| 252 ime_map_.clear(); | 253 ime_map_.clear(); |
| 253 property_map_.clear(); | 254 property_map_.clear(); |
| 254 CreateScrollableList(); | 255 CreateScrollableList(); |
| 255 | 256 |
| 256 // Appends IME list and IME properties. | 257 // Appends IME list and IME properties. |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 449 | 450 |
| 450 for (auto property_map : property_map_) { | 451 for (auto property_map : property_map_) { |
| 451 if (property_map.second == last_selected_item_id_) { | 452 if (property_map.second == last_selected_item_id_) { |
| 452 (property_map.first)->RequestFocus(); | 453 (property_map.first)->RequestFocus(); |
| 453 return; | 454 return; |
| 454 } | 455 } |
| 455 } | 456 } |
| 456 } | 457 } |
| 457 | 458 |
| 458 } // namespace ash | 459 } // namespace ash |
| OLD | NEW |