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 #include "ui/views/accessible_pane_view.h" | 5 #include "ui/views/accessible_pane_view.h" |
6 | 6 |
7 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
8 #include "ui/accessibility/ax_view_state.h" | 8 #include "ui/accessibility/ax_view_state.h" |
9 #include "ui/views/focus/focus_search.h" | 9 #include "ui/views/focus/focus_search.h" |
10 #include "ui/views/focus/view_storage.h" | 10 #include "ui/views/focus/view_storage.h" |
11 #include "ui/views/widget/widget.h" | 11 #include "ui/views/widget/widget.h" |
12 | 12 |
13 namespace views { | 13 namespace views { |
14 | 14 |
15 // Create tiny subclass of FocusSearch that overrides GetParent and Contains, | 15 // Create tiny subclass of FocusSearch that overrides GetParent and Contains, |
16 // delegating these to methods in AccessiblePaneView. This is needed so that | 16 // delegating these to methods in AccessiblePaneView. This is needed so that |
17 // subclasses of AccessiblePaneView can customize the focus search logic and | 17 // subclasses of AccessiblePaneView can customize the focus search logic and |
18 // include views that aren't part of the AccessiblePaneView's view | 18 // include views that aren't part of the AccessiblePaneView's view |
19 // hierarchy in the focus order. | 19 // hierarchy in the focus order. |
20 class AccessiblePaneViewFocusSearch : public FocusSearch { | 20 class AccessiblePaneViewFocusSearch : public FocusSearch { |
21 public: | 21 public: |
22 explicit AccessiblePaneViewFocusSearch(AccessiblePaneView* pane_view) | 22 explicit AccessiblePaneViewFocusSearch(AccessiblePaneView* pane_view) |
23 : FocusSearch(pane_view, true, true), | 23 : FocusSearch(pane_view, true, true), |
24 accessible_pane_view_(pane_view) {} | 24 accessible_pane_view_(pane_view) {} |
25 | 25 |
26 protected: | 26 protected: |
27 virtual View* GetParent(View* v) OVERRIDE { | 27 virtual View* GetParent(View* v) override { |
28 return accessible_pane_view_->ContainsForFocusSearch(root(), v) ? | 28 return accessible_pane_view_->ContainsForFocusSearch(root(), v) ? |
29 accessible_pane_view_->GetParentForFocusSearch(v) : NULL; | 29 accessible_pane_view_->GetParentForFocusSearch(v) : NULL; |
30 } | 30 } |
31 | 31 |
32 // Returns true if |v| is contained within the hierarchy rooted at |root|. | 32 // Returns true if |v| is contained within the hierarchy rooted at |root|. |
33 // Subclasses can override this if they need custom focus search behavior. | 33 // Subclasses can override this if they need custom focus search behavior. |
34 virtual bool Contains(View* root, const View* v) OVERRIDE { | 34 virtual bool Contains(View* root, const View* v) override { |
35 return accessible_pane_view_->ContainsForFocusSearch(root, v); | 35 return accessible_pane_view_->ContainsForFocusSearch(root, v); |
36 } | 36 } |
37 | 37 |
38 private: | 38 private: |
39 AccessiblePaneView* accessible_pane_view_; | 39 AccessiblePaneView* accessible_pane_view_; |
40 DISALLOW_COPY_AND_ASSIGN(AccessiblePaneViewFocusSearch); | 40 DISALLOW_COPY_AND_ASSIGN(AccessiblePaneViewFocusSearch); |
41 }; | 41 }; |
42 | 42 |
43 AccessiblePaneView::AccessiblePaneView() | 43 AccessiblePaneView::AccessiblePaneView() |
44 : pane_has_focus_(false), | 44 : pane_has_focus_(false), |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 DCHECK(pane_has_focus_); | 253 DCHECK(pane_has_focus_); |
254 return NULL; | 254 return NULL; |
255 } | 255 } |
256 | 256 |
257 views::View* AccessiblePaneView::GetFocusTraversableParentView() { | 257 views::View* AccessiblePaneView::GetFocusTraversableParentView() { |
258 DCHECK(pane_has_focus_); | 258 DCHECK(pane_has_focus_); |
259 return NULL; | 259 return NULL; |
260 } | 260 } |
261 | 261 |
262 } // namespace views | 262 } // namespace views |
OLD | NEW |