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

Side by Side Diff: webkit/api/src/WebAccessibilityCacheImpl.h

Issue 385057: Deleted webkit/api which now lives in webkit.org (Closed)
Patch Set: Created 11 years, 1 month 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 unified diff | Download patch
« no previous file with comments | « webkit/api/src/WebAccessibilityCache.cpp ('k') | webkit/api/src/WebAccessibilityCacheImpl.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
2 * Copyright (C) 2009 Google Inc. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are
6 * met:
7 *
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above
11 * copyright notice, this list of conditions and the following disclaimer
12 * in the documentation and/or other materials provided with the
13 * distribution.
14 * * Neither the name of Google Inc. nor the names of its
15 * contributors may be used to endorse or promote products derived from
16 * this software without specific prior written permission.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */
30
31 #ifndef WebAccessibilityCacheImpl_h
32 #define WebAccessibilityCacheImpl_h
33
34 // FIXME: Move wtf/RefCounted.h include to AccessibilityObjectWrapper.h
35 // once this file is upstream.
36 #include <wtf/RefCounted.h>
37
38 #include "AccessibilityObjectWrapper.h"
39 #include "WebAccessibilityCache.h"
40 #include <wtf/HashMap.h>
41 #include <wtf/PassRefPtr.h>
42
43 namespace WebKit {
44
45 // FIXME: Should be eliminated to use AXObjectCache instead.
46 class WebAccessibilityCacheImpl : public WebKit::WebAccessibilityCache {
47 public:
48 virtual void initialize(WebView* view);
49 virtual bool isInitialized() const { return m_initialized; }
50
51 virtual WebAccessibilityObject getObjectById(int);
52 virtual bool isValidId(int) const;
53 virtual int addOrGetId(const WebKit::WebAccessibilityObject&);
54
55 virtual void remove(int);
56 virtual void clear();
57
58 protected:
59 friend class WebKit::WebAccessibilityCache;
60
61 WebAccessibilityCacheImpl();
62 ~WebAccessibilityCacheImpl();
63
64 private:
65 // FIXME: This can be just part of Chromium's AccessibilityObjectWrapper.
66 class WeakHandle : public WebCore::AccessibilityObjectWrapper {
67 public:
68 static PassRefPtr<WeakHandle> create(WebCore::AccessibilityObject*);
69 virtual void detach();
70 private:
71 WeakHandle(WebCore::AccessibilityObject*);
72 };
73
74 typedef HashMap<int, RefPtr<WeakHandle> > ObjectMap;
75 typedef HashMap<WebCore::AccessibilityObject*, int> IdMap;
76
77 // Hashmap for caching of elements in use by the AT, mapping id (int) to
78 // WebAccessibilityObject.
79 ObjectMap m_objectMap;
80 // Hashmap for caching of elements in use by the AT, mapping a
81 // AccessibilityObject pointer to its id (int). Needed for reverse lookup,
82 // to ensure unnecessary duplicate entries are not created in the
83 // ObjectMap and for focus changes in WebKit.
84 IdMap m_idMap;
85
86 // Unique identifier for retrieving an accessibility object from the page's
87 // hashmaps. Id is always 0 for the root of the accessibility object
88 // hierarchy (on a per-renderer process basis).
89 int m_nextNewId;
90
91 bool m_initialized;
92 };
93
94 }
95
96 #endif
OLDNEW
« no previous file with comments | « webkit/api/src/WebAccessibilityCache.cpp ('k') | webkit/api/src/WebAccessibilityCacheImpl.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698