OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_NATIVE_VIEW_ACCESSIBILITY_WIN_H_ | 5 #ifndef UI_VIEWS_ACCESSIBILITY_NATIVE_VIEW_ACCESSIBILITY_WIN_H_ |
6 #define UI_VIEWS_ACCESSIBILITY_NATIVE_VIEW_ACCESSIBILITY_WIN_H_ | 6 #define UI_VIEWS_ACCESSIBILITY_NATIVE_VIEW_ACCESSIBILITY_WIN_H_ |
7 | 7 |
8 #include <atlbase.h> | 8 #include <atlbase.h> |
9 #include <atlcom.h> | 9 #include <atlcom.h> |
10 #include <oleacc.h> | 10 #include <oleacc.h> |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 END_COM_MAP() | 59 END_COM_MAP() |
60 | 60 |
61 virtual ~NativeViewAccessibilityWin(); | 61 virtual ~NativeViewAccessibilityWin(); |
62 | 62 |
63 // NativeViewAccessibility. | 63 // NativeViewAccessibility. |
64 virtual void NotifyAccessibilityEvent( | 64 virtual void NotifyAccessibilityEvent( |
65 ui::AXEvent event_type) OVERRIDE; | 65 ui::AXEvent event_type) OVERRIDE; |
66 virtual gfx::NativeViewAccessible GetNativeObject() OVERRIDE; | 66 virtual gfx::NativeViewAccessible GetNativeObject() OVERRIDE; |
67 virtual void Destroy() OVERRIDE; | 67 virtual void Destroy() OVERRIDE; |
68 | 68 |
69 void set_view(views::View* view) { view_ = view; } | |
70 | |
71 // Supported IAccessible methods. | 69 // Supported IAccessible methods. |
72 | 70 |
73 // Retrieves the child element or child object at a given point on the screen. | 71 // Retrieves the child element or child object at a given point on the screen. |
74 virtual STDMETHODIMP accHitTest(LONG x_left, LONG y_top, VARIANT* child); | 72 virtual STDMETHODIMP accHitTest(LONG x_left, LONG y_top, VARIANT* child); |
75 | 73 |
76 // Performs the object's default action. | 74 // Performs the object's default action. |
77 STDMETHODIMP accDoDefaultAction(VARIANT var_id); | 75 STDMETHODIMP accDoDefaultAction(VARIANT var_id); |
78 | 76 |
79 // Retrieves the specified object's current screen location. | 77 // Retrieves the specified object's current screen location. |
80 STDMETHODIMP accLocation(LONG* x_left, | 78 STDMETHODIMP accLocation(LONG* x_left, |
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
358 // to an MSAA role. | 356 // to an MSAA role. |
359 static int32 MSAARole(ui::AXRole role); | 357 static int32 MSAARole(ui::AXRole role); |
360 | 358 |
361 // Returns a conversion from the State (as defined in ax_enums.idl) | 359 // Returns a conversion from the State (as defined in ax_enums.idl) |
362 // to MSAA states set. | 360 // to MSAA states set. |
363 static int32 MSAAState(const ui::AXViewState& state); | 361 static int32 MSAAState(const ui::AXViewState& state); |
364 | 362 |
365 protected: | 363 protected: |
366 NativeViewAccessibilityWin(); | 364 NativeViewAccessibilityWin(); |
367 | 365 |
368 const View* view() const { return view_; } | |
369 | |
370 private: | 366 private: |
371 // Determines navigation direction for accNavigate, based on left, up and | 367 // Determines navigation direction for accNavigate, based on left, up and |
372 // previous being mapped all to previous and right, down, next being mapped | 368 // previous being mapped all to previous and right, down, next being mapped |
373 // to next. Returns true if navigation direction is next, false otherwise. | 369 // to next. Returns true if navigation direction is next, false otherwise. |
374 bool IsNavDirNext(int nav_dir) const; | 370 bool IsNavDirNext(int nav_dir) const; |
375 | 371 |
376 // Determines if the navigation target is within the allowed bounds. Returns | 372 // Determines if the navigation target is within the allowed bounds. Returns |
377 // true if it is, false otherwise. | 373 // true if it is, false otherwise. |
378 bool IsValidNav(int nav_dir, | 374 bool IsValidNav(int nav_dir, |
379 int start_id, | 375 int start_id, |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
411 | 407 |
412 // Adds this view to alert_target_view_storage_ids_. | 408 // Adds this view to alert_target_view_storage_ids_. |
413 void AddAlertTarget(); | 409 void AddAlertTarget(); |
414 | 410 |
415 // Removes this view from alert_target_view_storage_ids_. | 411 // Removes this view from alert_target_view_storage_ids_. |
416 void RemoveAlertTarget(); | 412 void RemoveAlertTarget(); |
417 | 413 |
418 // Give CComObject access to the class constructor. | 414 // Give CComObject access to the class constructor. |
419 template <class Base> friend class CComObject; | 415 template <class Base> friend class CComObject; |
420 | 416 |
421 // Member View needed for view-specific calls. | |
422 View* view_; | |
423 | |
424 // A unique id for each object, needed for IAccessible2. | 417 // A unique id for each object, needed for IAccessible2. |
425 long unique_id_; | 418 long unique_id_; |
426 | 419 |
427 // Next unique id to assign. | 420 // Next unique id to assign. |
428 static long next_unique_id_; | 421 static long next_unique_id_; |
429 | 422 |
430 // Circular queue size. | 423 // Circular queue size. |
431 static const int kMaxViewStorageIds = 20; | 424 static const int kMaxViewStorageIds = 20; |
432 | 425 |
433 // Circular queue of view storage ids corresponding to child ids | 426 // Circular queue of view storage ids corresponding to child ids |
434 // used to post notifications using NotifyWinEvent. | 427 // used to post notifications using NotifyWinEvent. |
435 static int view_storage_ids_[kMaxViewStorageIds]; | 428 static int view_storage_ids_[kMaxViewStorageIds]; |
436 | 429 |
437 // Next index into |view_storage_ids_| to use. | 430 // Next index into |view_storage_ids_| to use. |
438 static int next_view_storage_id_index_; | 431 static int next_view_storage_id_index_; |
439 | 432 |
440 // A vector of view storage ids of views that have been the target of | 433 // A vector of view storage ids of views that have been the target of |
441 // an alert event, in order to provide an api to quickly identify all | 434 // an alert event, in order to provide an api to quickly identify all |
442 // open alerts. | 435 // open alerts. |
443 static std::vector<int> alert_target_view_storage_ids_; | 436 static std::vector<int> alert_target_view_storage_ids_; |
444 | 437 |
445 DISALLOW_COPY_AND_ASSIGN(NativeViewAccessibilityWin); | 438 DISALLOW_COPY_AND_ASSIGN(NativeViewAccessibilityWin); |
446 }; | 439 }; |
447 | 440 |
448 } // namespace views | 441 } // namespace views |
449 | 442 |
450 #endif // UI_VIEWS_ACCESSIBILITY_NATIVE_VIEW_ACCESSIBILITY_WIN_H_ | 443 #endif // UI_VIEWS_ACCESSIBILITY_NATIVE_VIEW_ACCESSIBILITY_WIN_H_ |
OLD | NEW |