| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 CHROME_FRAME_TEST_CHROME_FRAME_UI_TEST_UTILS_H_ | 5 #ifndef CHROME_FRAME_TEST_CHROME_FRAME_UI_TEST_UTILS_H_ |
| 6 #define CHROME_FRAME_TEST_CHROME_FRAME_UI_TEST_UTILS_H_ | 6 #define CHROME_FRAME_TEST_CHROME_FRAME_UI_TEST_UTILS_H_ |
| 7 | 7 |
| 8 #include <oleacc.h> | 8 #include <oleacc.h> |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "base/ref_counted.h" | 13 #include "base/ref_counted.h" |
| 14 #include "base/scoped_comptr_win.h" | 14 #include "base/scoped_comptr_win.h" |
| 15 #include "base/scoped_variant_win.h" | 15 #include "base/win/scoped_variant.h" |
| 16 #include "chrome_frame/test/win_event_receiver.h" | 16 #include "chrome_frame/test/win_event_receiver.h" |
| 17 | 17 |
| 18 namespace gfx { | 18 namespace gfx { |
| 19 class Rect; | 19 class Rect; |
| 20 } | 20 } |
| 21 | 21 |
| 22 namespace chrome_frame_test { | 22 namespace chrome_frame_test { |
| 23 | 23 |
| 24 // Wrapper for MSAA objects. In MSAA, there are two types of objects. The first, | 24 // Wrapper for MSAA objects. In MSAA, there are two types of objects. The first, |
| 25 // called an object or full object, has its own IAccessible interface. The | 25 // called an object or full object, has its own IAccessible interface. The |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 // The variant should be of type |VT_I4| referring to the id of a child of | 148 // The variant should be of type |VT_I4| referring to the id of a child of |
| 149 // |object|, or of type |VT_DISPATCH|. This method is useful for converting | 149 // |object|, or of type |VT_DISPATCH|. This method is useful for converting |
| 150 // the variant returned by many of the IAccessible methods into an AccObject. | 150 // the variant returned by many of the IAccessible methods into an AccObject. |
| 151 static AccObject* CreateFromVariant(AccObject* object, | 151 static AccObject* CreateFromVariant(AccObject* object, |
| 152 const VARIANT& variant); | 152 const VARIANT& variant); |
| 153 | 153 |
| 154 // Helper method for posting mouse button messages at this object's location. | 154 // Helper method for posting mouse button messages at this object's location. |
| 155 bool PostMouseButtonMessages(int button_up, int button_down); | 155 bool PostMouseButtonMessages(int button_up, int button_down); |
| 156 | 156 |
| 157 ScopedComPtr<IAccessible> accessible_; | 157 ScopedComPtr<IAccessible> accessible_; |
| 158 ScopedVariant child_id_; | 158 base::win::ScopedVariant child_id_; |
| 159 | 159 |
| 160 DISALLOW_COPY_AND_ASSIGN(AccObject); | 160 DISALLOW_COPY_AND_ASSIGN(AccObject); |
| 161 }; | 161 }; |
| 162 | 162 |
| 163 // Finds an accessibility object with properties that match the specified | 163 // Finds an accessibility object with properties that match the specified |
| 164 // matching patterns. These patterns can include the standard * and ? wildcards. | 164 // matching patterns. These patterns can include the standard * and ? wildcards. |
| 165 class AccObjectMatcher { | 165 class AccObjectMatcher { |
| 166 public: | 166 public: |
| 167 // Create a matcher from the given string. |matcher| should include matching | 167 // Create a matcher from the given string. |matcher| should include matching |
| 168 // patterns for each property separated by colons. Matching patterns must | 168 // patterns for each property separated by colons. Matching patterns must |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 // observer was set to watch for it. | 222 // observer was set to watch for it. |
| 223 virtual void OnAccValueChange(HWND hwnd, AccObject* object, | 223 virtual void OnAccValueChange(HWND hwnd, AccObject* object, |
| 224 const std::wstring& new_value) = 0; | 224 const std::wstring& new_value) = 0; |
| 225 | 225 |
| 226 // Called when a new menu is shown. | 226 // Called when a new menu is shown. |
| 227 virtual void OnMenuPopup(HWND hwnd) = 0; | 227 virtual void OnMenuPopup(HWND hwnd) = 0; |
| 228 | 228 |
| 229 private: | 229 private: |
| 230 class EventHandler : public base::RefCounted<EventHandler> { | 230 class EventHandler : public base::RefCounted<EventHandler> { |
| 231 public: | 231 public: |
| 232 EventHandler(AccEventObserver* observer); | 232 explicit EventHandler(AccEventObserver* observer); |
| 233 | 233 |
| 234 // Examines the given event and invokes the corresponding method of its | 234 // Examines the given event and invokes the corresponding method of its |
| 235 // observer. | 235 // observer. |
| 236 void Handle(DWORD event, HWND hwnd, LONG object_id, LONG child_id); | 236 void Handle(DWORD event, HWND hwnd, LONG object_id, LONG child_id); |
| 237 | 237 |
| 238 AccEventObserver* observer_; | 238 AccEventObserver* observer_; |
| 239 }; | 239 }; |
| 240 | 240 |
| 241 // Overriden from WinEventListener. | 241 // Overriden from WinEventListener. |
| 242 virtual void OnEventReceived(DWORD event, HWND hwnd, LONG object_id, | 242 virtual void OnEventReceived(DWORD event, HWND hwnd, LONG object_id, |
| (...skipping 15 matching lines...) Expand all Loading... |
| 258 // Writes the accessibility tree for the given window to standard out. Used for | 258 // Writes the accessibility tree for the given window to standard out. Used for |
| 259 // debugging/logging. | 259 // debugging/logging. |
| 260 void DumpAccessibilityTreeForWindow(HWND hwnd); | 260 void DumpAccessibilityTreeForWindow(HWND hwnd); |
| 261 | 261 |
| 262 // Returns whether the desktop is unlocked. | 262 // Returns whether the desktop is unlocked. |
| 263 bool IsDesktopUnlocked(); | 263 bool IsDesktopUnlocked(); |
| 264 | 264 |
| 265 } // namespace chrome_frame_test | 265 } // namespace chrome_frame_test |
| 266 | 266 |
| 267 #endif // CHROME_FRAME_TEST_CHROME_FRAME_UI_TEST_UTILS_H_ | 267 #endif // CHROME_FRAME_TEST_CHROME_FRAME_UI_TEST_UTILS_H_ |
| OLD | NEW |