Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / chrome / browser / ui / views / accessibility / accessibility_event_router_views.h
index f5738b6..ab70f56 100644 (file)
@@ -13,7 +13,7 @@
 #include "chrome/browser/accessibility/accessibility_events.h"
 #include "content/public/browser/notification_observer.h"
 #include "content/public/browser/notification_registrar.h"
-#include "ui/base/accessibility/accessibility_types.h"
+#include "ui/accessibility/ax_enums.h"
 
 class Profile;
 
@@ -45,78 +45,102 @@ class AccessibilityEventRouterViews : public content::NotificationObserver {
 
   // Handle an accessibility event generated by a view.
   void HandleAccessibilityEvent(
-      views::View* view, ui::AccessibilityTypes::Event event_type);
+      views::View* view, ui::AXEvent event_type);
 
   // Handle a menu item being focused (separate because a menu item is
   // not necessarily its own view).
-  void HandleMenuItemFocused(const string16& menu_name,
-                             const string16& menu_item_name,
+  void HandleMenuItemFocused(const base::string16& menu_name,
+                             const base::string16& menu_item_name,
                              int item_index,
                              int item_count,
                              bool has_submenu);
 
   // NotificationObserver implementation.
-  virtual void Observe(int type,
-                       const content::NotificationSource& source,
-                       const content::NotificationDetails& details) OVERRIDE;
+  void Observe(int type,
+               const content::NotificationSource& source,
+               const content::NotificationDetails& details) override;
 
  private:
   friend struct DefaultSingletonTraits<AccessibilityEventRouterViews>;
 
   FRIEND_TEST_ALL_PREFIXES(AccessibilityEventRouterViewsTest,
                            TestFocusNotification);
+  FRIEND_TEST_ALL_PREFIXES(AccessibilityEventRouterViewsTest,
+                           MenuIndexAndCountForInvisibleMenu);
+  FRIEND_TEST_ALL_PREFIXES(AccessibilityEventRouterViewsTest,
+                           AccessibilityFocusableView);
 
   AccessibilityEventRouterViews();
-  virtual ~AccessibilityEventRouterViews();
+  ~AccessibilityEventRouterViews() override;
 
   // Call DispatchAccessibilityEvent using a view storage id.
   static void DispatchEventOnViewStorageId(
       int view_storage_id,
-      ui::AccessibilityTypes::Event event);
+      ui::AXEvent event);
 
   // Checks the type of the view and calls one of the more specific
   // Send*Notification methods, below.
   void DispatchAccessibilityEvent(
       views::View* view,
-      ui::AccessibilityTypes::Event event);
+      ui::AXEvent event);
 
   // Each of these methods constructs an AccessibilityControlInfo object
   // and sends a notification of a specific accessibility event.
   static void SendButtonNotification(
       views::View* view,
-      ui::AccessibilityTypes::Event event,
+      ui::AXEvent event,
+      Profile* profile);
+  static void SendStaticTextNotification(
+      views::View* view,
+      ui::AXEvent event,
       Profile* profile);
   static void SendLinkNotification(
       views::View* view,
-      ui::AccessibilityTypes::Event event,
+      ui::AXEvent event,
       Profile* profile);
   static void SendMenuNotification(
       views::View* view,
-      ui::AccessibilityTypes::Event event,
+      ui::AXEvent event,
+      Profile* profile);
+  static void SendTabNotification(
+      views::View* view,
+      ui::AXEvent event,
       Profile* profile);
   static void SendMenuItemNotification(
       views::View* view,
-      ui::AccessibilityTypes::Event event,
+      ui::AXEvent event,
+      Profile* profile);
+  static void SendTreeNotification(
+      views::View* view,
+      ui::AXEvent event,
+      Profile* profile);
+  static void SendTreeItemNotification(
+      views::View* view,
+      ui::AXEvent event,
       Profile* profile);
   static void SendTextfieldNotification(
       views::View* view,
-      ui::AccessibilityTypes::Event event,
+      ui::AXEvent event,
       Profile* profile);
   static void SendComboboxNotification(
       views::View* view,
-      ui::AccessibilityTypes::Event event,
+      ui::AXEvent event,
       Profile* profile);
   static void SendCheckboxNotification(
       views::View* view,
-      ui::AccessibilityTypes::Event event,
+      ui::AXEvent event,
       Profile* profile);
   static void SendWindowNotification(
       views::View* view,
-      ui::AccessibilityTypes::Event event,
+      ui::AXEvent event,
       Profile* profile);
   static void SendSliderNotification(
       views::View* view,
-      ui::AccessibilityTypes::Event event,
+      ui::AXEvent event,
+      Profile* profile);
+  static void SendAlertControlNotification(
+      views::View* view,
+      ui::AXEvent event,
       Profile* profile);
 
   // Return the name of a view.
@@ -128,7 +152,7 @@ class AccessibilityEventRouterViews : public content::NotificationObserver {
   // Return a descendant of this view with a given accessible role, if found.
   static views::View* FindDescendantWithAccessibleRole(
       views::View* view,
-      ui::AccessibilityTypes::Role role);
+      ui::AXRole role);
 
   // Recursively explore all menu items of |menu| and return in |count|
   // the total number of items, and in |index| the 0-based index of
@@ -144,11 +168,21 @@ class AccessibilityEventRouterViews : public content::NotificationObserver {
   // subview with a role of STATIC_TEXT.
   static std::string RecursiveGetStaticText(views::View* view);
 
+  // Returns the first ancestor of |view| (including |view|) that is
+  // accessible.
+  static views::View* FindFirstAccessibleAncestor(views::View* view);
+
   // The profile associated with the most recent window event  - used to
   // figure out where to route a few events that can't be directly traced
   // to a window with a profile (like menu events).
   Profile* most_recent_profile_;
 
+  // The most recent accessibility focusable view is stored in view storage
+  // and is used to prevent multiple events from being dispatched on a
+  // hoverable view from its multiple children. This is the id for the most
+  // recent view we put in view storage.
+  const int most_recent_view_id_;
+
   // Notification registrar so we can clear most_recent_profile_ when a
   // profile is destroyed.
   content::NotificationRegistrar registrar_;