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/system/ime_menu/ime_list_view.h" | 5 #include "ash/system/ime_menu/ime_list_view.h" |
6 | 6 |
7 #include "ash/resources/grit/ash_resources.h" | 7 #include "ash/resources/grit/ash_resources.h" |
8 #include "ash/resources/vector_icons/vector_icons.h" | 8 #include "ash/resources/vector_icons/vector_icons.h" |
9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
| 10 #include "ash/shell_port.h" |
10 #include "ash/strings/grit/ash_strings.h" | 11 #include "ash/strings/grit/ash_strings.h" |
11 #include "ash/system/tray/actionable_view.h" | 12 #include "ash/system/tray/actionable_view.h" |
12 #include "ash/system/tray/ime_info.h" | 13 #include "ash/system/tray/ime_info.h" |
13 #include "ash/system/tray/system_menu_button.h" | 14 #include "ash/system/tray/system_menu_button.h" |
14 #include "ash/system/tray/system_tray_delegate.h" | 15 #include "ash/system/tray/system_tray_delegate.h" |
15 #include "ash/system/tray/tray_constants.h" | 16 #include "ash/system/tray/tray_constants.h" |
16 #include "ash/system/tray/tray_details_view.h" | 17 #include "ash/system/tray/tray_details_view.h" |
17 #include "ash/system/tray/tray_popup_header_button.h" | 18 #include "ash/system/tray/tray_popup_header_button.h" |
18 #include "ash/system/tray/tray_popup_item_style.h" | 19 #include "ash/system/tray/tray_popup_item_style.h" |
19 #include "ash/system/tray/tray_popup_utils.h" | 20 #include "ash/system/tray/tray_popup_utils.h" |
20 #include "ash/system/tray/tri_view.h" | 21 #include "ash/system/tray/tri_view.h" |
21 #include "ash/wm_shell.h" | |
22 #include "ui/accessibility/ax_node_data.h" | 22 #include "ui/accessibility/ax_node_data.h" |
23 #include "ui/base/l10n/l10n_util.h" | 23 #include "ui/base/l10n/l10n_util.h" |
24 #include "ui/base/resource/resource_bundle.h" | 24 #include "ui/base/resource/resource_bundle.h" |
25 #include "ui/gfx/color_palette.h" | 25 #include "ui/gfx/color_palette.h" |
26 #include "ui/gfx/paint_vector_icon.h" | 26 #include "ui/gfx/paint_vector_icon.h" |
27 #include "ui/keyboard/keyboard_util.h" | 27 #include "ui/keyboard/keyboard_util.h" |
28 #include "ui/views/background.h" | 28 #include "ui/views/background.h" |
29 #include "ui/views/controls/button/toggle_button.h" | 29 #include "ui/views/controls/button/toggle_button.h" |
30 #include "ui/views/controls/image_view.h" | 30 #include "ui/views/controls/image_view.h" |
31 #include "ui/views/controls/label.h" | 31 #include "ui/views/controls/label.h" |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 DCHECK(!keyboard_status_row_); | 280 DCHECK(!keyboard_status_row_); |
281 keyboard_status_row_ = new KeyboardStatusRow; | 281 keyboard_status_row_ = new KeyboardStatusRow; |
282 keyboard_status_row_->Init(this); | 282 keyboard_status_row_->Init(this); |
283 scroll_content()->AddChildViewAt(keyboard_status_row_, 0); | 283 scroll_content()->AddChildViewAt(keyboard_status_row_, 0); |
284 } | 284 } |
285 | 285 |
286 void ImeListView::HandleViewClicked(views::View* view) { | 286 void ImeListView::HandleViewClicked(views::View* view) { |
287 SystemTrayDelegate* delegate = Shell::Get()->system_tray_delegate(); | 287 SystemTrayDelegate* delegate = Shell::Get()->system_tray_delegate(); |
288 std::map<views::View*, std::string>::const_iterator ime = ime_map_.find(view); | 288 std::map<views::View*, std::string>::const_iterator ime = ime_map_.find(view); |
289 if (ime != ime_map_.end()) { | 289 if (ime != ime_map_.end()) { |
290 WmShell::Get()->RecordUserMetricsAction(UMA_STATUS_AREA_IME_SWITCH_MODE); | 290 ShellPort::Get()->RecordUserMetricsAction(UMA_STATUS_AREA_IME_SWITCH_MODE); |
291 std::string ime_id = ime->second; | 291 std::string ime_id = ime->second; |
292 last_selected_item_id_ = ime_id; | 292 last_selected_item_id_ = ime_id; |
293 delegate->SwitchIME(ime_id); | 293 delegate->SwitchIME(ime_id); |
294 } else { | 294 } else { |
295 std::map<views::View*, std::string>::const_iterator property = | 295 std::map<views::View*, std::string>::const_iterator property = |
296 property_map_.find(view); | 296 property_map_.find(view); |
297 if (property == property_map_.end()) | 297 if (property == property_map_.end()) |
298 return; | 298 return; |
299 const std::string key = property->second; | 299 const std::string key = property->second; |
300 last_selected_item_id_ = key; | 300 last_selected_item_id_ = key; |
301 delegate->ActivateIMEProperty(key); | 301 delegate->ActivateIMEProperty(key); |
302 } | 302 } |
303 | 303 |
304 if (!should_focus_ime_after_selection_with_keyboard_ || | 304 if (!should_focus_ime_after_selection_with_keyboard_ || |
305 !last_item_selected_with_keyboard_) { | 305 !last_item_selected_with_keyboard_) { |
306 CloseImeListView(); | 306 CloseImeListView(); |
307 } | 307 } |
308 } | 308 } |
309 | 309 |
310 void ImeListView::HandleButtonPressed(views::Button* sender, | 310 void ImeListView::HandleButtonPressed(views::Button* sender, |
311 const ui::Event& event) { | 311 const ui::Event& event) { |
312 if (keyboard_status_row_ && sender == keyboard_status_row_->toggle()) { | 312 if (keyboard_status_row_ && sender == keyboard_status_row_->toggle()) { |
313 WmShell::Get()->ToggleIgnoreExternalKeyboard(); | 313 ShellPort::Get()->ToggleIgnoreExternalKeyboard(); |
314 last_selected_item_id_.clear(); | 314 last_selected_item_id_.clear(); |
315 last_item_selected_with_keyboard_ = false; | 315 last_item_selected_with_keyboard_ = false; |
316 } | 316 } |
317 } | 317 } |
318 | 318 |
319 void ImeListView::VisibilityChanged(View* starting_from, bool is_visible) { | 319 void ImeListView::VisibilityChanged(View* starting_from, bool is_visible) { |
320 if (!is_visible || (should_focus_ime_after_selection_with_keyboard_ && | 320 if (!is_visible || (should_focus_ime_after_selection_with_keyboard_ && |
321 last_item_selected_with_keyboard_) || | 321 last_item_selected_with_keyboard_) || |
322 !current_ime_view_) { | 322 !current_ime_view_) { |
323 return; | 323 return; |
(...skipping 25 matching lines...) Expand all Loading... |
349 ImeListViewTestApi::ImeListViewTestApi(ImeListView* ime_list_view) | 349 ImeListViewTestApi::ImeListViewTestApi(ImeListView* ime_list_view) |
350 : ime_list_view_(ime_list_view) {} | 350 : ime_list_view_(ime_list_view) {} |
351 | 351 |
352 ImeListViewTestApi::~ImeListViewTestApi() {} | 352 ImeListViewTestApi::~ImeListViewTestApi() {} |
353 | 353 |
354 views::View* ImeListViewTestApi::GetToggleView() const { | 354 views::View* ImeListViewTestApi::GetToggleView() const { |
355 return ime_list_view_->keyboard_status_row_->toggle(); | 355 return ime_list_view_->keyboard_status_row_->toggle(); |
356 } | 356 } |
357 | 357 |
358 } // namespace ash | 358 } // namespace ash |
OLD | NEW |