OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "views/controls/tabbed_pane/tabbed_pane.h" | 5 #include "views/controls/tabbed_pane/tabbed_pane.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "ui/base/accessibility/accessible_view_state.h" | 8 #include "ui/base/accessibility/accessible_view_state.h" |
9 #include "ui/base/keycodes/keyboard_codes.h" | 9 #include "ui/base/keycodes/keyboard_codes.h" |
10 #include "views/controls/native/native_view_host.h" | 10 #include "views/controls/native/native_view_host.h" |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 void TabbedPane::ViewHierarchyChanged(bool is_add, View* parent, View* child) { | 84 void TabbedPane::ViewHierarchyChanged(bool is_add, View* parent, View* child) { |
85 if (is_add && !native_tabbed_pane_) { | 85 if (is_add && !native_tabbed_pane_) { |
86 // The native wrapper's lifetime will be managed by the view hierarchy after | 86 // The native wrapper's lifetime will be managed by the view hierarchy after |
87 // we call AddChildView. | 87 // we call AddChildView. |
88 native_tabbed_pane_ = NativeTabbedPaneWrapper::CreateNativeWrapper(this); | 88 native_tabbed_pane_ = NativeTabbedPaneWrapper::CreateNativeWrapper(this); |
89 AddChildView(native_tabbed_pane_->GetView()); | 89 AddChildView(native_tabbed_pane_->GetView()); |
90 LoadAccelerators(); | 90 LoadAccelerators(); |
91 } | 91 } |
92 } | 92 } |
93 | 93 |
94 bool TabbedPane::AcceleratorPressed(const views::Accelerator& accelerator) { | 94 bool TabbedPane::AcceleratorPressed(const ui::Accelerator& accelerator) { |
95 // We only accept Ctrl+Tab keyboard events. | 95 // We only accept Ctrl+Tab keyboard events. |
96 DCHECK(accelerator.key_code() == ui::VKEY_TAB && accelerator.IsCtrlDown()); | 96 DCHECK(accelerator.key_code() == ui::VKEY_TAB && accelerator.IsCtrlDown()); |
97 | 97 |
98 int tab_count = GetTabCount(); | 98 int tab_count = GetTabCount(); |
99 if (tab_count <= 1) | 99 if (tab_count <= 1) |
100 return false; | 100 return false; |
101 int selected_tab_index = GetSelectedTabIndex(); | 101 int selected_tab_index = GetSelectedTabIndex(); |
102 int next_tab_index = accelerator.IsShiftDown() ? | 102 int next_tab_index = accelerator.IsShiftDown() ? |
103 (selected_tab_index - 1) % tab_count : | 103 (selected_tab_index - 1) % tab_count : |
104 (selected_tab_index + 1) % tab_count; | 104 (selected_tab_index + 1) % tab_count; |
(...skipping 28 matching lines...) Expand all Loading... |
133 if (NativeViewHost::kRenderNativeControlFocus) | 133 if (NativeViewHost::kRenderNativeControlFocus) |
134 View::OnPaintFocusBorder(canvas); | 134 View::OnPaintFocusBorder(canvas); |
135 } | 135 } |
136 | 136 |
137 void TabbedPane::GetAccessibleState(ui::AccessibleViewState* state) { | 137 void TabbedPane::GetAccessibleState(ui::AccessibleViewState* state) { |
138 state->role = ui::AccessibilityTypes::ROLE_PAGETABLIST; | 138 state->role = ui::AccessibilityTypes::ROLE_PAGETABLIST; |
139 state->name = accessible_name_; | 139 state->name = accessible_name_; |
140 } | 140 } |
141 | 141 |
142 } // namespace views | 142 } // namespace views |
OLD | NEW |