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

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: Add AccessibilityVolumeInfo to the types section. 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/accessibility_events.cc
diff --git a/chrome/browser/accessibility_events.cc b/chrome/browser/accessibility_events.cc
index 79a1126e16e399dbd6bdc87eeb46f3de57492d72..c7b9b0d1a1a1a901186572c8b23449c44f36329e 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();
Daniel Erat 2011/08/29 15:05:35 nit: Profile* instead of "Profile *"
yoshiki 2011/08/30 06:43:30 Done.
+ 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);
Daniel Erat 2011/08/29 15:05:35 does this actually compile in debug mode? i'd exp
yoshiki 2011/08/30 06:43:30 Done.
+ DCHECK_LE(volume, 100);
+}
+
+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) {

Powered by Google App Engine
This is Rietveld 408576698