Chromium Code Reviews| 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_menu_tray.h" | 5 #include "ash/common/system/chromeos/ime_menu/ime_menu_tray.h" |
| 6 | 6 |
| 7 #include "ash/common/accessibility_delegate.h" | 7 #include "ash/common/accessibility_delegate.h" |
| 8 #include "ash/common/ash_constants.h" | 8 #include "ash/common/ash_constants.h" |
| 9 #include "ash/common/material_design/material_design_controller.h" | 9 #include "ash/common/material_design/material_design_controller.h" |
| 10 #include "ash/common/session/session_state_delegate.h" | 10 #include "ash/common/session/session_state_delegate.h" |
| 11 #include "ash/common/shelf/wm_shelf.h" | 11 #include "ash/common/shelf/wm_shelf.h" |
| 12 #include "ash/common/shelf/wm_shelf_util.h" | 12 #include "ash/common/shelf/wm_shelf_util.h" |
| 13 #include "ash/common/system/chromeos/ime_menu/ime_list_view.h" | 13 #include "ash/common/system/chromeos/ime_menu/ime_list_view.h" |
| 14 #include "ash/common/system/tray/fixed_sized_scroll_view.h" | 14 #include "ash/common/system/tray/fixed_sized_scroll_view.h" |
| 15 #include "ash/common/system/tray/hover_highlight_view.h" | 15 #include "ash/common/system/tray/hover_highlight_view.h" |
| 16 #include "ash/common/system/tray/system_menu_button.h" | 16 #include "ash/common/system/tray/system_menu_button.h" |
| 17 #include "ash/common/system/tray/system_tray_controller.h" | 17 #include "ash/common/system/tray/system_tray_controller.h" |
| 18 #include "ash/common/system/tray/system_tray_delegate.h" | 18 #include "ash/common/system/tray/system_tray_delegate.h" |
| 19 #include "ash/common/system/tray/system_tray_notifier.h" | 19 #include "ash/common/system/tray/system_tray_notifier.h" |
| 20 #include "ash/common/system/tray/tray_constants.h" | 20 #include "ash/common/system/tray/tray_constants.h" |
| 21 #include "ash/common/system/tray/tray_popup_item_style.h" | 21 #include "ash/common/system/tray/tray_popup_item_style.h" |
| 22 #include "ash/common/system/tray/tray_popup_utils.h" | 22 #include "ash/common/system/tray/tray_popup_utils.h" |
| 23 #include "ash/common/system/tray/tray_utils.h" | 23 #include "ash/common/system/tray/tray_utils.h" |
| 24 #include "ash/common/wm_lookup.h" | 24 #include "ash/common/wm_lookup.h" |
| 25 #include "ash/common/wm_root_window_controller.h" | 25 #include "ash/common/wm_root_window_controller.h" |
| 26 #include "ash/common/wm_shell.h" | 26 #include "ash/common/wm_shell.h" |
| 27 #include "ash/common/wm_window.h" | 27 #include "ash/common/wm_window.h" |
| 28 #include "ash/public/cpp/shell_window_ids.h" | 28 #include "ash/public/cpp/shell_window_ids.h" |
| 29 #include "base/metrics/histogram_macros.h" | |
| 29 #include "base/strings/utf_string_conversions.h" | 30 #include "base/strings/utf_string_conversions.h" |
| 30 #include "grit/ash_resources.h" | 31 #include "grit/ash_resources.h" |
| 31 #include "grit/ash_strings.h" | 32 #include "grit/ash_strings.h" |
| 32 #include "ui/base/ime/chromeos/input_method_manager.h" | 33 #include "ui/base/ime/chromeos/input_method_manager.h" |
| 33 #include "ui/base/l10n/l10n_util.h" | 34 #include "ui/base/l10n/l10n_util.h" |
| 34 #include "ui/base/resource/resource_bundle.h" | 35 #include "ui/base/resource/resource_bundle.h" |
| 35 #include "ui/gfx/paint_vector_icon.h" | 36 #include "ui/gfx/paint_vector_icon.h" |
| 36 #include "ui/gfx/range/range.h" | 37 #include "ui/gfx/range/range.h" |
| 37 #include "ui/gfx/vector_icons_public.h" | 38 #include "ui/gfx/vector_icons_public.h" |
| 38 #include "ui/keyboard/keyboard_controller.h" | 39 #include "ui/keyboard/keyboard_controller.h" |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 195 if (sender == settings_button_) { | 196 if (sender == settings_button_) { |
| 196 ime_menu_tray_->HideImeMenuBubble(); | 197 ime_menu_tray_->HideImeMenuBubble(); |
| 197 ShowIMESettings(); | 198 ShowIMESettings(); |
| 198 return; | 199 return; |
| 199 } | 200 } |
| 200 | 201 |
| 201 // The |keyset| will be used for drawing input view keyset in IME | 202 // The |keyset| will be used for drawing input view keyset in IME |
| 202 // extensions. InputMethodManager::ShowKeyboardWithKeyset() will deal with | 203 // extensions. InputMethodManager::ShowKeyboardWithKeyset() will deal with |
| 203 // the |keyset| string to generate the right input view url. | 204 // the |keyset| string to generate the right input view url. |
| 204 std::string keyset; | 205 std::string keyset; |
| 205 if (sender == emoji_button_) | 206 if (sender == emoji_button_) { |
| 206 keyset = "emoji"; | 207 keyset = "emoji"; |
| 207 else if (sender == voice_button_) | 208 UMA_HISTOGRAM_COUNTS("InputMethod.ImeMenu.EmojiButton", 1); |
| 209 } else if (sender == voice_button_) { | |
| 208 keyset = "voice"; | 210 keyset = "voice"; |
| 209 else if (sender == handwriting_button_) | 211 UMA_HISTOGRAM_COUNTS("InputMethod.ImeMenu.VoiceButton", 1); |
| 212 } else if (sender == handwriting_button_) { | |
| 210 keyset = "hwt"; | 213 keyset = "hwt"; |
| 211 else | 214 UMA_HISTOGRAM_COUNTS("InputMethod.ImeMenu.HandwritingButton", 1); |
|
Alexei Svitkine (slow)
2017/01/03 15:47:22
UMA_HISTOGRAM_COUNTS allocates 50 buckets but you'
Azure Wei
2017/01/04 14:02:41
Thanks. I've updated these with enum histogram and
| |
| 215 } else { | |
| 212 NOTREACHED(); | 216 NOTREACHED(); |
| 217 } | |
| 213 | 218 |
| 214 ime_menu_tray_->ShowKeyboardWithKeyset(keyset); | 219 ime_menu_tray_->ShowKeyboardWithKeyset(keyset); |
| 215 } | 220 } |
| 216 | 221 |
| 217 // ViewClickListener: | 222 // ViewClickListener: |
| 218 void OnViewClicked(views::View* sender) override { | 223 void OnViewClicked(views::View* sender) override { |
| 219 if (one_settings_button_view_ && sender == one_settings_button_view_) { | 224 if (one_settings_button_view_ && sender == one_settings_button_view_) { |
| 220 ime_menu_tray_->HideImeMenuBubble(); | 225 ime_menu_tray_->HideImeMenuBubble(); |
| 221 ShowIMESettings(); | 226 ShowIMESettings(); |
| 222 } | 227 } |
| (...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 587 WmShell::Get()->system_tray_delegate()->GetCurrentIME(¤t_ime_); | 592 WmShell::Get()->system_tray_delegate()->GetCurrentIME(¤t_ime_); |
| 588 | 593 |
| 589 // Updates the tray label based on the current input method. | 594 // Updates the tray label based on the current input method. |
| 590 if (current_ime_.third_party) | 595 if (current_ime_.third_party) |
| 591 label_->SetText(current_ime_.short_name + base::UTF8ToUTF16("*")); | 596 label_->SetText(current_ime_.short_name + base::UTF8ToUTF16("*")); |
| 592 else | 597 else |
| 593 label_->SetText(current_ime_.short_name); | 598 label_->SetText(current_ime_.short_name); |
| 594 } | 599 } |
| 595 | 600 |
| 596 } // namespace ash | 601 } // namespace ash |
| OLD | NEW |