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

Unified Diff: chrome/browser/chromeos/system_key_event_listener.cc

Issue 7708025: Adds extension APIs of events on changing volume. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/system_key_event_listener.cc
diff --git a/chrome/browser/chromeos/system_key_event_listener.cc b/chrome/browser/chromeos/system_key_event_listener.cc
index e2d90fd3efeff842e4158d86b2b93d1e37fbec68..8deddb5176d0a447a239d8738339c1c1f4741e8f 100644
--- a/chrome/browser/chromeos/system_key_event_listener.cc
+++ b/chrome/browser/chromeos/system_key_event_listener.cc
@@ -8,10 +8,16 @@
#include <X11/XF86keysym.h>
#include <X11/XKBlib.h>
+// Undefine "Status" macro defined by X header.
+#undef Status
dmazzoni 2011/08/24 14:49:02 Why is this necessary? Why wasn't it necessary bef
yoshiki 2011/08/29 09:16:16 Defining "Status" was conflicted with "enum Status
+
+#include "chrome/browser/accessibility_events.h"
#include "chrome/browser/chromeos/audio_handler.h"
#include "chrome/browser/chromeos/brightness_bubble.h"
#include "chrome/browser/chromeos/input_method/xkeyboard.h"
#include "chrome/browser/chromeos/volume_bubble.h"
+#include "chrome/browser/profiles/profile_manager.h"
+#include "chrome/common/chrome_notification_types.h"
#include "content/browser/user_metrics.h"
#include "third_party/cros_system_api/window_manager/chromeos_wm_ipc_enums.h"
@@ -174,6 +180,14 @@ void SystemKeyEventListener::OnVolumeMute() {
// Always muting (and not toggling) as per final decision on
// http://crosbug.com/3751
audio_handler_->SetMuted(true);
+
+ Profile *profile = ProfileManager::GetDefaultProfile();
Daniel Erat 2011/08/24 14:52:57 refactor this into a simple private method that ta
yoshiki 2011/08/29 09:16:16 Done.
+ AccessibilityVolumeInfo info(profile,
+ audio_handler_->GetVolumePercent(),
+ audio_handler_->IsMuted());
+ SendAccessibilityNotification(chrome::NOTIFICATION_ACCESSIBILITY_VOLUME_MUTE,
+ &info);
+
ShowVolumeBubble();
}
@@ -185,6 +199,14 @@ void SystemKeyEventListener::OnVolumeDown() {
audio_handler_->SetVolumePercent(0.0);
else
audio_handler_->AdjustVolumeByPercent(-kStepPercentage);
+
+ Profile *profile = ProfileManager::GetDefaultProfile();
+ AccessibilityVolumeInfo info(profile,
+ audio_handler_->GetVolumePercent(),
+ audio_handler_->IsMuted());
+ SendAccessibilityNotification(chrome::NOTIFICATION_ACCESSIBILITY_VOLUME_DOWN,
+ &info);
+
ShowVolumeBubble();
}
@@ -199,6 +221,14 @@ void SystemKeyEventListener::OnVolumeUp() {
} else {
audio_handler_->AdjustVolumeByPercent(kStepPercentage);
}
+
+ Profile *profile = ProfileManager::GetDefaultProfile();
+ AccessibilityVolumeInfo info(profile,
+ audio_handler_->GetVolumePercent(),
+ audio_handler_->IsMuted());
+ SendAccessibilityNotification(chrome::NOTIFICATION_ACCESSIBILITY_VOLUME_UP,
+ &info);
+
ShowVolumeBubble();
}

Powered by Google App Engine
This is Rietveld 408576698