| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 /* |
| 6 * Copyright (C) 2010 Google Inc. All rights reserved. |
| 7 * |
| 8 * Redistribution and use in source and binary forms, with or without |
| 9 * modification, are permitted provided that the following conditions are |
| 10 * met: |
| 11 * |
| 12 * * Redistributions of source code must retain the above copyright |
| 13 * notice, this list of conditions and the following disclaimer. |
| 14 * * Redistributions in binary form must reproduce the above |
| 15 * copyright notice, this list of conditions and the following disclaimer |
| 16 * in the documentation and/or other materials provided with the |
| 17 * distribution. |
| 18 * * Neither the name of Google Inc. nor the names of its |
| 19 * contributors may be used to endorse or promote products derived from |
| 20 * this software without specific prior written permission. |
| 21 * |
| 22 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 23 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 24 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 25 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 26 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 27 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 28 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 29 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 30 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 32 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 33 */ |
| 34 |
| 35 #ifndef WebAXObjectProxy_h |
| 36 #define WebAXObjectProxy_h |
| 37 |
| 38 #include <vector> |
| 39 |
| 40 #include "content/test/layout_tests/runner/CppBoundClass.h" |
| 41 #include "third_party/WebKit/public/web/WebAXObject.h" |
| 42 |
| 43 namespace WebTestRunner { |
| 44 |
| 45 class WebAXObjectProxy : public CppBoundClass { |
| 46 public: |
| 47 class Factory { |
| 48 public: |
| 49 virtual ~Factory() { } |
| 50 virtual WebAXObjectProxy* getOrCreate(const blink::WebAXObject&) = 0; |
| 51 }; |
| 52 |
| 53 WebAXObjectProxy(const blink::WebAXObject&, Factory*); |
| 54 |
| 55 virtual WebAXObjectProxy* getChildAtIndex(unsigned); |
| 56 virtual bool isRoot() const { return false; } |
| 57 virtual bool isEqual(const blink::WebAXObject&); |
| 58 |
| 59 virtual void notificationReceived(const char *notificationName); |
| 60 |
| 61 protected: |
| 62 const blink::WebAXObject& accessibilityObject() const { return m_accessibili
tyObject; } |
| 63 |
| 64 Factory* factory() const { return m_factory; } |
| 65 |
| 66 private: |
| 67 // Bound properties. |
| 68 void roleGetterCallback(CppVariant*); |
| 69 void titleGetterCallback(CppVariant*); |
| 70 void descriptionGetterCallback(CppVariant*); |
| 71 void helpTextGetterCallback(CppVariant*); |
| 72 void stringValueGetterCallback(CppVariant*); |
| 73 void xGetterCallback(CppVariant*); |
| 74 void yGetterCallback(CppVariant*); |
| 75 void widthGetterCallback(CppVariant*); |
| 76 void heightGetterCallback(CppVariant*); |
| 77 void intValueGetterCallback(CppVariant*); |
| 78 void minValueGetterCallback(CppVariant*); |
| 79 void maxValueGetterCallback(CppVariant*); |
| 80 void valueDescriptionGetterCallback(CppVariant*); |
| 81 void childrenCountGetterCallback(CppVariant*); |
| 82 void insertionPointLineNumberGetterCallback(CppVariant*); |
| 83 void selectedTextRangeGetterCallback(CppVariant*); |
| 84 void isEnabledGetterCallback(CppVariant*); |
| 85 void isRequiredGetterCallback(CppVariant*); |
| 86 void isFocusedGetterCallback(CppVariant*); |
| 87 void isFocusableGetterCallback(CppVariant*); |
| 88 void isSelectedGetterCallback(CppVariant*); |
| 89 void isSelectableGetterCallback(CppVariant*); |
| 90 void isMultiSelectableGetterCallback(CppVariant*); |
| 91 void isSelectedOptionActiveGetterCallback(CppVariant*); |
| 92 void isExpandedGetterCallback(CppVariant*); |
| 93 void isCheckedGetterCallback(CppVariant*); |
| 94 void isVisibleGetterCallback(CppVariant*); |
| 95 void isOffScreenGetterCallback(CppVariant*); |
| 96 void isCollapsedGetterCallback(CppVariant*); |
| 97 void hasPopupGetterCallback(CppVariant*); |
| 98 void isValidGetterCallback(CppVariant*); |
| 99 void isReadOnlyGetterCallback(CppVariant*); |
| 100 void orientationGetterCallback(CppVariant*); |
| 101 void clickPointXGetterCallback(CppVariant*); |
| 102 void clickPointYGetterCallback(CppVariant*); |
| 103 void rowCountGetterCallback(CppVariant*); |
| 104 void columnCountGetterCallback(CppVariant*); |
| 105 void isClickableGetterCallback(CppVariant*); |
| 106 |
| 107 // Bound methods. |
| 108 void allAttributesCallback(const CppArgumentList&, CppVariant*); |
| 109 void attributesOfChildrenCallback(const CppArgumentList&, CppVariant*); |
| 110 void lineForIndexCallback(const CppArgumentList&, CppVariant*); |
| 111 void boundsForRangeCallback(const CppArgumentList&, CppVariant*); |
| 112 void childAtIndexCallback(const CppArgumentList&, CppVariant*); |
| 113 void elementAtPointCallback(const CppArgumentList&, CppVariant*); |
| 114 void tableHeaderCallback(const CppArgumentList&, CppVariant*); |
| 115 void rowIndexRangeCallback(const CppArgumentList&, CppVariant*); |
| 116 void columnIndexRangeCallback(const CppArgumentList&, CppVariant*); |
| 117 void cellForColumnAndRowCallback(const CppArgumentList&, CppVariant*); |
| 118 void titleUIElementCallback(const CppArgumentList&, CppVariant*); |
| 119 void setSelectedTextRangeCallback(const CppArgumentList&, CppVariant*); |
| 120 void isAttributeSettableCallback(const CppArgumentList&, CppVariant*); |
| 121 void isPressActionSupportedCallback(const CppArgumentList&, CppVariant*); |
| 122 void isIncrementActionSupportedCallback(const CppArgumentList&, CppVariant*)
; |
| 123 void isDecrementActionSupportedCallback(const CppArgumentList&, CppVariant*)
; |
| 124 void parentElementCallback(const CppArgumentList&, CppVariant*); |
| 125 void incrementCallback(const CppArgumentList&, CppVariant*); |
| 126 void decrementCallback(const CppArgumentList&, CppVariant*); |
| 127 void showMenuCallback(const CppArgumentList&, CppVariant*); |
| 128 void pressCallback(const CppArgumentList&, CppVariant*); |
| 129 void isEqualCallback(const CppArgumentList&, CppVariant*); |
| 130 void addNotificationListenerCallback(const CppArgumentList&, CppVariant*); |
| 131 void removeNotificationListenerCallback(const CppArgumentList&, CppVariant*)
; |
| 132 void takeFocusCallback(const CppArgumentList&, CppVariant*); |
| 133 void scrollToMakeVisibleCallback(const CppArgumentList&, CppVariant*); |
| 134 void scrollToMakeVisibleWithSubFocusCallback(const CppArgumentList&, CppVari
ant*); |
| 135 void scrollToGlobalPointCallback(const CppArgumentList&, CppVariant*); |
| 136 void wordStartCallback(const CppArgumentList&, CppVariant*); |
| 137 void wordEndCallback(const CppArgumentList&, CppVariant*); |
| 138 |
| 139 void fallbackCallback(const CppArgumentList&, CppVariant*); |
| 140 |
| 141 blink::WebAXObject m_accessibilityObject; |
| 142 Factory* m_factory; |
| 143 std::vector<CppVariant> m_notificationCallbacks; |
| 144 }; |
| 145 |
| 146 |
| 147 class RootWebAXObjectProxy : public WebAXObjectProxy { |
| 148 public: |
| 149 RootWebAXObjectProxy(const blink::WebAXObject&, Factory*); |
| 150 |
| 151 virtual WebAXObjectProxy* getChildAtIndex(unsigned); |
| 152 virtual bool isRoot() const { return true; } |
| 153 }; |
| 154 |
| 155 |
| 156 // Provides simple lifetime management of the WebAXObjectProxy instances: |
| 157 // all WebAXObjectProxys ever created from the controller are stored in |
| 158 // a list and cleared explicitly. |
| 159 class WebAXObjectProxyList : public WebAXObjectProxy::Factory { |
| 160 public: |
| 161 WebAXObjectProxyList() { } |
| 162 virtual ~WebAXObjectProxyList(); |
| 163 |
| 164 void clear(); |
| 165 virtual WebAXObjectProxy* getOrCreate(const blink::WebAXObject&); |
| 166 WebAXObjectProxy* createRoot(const blink::WebAXObject&); |
| 167 |
| 168 private: |
| 169 typedef std::vector<WebAXObjectProxy*> ElementList; |
| 170 ElementList m_elements; |
| 171 }; |
| 172 |
| 173 } |
| 174 |
| 175 #endif // WebAXObjectProxy_h |
| OLD | NEW |