Chromium Code Reviews| Index: ui/views/accessibility/ax_obj_cache.h |
| diff --git a/ui/views/accessibility/ax_obj_cache.h b/ui/views/accessibility/ax_obj_cache.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..5198f86d5f949521c5502f61d39d3a3bee7a5955 |
| --- /dev/null |
| +++ b/ui/views/accessibility/ax_obj_cache.h |
| @@ -0,0 +1,57 @@ |
| +// Copyright 2014 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef UI_VIEWS_ACCESSIBILITY_AX_OBJ_CACHE_H_ |
| +#define UI_VIEWS_ACCESSIBILITY_AX_OBJ_CACHE_H_ |
| + |
| +#include <map> |
| + |
| +#include "base/basictypes.h" |
| + |
| +template <typename T> struct DefaultSingletonTraits; |
| + |
| +namespace aura { |
| +class Window; |
| +} // namespace aura |
| + |
| +namespace views { |
| + |
| +class AXNodeSourceObjWrapper; |
| +class View; |
| +class Widget; |
| + |
| +class AXObjCache { |
|
dmazzoni
2014/04/23 05:06:44
Then this could be AXAuraObjCache, which is good b
David Tseng
2014/04/23 18:20:01
There was a point where I would have liked to shar
|
| + public: |
| + // Get the single instance of this class. |
| + static AXObjCache* GetInstance(); |
| + |
| + AXNodeSourceObjWrapper* GetOrCreate(View* view); |
| + AXNodeSourceObjWrapper* GetOrCreate(Widget* widget); |
| + AXNodeSourceObjWrapper* GetOrCreate(aura::Window* window); |
| + |
| +uint32 GetID(View* view); |
| +uint32 GetID(Widget* widget); |
| +uint32 GetID(aura::Window* window); |
| + |
| + private: |
| + friend struct DefaultSingletonTraits<AXObjCache>; |
| + |
| + AXObjCache() : current_id_(0) {} |
| +virtual ~AXObjCache() {} |
| + |
| + AXNodeSourceObjWrapper* Get(uint32 id); |
| + |
| + std::map<views::View*, uint32> view_to_id_map_; |
| + std::map<views::Widget*, uint32> widget_to_id_map_; |
| + std::map<aura::Window*, uint32> window_to_id_map_; |
| + |
| + std::map<uint32, AXNodeSourceObjWrapper*> cache_; |
| + uint32 current_id_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(AXObjCache); |
| +}; |
| + |
| +} // namespace views |
| + |
| +#endif // UI_VIEWS_ACCESSIBILITY_AX_OBJ_CACHE_H_ |