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

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

Issue 2891263002: chromeos: Remove some IME methods from ash::SystemTrayDelegate (Closed)
Patch Set: rebase Created 3 years, 7 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
« no previous file with comments | « ash/ime_control_delegate.h ('k') | ash/system/tray/system_tray_delegate.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/system/ime_menu/ime_list_view.h" 5 #include "ash/system/ime_menu/ime_list_view.h"
6 6
7 #include "ash/ime/ime_switch_type.h"
7 #include "ash/resources/grit/ash_resources.h" 8 #include "ash/resources/grit/ash_resources.h"
8 #include "ash/resources/vector_icons/vector_icons.h" 9 #include "ash/resources/vector_icons/vector_icons.h"
9 #include "ash/shell.h" 10 #include "ash/shell.h"
10 #include "ash/shell_port.h" 11 #include "ash/shell_port.h"
11 #include "ash/strings/grit/ash_strings.h" 12 #include "ash/strings/grit/ash_strings.h"
12 #include "ash/system/tray/actionable_view.h" 13 #include "ash/system/tray/actionable_view.h"
13 #include "ash/system/tray/ime_info.h" 14 #include "ash/system/tray/ime_info.h"
14 #include "ash/system/tray/system_menu_button.h" 15 #include "ash/system/tray/system_menu_button.h"
15 #include "ash/system/tray/system_tray_delegate.h" 16 #include "ash/system/tray/system_tray_delegate.h"
16 #include "ash/system/tray/tray_constants.h" 17 #include "ash/system/tray/tray_constants.h"
17 #include "ash/system/tray/tray_details_view.h" 18 #include "ash/system/tray/tray_details_view.h"
18 #include "ash/system/tray/tray_popup_header_button.h" 19 #include "ash/system/tray/tray_popup_header_button.h"
19 #include "ash/system/tray/tray_popup_item_style.h" 20 #include "ash/system/tray/tray_popup_item_style.h"
20 #include "ash/system/tray/tray_popup_utils.h" 21 #include "ash/system/tray/tray_popup_utils.h"
21 #include "ash/system/tray/tri_view.h" 22 #include "ash/system/tray/tri_view.h"
23 #include "base/metrics/histogram_macros.h"
22 #include "ui/accessibility/ax_node_data.h" 24 #include "ui/accessibility/ax_node_data.h"
25 #include "ui/base/ime/chromeos/input_method_manager.h"
23 #include "ui/base/l10n/l10n_util.h" 26 #include "ui/base/l10n/l10n_util.h"
24 #include "ui/base/resource/resource_bundle.h" 27 #include "ui/base/resource/resource_bundle.h"
25 #include "ui/gfx/color_palette.h" 28 #include "ui/gfx/color_palette.h"
26 #include "ui/gfx/paint_vector_icon.h" 29 #include "ui/gfx/paint_vector_icon.h"
27 #include "ui/keyboard/keyboard_util.h" 30 #include "ui/keyboard/keyboard_util.h"
28 #include "ui/views/background.h" 31 #include "ui/views/background.h"
29 #include "ui/views/controls/button/toggle_button.h" 32 #include "ui/views/controls/button/toggle_button.h"
30 #include "ui/views/controls/image_view.h" 33 #include "ui/views/controls/image_view.h"
31 #include "ui/views/controls/label.h" 34 #include "ui/views/controls/label.h"
32 #include "ui/views/controls/separator.h" 35 #include "ui/views/controls/separator.h"
33 #include "ui/views/layout/fill_layout.h" 36 #include "ui/views/layout/fill_layout.h"
34 #include "ui/views/painter.h" 37 #include "ui/views/painter.h"
35 #include "ui/views/view.h" 38 #include "ui/views/view.h"
36 #include "ui/views/widget/widget.h" 39 #include "ui/views/widget/widget.h"
37 40
41 using chromeos::input_method::InputMethodManager;
42
38 namespace ash { 43 namespace ash {
39 namespace { 44 namespace {
40 45
41 const int kMinFontSizeDelta = -10; 46 const int kMinFontSizeDelta = -10;
42 47
43 // Represents a row in the scrollable IME list; each row is either an IME or 48 // Represents a row in the scrollable IME list; each row is either an IME or
44 // an IME property. A checkmark icon is shown in the row if selected. 49 // an IME property. A checkmark icon is shown in the row if selected.
45 class ImeListItemView : public ActionableView { 50 class ImeListItemView : public ActionableView {
46 public: 51 public:
47 ImeListItemView(SystemTrayItem* owner, 52 ImeListItemView(SystemTrayItem* owner,
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 } 288 }
284 289
285 void ImeListView::PrependKeyboardStatusRow() { 290 void ImeListView::PrependKeyboardStatusRow() {
286 DCHECK(!keyboard_status_row_); 291 DCHECK(!keyboard_status_row_);
287 keyboard_status_row_ = new KeyboardStatusRow; 292 keyboard_status_row_ = new KeyboardStatusRow;
288 keyboard_status_row_->Init(this); 293 keyboard_status_row_->Init(this);
289 scroll_content()->AddChildViewAt(keyboard_status_row_, 0); 294 scroll_content()->AddChildViewAt(keyboard_status_row_, 0);
290 } 295 }
291 296
292 void ImeListView::HandleViewClicked(views::View* view) { 297 void ImeListView::HandleViewClicked(views::View* view) {
293 SystemTrayDelegate* delegate = Shell::Get()->system_tray_delegate();
294 std::map<views::View*, std::string>::const_iterator ime = ime_map_.find(view); 298 std::map<views::View*, std::string>::const_iterator ime = ime_map_.find(view);
295 if (ime != ime_map_.end()) { 299 if (ime != ime_map_.end()) {
296 ShellPort::Get()->RecordUserMetricsAction(UMA_STATUS_AREA_IME_SWITCH_MODE); 300 ShellPort::Get()->RecordUserMetricsAction(UMA_STATUS_AREA_IME_SWITCH_MODE);
297 std::string ime_id = ime->second; 301 std::string ime_id = ime->second;
298 last_selected_item_id_ = ime_id; 302 last_selected_item_id_ = ime_id;
299 delegate->SwitchIME(ime_id); 303 InputMethodManager::Get()->GetActiveIMEState()->ChangeInputMethod(
304 ime_id, false /* show_message */);
305 UMA_HISTOGRAM_ENUMERATION("InputMethod.ImeSwitch", ImeSwitchType::kTray,
306 ImeSwitchType::kCount);
307
300 } else { 308 } else {
301 std::map<views::View*, std::string>::const_iterator property = 309 std::map<views::View*, std::string>::const_iterator property =
302 property_map_.find(view); 310 property_map_.find(view);
303 if (property == property_map_.end()) 311 if (property == property_map_.end())
304 return; 312 return;
305 const std::string key = property->second; 313 const std::string key = property->second;
306 last_selected_item_id_ = key; 314 last_selected_item_id_ = key;
307 delegate->ActivateIMEProperty(key); 315 InputMethodManager::Get()->ActivateInputMethodMenuItem(key);
308 } 316 }
309 317
310 if (!should_focus_ime_after_selection_with_keyboard_ || 318 if (!should_focus_ime_after_selection_with_keyboard_ ||
311 !last_item_selected_with_keyboard_) { 319 !last_item_selected_with_keyboard_) {
312 CloseImeListView(); 320 CloseImeListView();
313 } 321 }
314 } 322 }
315 323
316 void ImeListView::HandleButtonPressed(views::Button* sender, 324 void ImeListView::HandleButtonPressed(views::Button* sender,
317 const ui::Event& event) { 325 const ui::Event& event) {
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
355 ImeListViewTestApi::ImeListViewTestApi(ImeListView* ime_list_view) 363 ImeListViewTestApi::ImeListViewTestApi(ImeListView* ime_list_view)
356 : ime_list_view_(ime_list_view) {} 364 : ime_list_view_(ime_list_view) {}
357 365
358 ImeListViewTestApi::~ImeListViewTestApi() {} 366 ImeListViewTestApi::~ImeListViewTestApi() {}
359 367
360 views::View* ImeListViewTestApi::GetToggleView() const { 368 views::View* ImeListViewTestApi::GetToggleView() const {
361 return ime_list_view_->keyboard_status_row_->toggle(); 369 return ime_list_view_->keyboard_status_row_->toggle();
362 } 370 }
363 371
364 } // namespace ash 372 } // namespace ash
OLDNEW
« no previous file with comments | « ash/ime_control_delegate.h ('k') | ash/system/tray/system_tray_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698