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

Side by Side Diff: chrome/browser/chromeos/system_key_event_listener.cc

Issue 6035010: chromeos: Add metrics for various accelerators. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/chrome/browser/ui/views/frame
Patch Set: fix bad merge Created 9 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/ui/browser.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 (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "chrome/browser/chromeos/system_key_event_listener.h" 5 #include "chrome/browser/chromeos/system_key_event_listener.h"
6 6
7 #include <gdk/gdkx.h> 7 #include <gdk/gdkx.h>
8 #include <X11/XF86keysym.h> 8 #include <X11/XF86keysym.h>
9 9
10 #include "chrome/browser/chromeos/audio_handler.h" 10 #include "chrome/browser/chromeos/audio_handler.h"
11 #include "chrome/browser/chromeos/brightness_bubble.h" 11 #include "chrome/browser/chromeos/brightness_bubble.h"
12 #include "chrome/browser/chromeos/volume_bubble.h" 12 #include "chrome/browser/chromeos/volume_bubble.h"
13 #include "chrome/browser/metrics/user_metrics.h"
13 #include "third_party/cros/chromeos_wm_ipc_enums.h" 14 #include "third_party/cros/chromeos_wm_ipc_enums.h"
14 15
15 namespace chromeos { 16 namespace chromeos {
16 17
17 namespace { 18 namespace {
18 19
19 const double kStepPercentage = 4.0; 20 const double kStepPercentage = 4.0;
20 21
21 } // namespace 22 } // namespace
22 23
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 SystemKeyEventListener* listener = static_cast<SystemKeyEventListener*>(data); 83 SystemKeyEventListener* listener = static_cast<SystemKeyEventListener*>(data);
83 XEvent* xevent = static_cast<XEvent*>(gxevent); 84 XEvent* xevent = static_cast<XEvent*>(gxevent);
84 85
85 if (xevent->type == KeyPress) { 86 if (xevent->type == KeyPress) {
86 int32 keycode = xevent->xkey.keycode; 87 int32 keycode = xevent->xkey.keycode;
87 if (keycode) { 88 if (keycode) {
88 // Only doing non-Alt/Shift/Ctrl modified keys 89 // Only doing non-Alt/Shift/Ctrl modified keys
89 if (!(xevent->xkey.state & (Mod1Mask | ShiftMask | ControlMask))) { 90 if (!(xevent->xkey.state & (Mod1Mask | ShiftMask | ControlMask))) {
90 if ((keycode == listener->key_f8_) || 91 if ((keycode == listener->key_f8_) ||
91 (keycode == listener->key_volume_mute_)) { 92 (keycode == listener->key_volume_mute_)) {
93 if (keycode == listener->key_f8_)
94 UserMetrics::RecordAction(UserMetricsAction("Accel_VolumeMute_F8"));
92 listener->OnVolumeMute(); 95 listener->OnVolumeMute();
93 return GDK_FILTER_REMOVE; 96 return GDK_FILTER_REMOVE;
94 } else if ((keycode == listener->key_f9_) || 97 } else if ((keycode == listener->key_f9_) ||
95 keycode == listener->key_volume_down_) { 98 keycode == listener->key_volume_down_) {
99 if (keycode == listener->key_f9_)
100 UserMetrics::RecordAction(UserMetricsAction("Accel_VolumeDown_F9"));
96 listener->OnVolumeDown(); 101 listener->OnVolumeDown();
97 return GDK_FILTER_REMOVE; 102 return GDK_FILTER_REMOVE;
98 } else if ((keycode == listener->key_f10_) || 103 } else if ((keycode == listener->key_f10_) ||
99 (keycode == listener->key_volume_up_)) { 104 (keycode == listener->key_volume_up_)) {
105 if (keycode == listener->key_f10_)
106 UserMetrics::RecordAction(UserMetricsAction("Accel_VolumeUp_F10"));
100 listener->OnVolumeUp(); 107 listener->OnVolumeUp();
101 return GDK_FILTER_REMOVE; 108 return GDK_FILTER_REMOVE;
102 } 109 }
103 } 110 }
104 } 111 }
105 } 112 }
106 return GDK_FILTER_CONTINUE; 113 return GDK_FILTER_CONTINUE;
107 } 114 }
108 115
109 void SystemKeyEventListener::GrabKey(int32 key, uint32 mask) { 116 void SystemKeyEventListener::GrabKey(int32 key, uint32 mask) {
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 if (audio_handler_->IsMute()) 157 if (audio_handler_->IsMute())
151 audio_handler_->SetMute(false); 158 audio_handler_->SetMute(false);
152 else 159 else
153 audio_handler_->AdjustVolumeByPercent(kStepPercentage); 160 audio_handler_->AdjustVolumeByPercent(kStepPercentage);
154 VolumeBubble::GetInstance()->ShowBubble( 161 VolumeBubble::GetInstance()->ShowBubble(
155 audio_handler_->GetVolumePercent()); 162 audio_handler_->GetVolumePercent());
156 BrightnessBubble::GetInstance()->HideBubble(); 163 BrightnessBubble::GetInstance()->HideBubble();
157 } 164 }
158 165
159 } // namespace chromeos 166 } // namespace chromeos
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/browser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698