Drive: Add BatchableRequest subclass.
[chromium-blink-merge.git] / ui / views / accessibility / native_view_accessibility.h
blob5c5c135c9b62568ea64fb34a86cbea509797837f
1 // Copyright (c) 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.
5 #ifndef UI_VIEWS_ACCESSIBILITY_NATIVE_VIEW_ACCESSIBILITY_H_
6 #define UI_VIEWS_ACCESSIBILITY_NATIVE_VIEW_ACCESSIBILITY_H_
8 #include "ui/accessibility/ax_node_data.h"
9 #include "ui/accessibility/platform/ax_platform_node.h"
10 #include "ui/accessibility/platform/ax_platform_node_delegate.h"
11 #include "ui/gfx/native_widget_types.h"
12 #include "ui/views/views_export.h"
13 #include "ui/views/widget/widget_observer.h"
15 namespace views {
17 class View;
18 class Widget;
20 class VIEWS_EXPORT NativeViewAccessibility
21 : public ui::AXPlatformNodeDelegate,
22 public WidgetObserver {
23 public:
24 static NativeViewAccessibility* Create(View* view);
26 gfx::NativeViewAccessible GetNativeObject();
28 // Call Destroy rather than deleting this, because the subclass may
29 // use reference counting.
30 virtual void Destroy();
32 void NotifyAccessibilityEvent(ui::AXEvent event_type);
34 // ui::AXPlatformNodeDelegate
35 const ui::AXNodeData& GetData() override;
36 int GetChildCount() override;
37 gfx::NativeViewAccessible ChildAtIndex(int index) override;
38 gfx::NativeViewAccessible GetParent() override;
39 gfx::Vector2d GetGlobalCoordinateOffset() override;
40 gfx::NativeViewAccessible HitTestSync(int x, int y) override;
41 gfx::NativeViewAccessible GetFocus() override;
42 gfx::AcceleratedWidget GetTargetForNativeAccessibilityEvent() override;
43 void DoDefaultAction() override;
44 bool SetStringValue(const base::string16& new_value) override;
46 // WidgetObserver
47 void OnWidgetDestroying(Widget* widget) override;
49 Widget* parent_widget() const { return parent_widget_; }
50 void SetParentWidget(Widget* parent_widget);
52 protected:
53 NativeViewAccessibility(View* view);
54 ~NativeViewAccessibility() override;
56 // Weak. Owns this.
57 View* view_;
59 // Weak. Uses WidgetObserver to clear. This is set on the root view for
60 // a widget that's owned by another widget, so we can walk back up the
61 // tree.
62 Widget* parent_widget_;
64 private:
65 void PopulateChildWidgetVector(std::vector<Widget*>* result_child_widgets);
67 // We own this, but it is reference-counted on some platforms so we can't use
68 // a scoped_ptr. It is dereferenced in the destructor.
69 ui::AXPlatformNode* ax_node_;
71 ui::AXNodeData data_;
73 DISALLOW_COPY_AND_ASSIGN(NativeViewAccessibility);
76 } // namespace views
78 #endif // UI_VIEWS_ACCESSIBILITY_NATIVE_VIEW_ACCESSIBILITY_H_