| 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" |
| 11 #include "ash/common/system/tray/system_tray_delegate.h" | 11 #include "ash/common/system/tray/system_tray_delegate.h" |
| 12 #include "ash/common/system/tray/tray_constants.h" | 12 #include "ash/common/system/tray/tray_constants.h" |
| 13 #include "ash/common/system/tray/tray_details_view.h" | 13 #include "ash/common/system/tray/tray_details_view.h" |
| 14 #include "ash/common/system/tray/tray_popup_header_button.h" | 14 #include "ash/common/system/tray/tray_popup_header_button.h" |
| 15 #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" | 16 #include "ash/common/system/tray/tray_popup_utils.h" |
| 17 #include "ash/common/system/tray/tri_view.h" | 17 #include "ash/common/system/tray/tri_view.h" |
| 18 #include "ash/common/wm_shell.h" | 18 #include "ash/common/wm_shell.h" |
| 19 #include "ash/resources/grit/ash_resources.h" | 19 #include "ash/resources/grit/ash_resources.h" |
| 20 #include "ash/resources/vector_icons/vector_icons.h" | 20 #include "ash/resources/vector_icons/vector_icons.h" |
| 21 #include "ash/shell.h" |
| 21 #include "ash/strings/grit/ash_strings.h" | 22 #include "ash/strings/grit/ash_strings.h" |
| 22 #include "ui/accessibility/ax_node_data.h" | 23 #include "ui/accessibility/ax_node_data.h" |
| 23 #include "ui/base/l10n/l10n_util.h" | 24 #include "ui/base/l10n/l10n_util.h" |
| 24 #include "ui/base/resource/resource_bundle.h" | 25 #include "ui/base/resource/resource_bundle.h" |
| 25 #include "ui/gfx/color_palette.h" | 26 #include "ui/gfx/color_palette.h" |
| 26 #include "ui/gfx/paint_vector_icon.h" | 27 #include "ui/gfx/paint_vector_icon.h" |
| 27 #include "ui/keyboard/keyboard_util.h" | 28 #include "ui/keyboard/keyboard_util.h" |
| 28 #include "ui/views/background.h" | 29 #include "ui/views/background.h" |
| 29 #include "ui/views/border.h" | 30 #include "ui/views/border.h" |
| 30 #include "ui/views/controls/button/toggle_button.h" | 31 #include "ui/views/controls/button/toggle_button.h" |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 ImeListView::ImeListView(SystemTrayItem* owner) | 232 ImeListView::ImeListView(SystemTrayItem* owner) |
| 232 : TrayDetailsView(owner), | 233 : TrayDetailsView(owner), |
| 233 last_item_selected_with_keyboard_(false), | 234 last_item_selected_with_keyboard_(false), |
| 234 should_focus_ime_after_selection_with_keyboard_(false), | 235 should_focus_ime_after_selection_with_keyboard_(false), |
| 235 current_ime_view_(nullptr) {} | 236 current_ime_view_(nullptr) {} |
| 236 | 237 |
| 237 ImeListView::~ImeListView() {} | 238 ImeListView::~ImeListView() {} |
| 238 | 239 |
| 239 void ImeListView::Init(bool show_keyboard_toggle, | 240 void ImeListView::Init(bool show_keyboard_toggle, |
| 240 SingleImeBehavior single_ime_behavior) { | 241 SingleImeBehavior single_ime_behavior) { |
| 241 SystemTrayDelegate* delegate = WmShell::Get()->system_tray_delegate(); | 242 SystemTrayDelegate* delegate = Shell::Get()->system_tray_delegate(); |
| 242 IMEInfoList list; | 243 IMEInfoList list; |
| 243 delegate->GetAvailableIMEList(&list); | 244 delegate->GetAvailableIMEList(&list); |
| 244 IMEPropertyInfoList property_list; | 245 IMEPropertyInfoList property_list; |
| 245 delegate->GetCurrentIMEProperties(&property_list); | 246 delegate->GetCurrentIMEProperties(&property_list); |
| 246 Update(list, property_list, show_keyboard_toggle, single_ime_behavior); | 247 Update(list, property_list, show_keyboard_toggle, single_ime_behavior); |
| 247 } | 248 } |
| 248 | 249 |
| 249 void ImeListView::Update(const IMEInfoList& list, | 250 void ImeListView::Update(const IMEInfoList& list, |
| 250 const IMEPropertyInfoList& property_list, | 251 const IMEPropertyInfoList& property_list, |
| 251 bool show_keyboard_toggle, | 252 bool show_keyboard_toggle, |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 387 } | 388 } |
| 388 | 389 |
| 389 void ImeListView::HandleViewClicked(views::View* view) { | 390 void ImeListView::HandleViewClicked(views::View* view) { |
| 390 if (view == keyboard_status_) { | 391 if (view == keyboard_status_) { |
| 391 WmShell::Get()->ToggleIgnoreExternalKeyboard(); | 392 WmShell::Get()->ToggleIgnoreExternalKeyboard(); |
| 392 last_selected_item_id_.clear(); | 393 last_selected_item_id_.clear(); |
| 393 last_item_selected_with_keyboard_ = false; | 394 last_item_selected_with_keyboard_ = false; |
| 394 return; | 395 return; |
| 395 } | 396 } |
| 396 | 397 |
| 397 SystemTrayDelegate* delegate = WmShell::Get()->system_tray_delegate(); | 398 SystemTrayDelegate* delegate = Shell::Get()->system_tray_delegate(); |
| 398 std::map<views::View*, std::string>::const_iterator ime = ime_map_.find(view); | 399 std::map<views::View*, std::string>::const_iterator ime = ime_map_.find(view); |
| 399 if (ime != ime_map_.end()) { | 400 if (ime != ime_map_.end()) { |
| 400 WmShell::Get()->RecordUserMetricsAction(UMA_STATUS_AREA_IME_SWITCH_MODE); | 401 WmShell::Get()->RecordUserMetricsAction(UMA_STATUS_AREA_IME_SWITCH_MODE); |
| 401 std::string ime_id = ime->second; | 402 std::string ime_id = ime->second; |
| 402 last_selected_item_id_ = ime_id; | 403 last_selected_item_id_ = ime_id; |
| 403 delegate->SwitchIME(ime_id); | 404 delegate->SwitchIME(ime_id); |
| 404 } else { | 405 } else { |
| 405 std::map<views::View*, std::string>::const_iterator property = | 406 std::map<views::View*, std::string>::const_iterator property = |
| 406 property_map_.find(view); | 407 property_map_.find(view); |
| 407 if (property == property_map_.end()) | 408 if (property == property_map_.end()) |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 460 ImeListViewTestApi::ImeListViewTestApi(ImeListView* ime_list_view) | 461 ImeListViewTestApi::ImeListViewTestApi(ImeListView* ime_list_view) |
| 461 : ime_list_view_(ime_list_view) {} | 462 : ime_list_view_(ime_list_view) {} |
| 462 | 463 |
| 463 ImeListViewTestApi::~ImeListViewTestApi() {} | 464 ImeListViewTestApi::~ImeListViewTestApi() {} |
| 464 | 465 |
| 465 views::View* ImeListViewTestApi::GetToggleView() const { | 466 views::View* ImeListViewTestApi::GetToggleView() const { |
| 466 return ime_list_view_->material_keyboard_status_view_->toggle(); | 467 return ime_list_view_->material_keyboard_status_view_->toggle(); |
| 467 } | 468 } |
| 468 | 469 |
| 469 } // namespace ash | 470 } // namespace ash |
| OLD | NEW |