| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "chrome/browser/chromeos/input_method/input_method_switch_recorder.h" | |
| 6 | |
| 7 #include "base/metrics/histogram_macros.h" | |
| 8 | |
| 9 namespace { | |
| 10 | |
| 11 chromeos::input_method::InputMethodSwitchRecorder* | |
| 12 g_input_method_switch_recorder = NULL; | |
| 13 | |
| 14 enum SwitchBy { | |
| 15 // The values should not reordered or deleted and new entries should only be | |
| 16 // added at the end (otherwise it will cause problems interpreting logs) | |
| 17 SWITCH_BY_TRAY = 0, | |
| 18 SWITCH_BY_ACCELERATOR = 1, | |
| 19 NUM_SWITCH_BY = 2 | |
| 20 }; | |
| 21 | |
| 22 } // namespace | |
| 23 | |
| 24 namespace chromeos { | |
| 25 namespace input_method { | |
| 26 | |
| 27 // static | |
| 28 InputMethodSwitchRecorder* InputMethodSwitchRecorder::Get() { | |
| 29 if (!g_input_method_switch_recorder) | |
| 30 g_input_method_switch_recorder = new InputMethodSwitchRecorder(); | |
| 31 return g_input_method_switch_recorder; | |
| 32 } | |
| 33 | |
| 34 InputMethodSwitchRecorder::InputMethodSwitchRecorder() { | |
| 35 } | |
| 36 | |
| 37 InputMethodSwitchRecorder::~InputMethodSwitchRecorder() { | |
| 38 } | |
| 39 | |
| 40 void InputMethodSwitchRecorder::RecordSwitch(bool by_tray_menu) { | |
| 41 UMA_HISTOGRAM_ENUMERATION( | |
| 42 "InputMethod.ImeSwitch", | |
| 43 by_tray_menu ? SWITCH_BY_TRAY : SWITCH_BY_ACCELERATOR, NUM_SWITCH_BY); | |
| 44 } | |
| 45 | |
| 46 } // namespace input_method | |
| 47 } // namespace chromeos | |
| 48 | |
| OLD | NEW |