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

Unified Diff: chrome/browser/accessibility_events.h

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 | « no previous file | chrome/browser/accessibility_events.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/accessibility_events.h
diff --git a/chrome/browser/accessibility_events.h b/chrome/browser/accessibility_events.h
index 5d7a012efbc774dbdd363e141181e7ffe8d23827..88550e2c512d673aa915f9167575673e1c919df3 100644
--- a/chrome/browser/accessibility_events.h
+++ b/chrome/browser/accessibility_events.h
@@ -7,8 +7,9 @@
#pragma once
#include <string>
+#include "base/compiler_specific.h"
-class AccessibilityControlInfo;
+class AccessibilityEventInfo;
class Profile;
namespace base {
@@ -16,36 +17,51 @@ class DictionaryValue;
}
// Use the NotificationService to post the given accessibility
-// notification type with AccessibilityControlInfo details to any
+// notification type with AccessibilityEventInfo details to any
// listeners. Will not send if the profile's pause level is nonzero
// (using profile->PauseAccessibilityEvents).
void SendAccessibilityNotification(
- int type, AccessibilityControlInfo* info);
+ int type, AccessibilityEventInfo* info);
+void SendAccessibilityVolumeNotification(double volume, bool is_muted);
+
+// Abstract parent class for accessibility event information passed to event
+// listeners.
+class AccessibilityEventInfo {
+ public:
+ virtual ~AccessibilityEventInfo() {}
+
+ // Serialize this class as a DictionaryValue that can be converted to
+ // a JavaScript object.
+ virtual void SerializeToDict(base::DictionaryValue* dict) const = 0;
+
+ Profile* profile() const { return profile_; }
+
+ protected:
+ explicit AccessibilityEventInfo(Profile* profile) : profile_(profile) {}
+
+ // The profile this control belongs to.
+ Profile* profile_;
+};
// Abstract parent class for accessibility information about a control
// passed to event listeners.
-class AccessibilityControlInfo {
+class AccessibilityControlInfo : public AccessibilityEventInfo {
public:
virtual ~AccessibilityControlInfo();
// Serialize this class as a DictionaryValue that can be converted to
// a JavaScript object.
- virtual void SerializeToDict(base::DictionaryValue* dict) const;
+ virtual void SerializeToDict(base::DictionaryValue* dict) const OVERRIDE;
// Return the specific type of this control, which will be one of the
// string constants defined in extension_accessibility_api_constants.h.
virtual const char* type() const = 0;
- Profile* profile() const { return profile_; }
-
const std::string& name() const { return name_; }
protected:
AccessibilityControlInfo(Profile* profile, const std::string& control_name);
- // The profile this control belongs to.
- Profile* profile_;
-
// The name of the control, like "OK" or "Password".
std::string name_;
};
@@ -255,6 +271,20 @@ class AccessibilityMenuInfo : public AccessibilityControlInfo {
virtual const char* type() const;
};
+// Accessibility information about a volume; this class is used by
+// onVolumeUp, onVolumeDown, and onVolumeMute event listeners.
+class AccessibilityVolumeInfo : public AccessibilityEventInfo {
+ public:
+ // |volume| must range between 0 to 100.
+ AccessibilityVolumeInfo(Profile* profile, double volume, bool is_muted);
+
+ virtual void SerializeToDict(base::DictionaryValue* dict) const;
+
+ private:
+ double volume_;
+ bool is_muted_;
+};
+
// Accessibility information about a menu item; this class is used by
// onControlFocused event listeners.
class AccessibilityMenuItemInfo : public AccessibilityControlInfo {
« no previous file with comments | « no previous file | chrome/browser/accessibility_events.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698