| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef UI_VIEWS_ACCESSIBILITY_AX_AURA_OBJ_CACHE_H_ | 5 #ifndef UI_VIEWS_ACCESSIBILITY_AX_AURA_OBJ_CACHE_H_ |
| 6 #define UI_VIEWS_ACCESSIBILITY_AX_AURA_OBJ_CACHE_H_ | 6 #define UI_VIEWS_ACCESSIBILITY_AX_AURA_OBJ_CACHE_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| 11 #include <memory> | 11 #include <memory> |
| 12 #include <vector> | 12 #include <vector> |
| 13 | 13 |
| 14 #include "base/macros.h" | 14 #include "base/macros.h" |
| 15 #include "ui/accessibility/ax_enums.h" |
| 15 #include "ui/aura/client/focus_change_observer.h" | 16 #include "ui/aura/client/focus_change_observer.h" |
| 16 #include "ui/aura/window_observer.h" | 17 #include "ui/aura/window_observer.h" |
| 17 #include "ui/views/views_export.h" | 18 #include "ui/views/views_export.h" |
| 18 | 19 |
| 19 namespace base { | 20 namespace base { |
| 20 template <typename T> struct DefaultSingletonTraits; | 21 template <typename T> struct DefaultSingletonTraits; |
| 21 } | 22 } |
| 22 | 23 |
| 23 namespace aura { | 24 namespace aura { |
| 24 namespace client { | 25 namespace client { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 36 class VIEWS_EXPORT AXAuraObjCache | 37 class VIEWS_EXPORT AXAuraObjCache |
| 37 : public aura::client::FocusChangeObserver, | 38 : public aura::client::FocusChangeObserver, |
| 38 public aura::WindowObserver { | 39 public aura::WindowObserver { |
| 39 public: | 40 public: |
| 40 // Get the single instance of this class. | 41 // Get the single instance of this class. |
| 41 static AXAuraObjCache* GetInstance(); | 42 static AXAuraObjCache* GetInstance(); |
| 42 | 43 |
| 43 class Delegate { | 44 class Delegate { |
| 44 public: | 45 public: |
| 45 virtual void OnChildWindowRemoved(AXAuraObjWrapper* parent) = 0; | 46 virtual void OnChildWindowRemoved(AXAuraObjWrapper* parent) = 0; |
| 47 virtual void OnEvent(AXAuraObjWrapper* aura_obj, |
| 48 ui::AXEvent event_type) = 0; |
| 46 }; | 49 }; |
| 47 | 50 |
| 48 // Get or create an entry in the cache based on an Aura view. | 51 // Get or create an entry in the cache based on an Aura view. |
| 49 AXAuraObjWrapper* GetOrCreate(View* view); | 52 AXAuraObjWrapper* GetOrCreate(View* view); |
| 50 AXAuraObjWrapper* GetOrCreate(Widget* widget); | 53 AXAuraObjWrapper* GetOrCreate(Widget* widget); |
| 51 AXAuraObjWrapper* GetOrCreate(aura::Window* window); | 54 AXAuraObjWrapper* GetOrCreate(aura::Window* window); |
| 52 | 55 |
| 53 // Gets an id given an Aura view. | 56 // Gets an id given an Aura view. |
| 54 int32_t GetID(View* view) const; | 57 int32_t GetID(View* view) const; |
| 55 int32_t GetID(Widget* widget) const; | 58 int32_t GetID(Widget* widget) const; |
| (...skipping 22 matching lines...) Expand all Loading... |
| 78 | 81 |
| 79 // Get all top level windows this cache knows about. | 82 // Get all top level windows this cache knows about. |
| 80 void GetTopLevelWindows(std::vector<AXAuraObjWrapper*>* children); | 83 void GetTopLevelWindows(std::vector<AXAuraObjWrapper*>* children); |
| 81 | 84 |
| 82 // Get the object that has focus. | 85 // Get the object that has focus. |
| 83 AXAuraObjWrapper* GetFocus(); | 86 AXAuraObjWrapper* GetFocus(); |
| 84 | 87 |
| 85 // Send a notification that the focused view may have changed. | 88 // Send a notification that the focused view may have changed. |
| 86 void OnFocusedViewChanged(); | 89 void OnFocusedViewChanged(); |
| 87 | 90 |
| 91 // Tell our delegate to fire an event on a given object. |
| 92 void FireEvent(AXAuraObjWrapper* aura_obj, ui::AXEvent event_type); |
| 93 |
| 88 // Indicates if this object's currently being destroyed. | 94 // Indicates if this object's currently being destroyed. |
| 89 bool is_destroying() { return is_destroying_; } | 95 bool is_destroying() { return is_destroying_; } |
| 90 | 96 |
| 91 void SetDelegate(Delegate* delegate) { delegate_ = delegate; } | 97 void SetDelegate(Delegate* delegate) { delegate_ = delegate; } |
| 92 | 98 |
| 93 private: | 99 private: |
| 94 friend struct base::DefaultSingletonTraits<AXAuraObjCache>; | 100 friend struct base::DefaultSingletonTraits<AXAuraObjCache>; |
| 95 | 101 |
| 96 AXAuraObjCache(); | 102 AXAuraObjCache(); |
| 97 ~AXAuraObjCache() override; | 103 ~AXAuraObjCache() override; |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 bool is_destroying_; | 138 bool is_destroying_; |
| 133 | 139 |
| 134 Delegate* delegate_; | 140 Delegate* delegate_; |
| 135 | 141 |
| 136 DISALLOW_COPY_AND_ASSIGN(AXAuraObjCache); | 142 DISALLOW_COPY_AND_ASSIGN(AXAuraObjCache); |
| 137 }; | 143 }; |
| 138 | 144 |
| 139 } // namespace views | 145 } // namespace views |
| 140 | 146 |
| 141 #endif // UI_VIEWS_ACCESSIBILITY_AX_AURA_OBJ_CACHE_H_ | 147 #endif // UI_VIEWS_ACCESSIBILITY_AX_AURA_OBJ_CACHE_H_ |
| OLD | NEW |