| Index: ash/common/accelerators/accelerator_router.cc
|
| diff --git a/ash/common/accelerators/accelerator_router.cc b/ash/common/accelerators/accelerator_router.cc
|
| index 7abd92d24f1b67b1c52fa1763f9f40e7701b0dd5..2a42383b1303c82731b130494c55bb375f6076ca 100644
|
| --- a/ash/common/accelerators/accelerator_router.cc
|
| +++ b/ash/common/accelerators/accelerator_router.cc
|
| @@ -8,6 +8,7 @@
|
| #include "ash/common/wm/window_state.h"
|
| #include "ash/common/wm_shell.h"
|
| #include "ash/common/wm_window.h"
|
| +#include "base/metrics/histogram_macros.h"
|
| #include "base/stl_util.h"
|
| #include "ui/base/accelerators/accelerator.h"
|
| #include "ui/events/event.h"
|
| @@ -46,6 +47,7 @@ bool AcceleratorRouter::ProcessAccelerator(WmWindow* target,
|
| const ui::Accelerator& accelerator) {
|
| // Callers should never supply null.
|
| DCHECK(target);
|
| + RecordSearchKeyStats(accelerator);
|
| // Special hardware keys like brightness and volume are handled in
|
| // special way. However, some windows can override this behavior
|
| // (e.g. Chrome v1 apps by default and Chrome v2 apps with
|
| @@ -62,6 +64,26 @@ bool AcceleratorRouter::ProcessAccelerator(WmWindow* target,
|
| return WmShell::Get()->accelerator_controller()->Process(accelerator);
|
| }
|
|
|
| +void AcceleratorRouter::RecordSearchKeyStats(
|
| + const ui::Accelerator& accelerator) {
|
| + if (accelerator.IsCmdDown()) {
|
| + if (search_key_state_ == RELEASED) {
|
| + search_key_state_ = PRESSED;
|
| + search_key_pressed_timestamp_ = base::TimeTicks::Now();
|
| + }
|
| +
|
| + if (accelerator.key_code() != ui::KeyboardCode::VKEY_COMMAND &&
|
| + search_key_state_ == PRESSED) {
|
| + search_key_state_ = RECORDED;
|
| + UMA_HISTOGRAM_TIMES(
|
| + "Keyboard.Shortcuts.CrosSearchKeyDelay",
|
| + base::TimeTicks::Now() - search_key_pressed_timestamp_);
|
| + }
|
| + } else {
|
| + search_key_state_ = RELEASED;
|
| + }
|
| +}
|
| +
|
| bool AcceleratorRouter::CanConsumeSystemKeys(WmWindow* target,
|
| const ui::KeyEvent& event) {
|
| // Uses the top level window so if the target is a web contents window the
|
|
|