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

Unified Diff: chrome/browser/accessibility_events.cc

Issue 7708025: Adds extension APIs of events on changing volume. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review fix (to be commited) 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
« no previous file with comments | « chrome/browser/accessibility_events.h ('k') | chrome/browser/chromeos/system_key_event_listener.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/accessibility_events.cc
diff --git a/chrome/browser/accessibility_events.cc b/chrome/browser/accessibility_events.cc
index 79a1126e16e399dbd6bdc87eeb46f3de57492d72..1ba755bc1c82d5be76d2480897c3a5cc60554105 100644
--- a/chrome/browser/accessibility_events.cc
+++ b/chrome/browser/accessibility_events.cc
@@ -8,25 +8,34 @@
#include "chrome/browser/extensions/extension_accessibility_api_constants.h"
#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/profiles/profile_manager.h"
+#include "chrome/common/chrome_notification_types.h"
#include "content/common/content_notification_types.h"
#include "content/common/notification_service.h"
namespace keys = extension_accessibility_api_constants;
void SendAccessibilityNotification(
- int type, AccessibilityControlInfo* info) {
+ int type, AccessibilityEventInfo* info) {
Profile *profile = info->profile();
if (profile->ShouldSendAccessibilityEvents()) {
NotificationService::current()->Notify(
type,
Source<Profile>(profile),
- Details<AccessibilityControlInfo>(info));
+ Details<AccessibilityEventInfo>(info));
}
}
+void SendAccessibilityVolumeNotification(double volume, bool is_muted) {
+ Profile* profile = ProfileManager::GetDefaultProfile();
+ AccessibilityVolumeInfo info(profile, volume, is_muted);
+ SendAccessibilityNotification(
+ chrome::NOTIFICATION_ACCESSIBILITY_VOLUME_CHANGED, &info);
+}
+
AccessibilityControlInfo::AccessibilityControlInfo(
Profile* profile, const std::string& control_name)
- : profile_(profile), name_(control_name) {
+ : AccessibilityEventInfo(profile), name_(control_name) {
}
AccessibilityControlInfo::~AccessibilityControlInfo() {
@@ -188,6 +197,22 @@ void AccessibilityListBoxInfo::SerializeToDict(DictionaryValue *dict) const {
dict->SetInteger(keys::kItemCountKey, item_count_);
}
+AccessibilityVolumeInfo::AccessibilityVolumeInfo(Profile* profile,
+ double volume,
+ bool is_muted)
+ : AccessibilityEventInfo(profile),
+ volume_(volume),
+ is_muted_(is_muted) {
+ DCHECK(profile);
+ DCHECK_GE(volume, 0.0);
+ DCHECK_LE(volume, 100.0);
+}
+
+void AccessibilityVolumeInfo::SerializeToDict(DictionaryValue *dict) const {
+ dict->SetDouble(keys::kVolumeKey, volume_);
+ dict->SetBoolean(keys::kIsVolumeMutedKey, is_muted_);
+}
+
AccessibilityMenuInfo::AccessibilityMenuInfo(Profile* profile,
const std::string& menu_name)
: AccessibilityControlInfo(profile, menu_name) {
« no previous file with comments | « chrome/browser/accessibility_events.h ('k') | chrome/browser/chromeos/system_key_event_listener.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698