summaryrefslogtreecommitdiffstats
path: root/ui/views
diff options
context:
space:
mode:
Diffstat (limited to 'ui/views')
-rw-r--r--ui/views/bubble/bubble_delegate_unittest.cc2
-rw-r--r--ui/views/color_chooser/color_chooser_view.cc8
-rw-r--r--ui/views/controls/button/button.cc2
-rw-r--r--ui/views/controls/button/checkbox.cc2
-rw-r--r--ui/views/controls/button/custom_button.h2
-rw-r--r--ui/views/controls/button/image_button.h2
-rw-r--r--ui/views/controls/button/label_button.cc2
-rw-r--r--ui/views/controls/button/text_button.h2
-rw-r--r--ui/views/controls/combobox/combobox.cc6
-rw-r--r--ui/views/controls/label_unittest.cc10
-rw-r--r--ui/views/controls/link.cc2
-rw-r--r--ui/views/controls/native_control.cc2
-rw-r--r--ui/views/controls/scrollbar/native_scroll_bar_views.cc8
-rw-r--r--ui/views/controls/separator.cc2
-rw-r--r--ui/views/controls/slider.cc2
-rw-r--r--ui/views/controls/tabbed_pane/tabbed_pane.cc2
-rw-r--r--ui/views/controls/table/table_view.cc2
-rw-r--r--ui/views/controls/textfield/textfield.cc4
-rw-r--r--ui/views/controls/tree/tree_view.cc2
-rw-r--r--ui/views/examples/button_example.cc8
-rw-r--r--ui/views/examples/tree_view_example.cc6
-rw-r--r--ui/views/examples/widget_example.cc2
-rw-r--r--ui/views/focus/focus_manager_unittest.cc32
-rw-r--r--ui/views/focus/focus_manager_unittest_win.cc2
-rw-r--r--ui/views/focus/focus_traversal_unittest.cc12
-rw-r--r--ui/views/touchui/touch_editing_menu.cc2
-rw-r--r--ui/views/view.cc14
-rw-r--r--ui/views/view.h6
-rw-r--r--ui/views/view_unittest.cc6
-rw-r--r--ui/views/widget/widget_interactive_uitest.cc2
-rw-r--r--ui/views/widget/widget_unittest.cc8
-rw-r--r--ui/views/window/dialog_client_view.cc2
32 files changed, 89 insertions, 77 deletions
diff --git a/ui/views/bubble/bubble_delegate_unittest.cc b/ui/views/bubble/bubble_delegate_unittest.cc
index 9104900..7e2c718f 100644
--- a/ui/views/bubble/bubble_delegate_unittest.cc
+++ b/ui/views/bubble/bubble_delegate_unittest.cc
@@ -24,7 +24,7 @@ class TestBubbleDelegateView : public BubbleDelegateView {
TestBubbleDelegateView(View* anchor_view)
: BubbleDelegateView(anchor_view, BubbleBorder::TOP_LEFT),
view_(new View()) {
- view_->set_focusable(true);
+ view_->SetFocusable(true);
AddChildView(view_);
}
virtual ~TestBubbleDelegateView() {}
diff --git a/ui/views/color_chooser/color_chooser_view.cc b/ui/views/color_chooser/color_chooser_view.cc
index 1ccc12b..3c649f9 100644
--- a/ui/views/color_chooser/color_chooser_view.cc
+++ b/ui/views/color_chooser/color_chooser_view.cc
@@ -137,7 +137,7 @@ class ColorChooserView::HueView : public LocatedEventHandlerView {
ColorChooserView::HueView::HueView(ColorChooserView* chooser_view)
: chooser_view_(chooser_view),
level_(0) {
- set_focusable(false);
+ SetFocusable(false);
}
void ColorChooserView::HueView::OnHueChanged(SkScalar hue) {
@@ -251,7 +251,7 @@ ColorChooserView::SaturationValueView::SaturationValueView(
ColorChooserView* chooser_view)
: chooser_view_(chooser_view),
hue_(0) {
- set_focusable(false);
+ SetFocusable(false);
set_border(Border::CreateSolidBorder(kBorderWidth, SK_ColorGRAY));
}
@@ -346,7 +346,7 @@ class ColorChooserView::SelectedColorPatchView : public views::View {
};
ColorChooserView::SelectedColorPatchView::SelectedColorPatchView() {
- set_focusable(false);
+ SetFocusable(false);
SetVisible(true);
set_border(Border::CreateSolidBorder(kBorderWidth, SK_ColorGRAY));
}
@@ -368,7 +368,7 @@ ColorChooserView::ColorChooserView(ColorChooserListener* listener,
: listener_(listener) {
DCHECK(listener_);
- set_focusable(false);
+ SetFocusable(false);
set_background(Background::CreateSolidBackground(SK_ColorLTGRAY));
SetLayoutManager(new BoxLayout(BoxLayout::kVertical, kMarginWidth,
kMarginWidth, kMarginWidth));
diff --git a/ui/views/controls/button/button.cc b/ui/views/controls/button/button.cc
index eccec03..96e2e27 100644
--- a/ui/views/controls/button/button.cc
+++ b/ui/views/controls/button/button.cc
@@ -48,7 +48,7 @@ void Button::GetAccessibleState(ui::AccessibleViewState* state) {
Button::Button(ButtonListener* listener)
: listener_(listener),
tag_(-1) {
- set_accessibility_focusable(true);
+ SetAccessibilityFocusable(true);
}
void Button::NotifyClick(const ui::Event& event) {
diff --git a/ui/views/controls/button/checkbox.cc b/ui/views/controls/button/checkbox.cc
index ae263e3..ec33a47 100644
--- a/ui/views/controls/button/checkbox.cc
+++ b/ui/views/controls/button/checkbox.cc
@@ -24,7 +24,7 @@ Checkbox::Checkbox(const string16& label)
button_border->SetPainter(false, STATE_PRESSED, NULL);
// Inset the trailing side by a couple pixels for the focus border.
button_border->set_insets(gfx::Insets(0, 0, 0, 2));
- set_focusable(true);
+ SetFocusable(true);
ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
diff --git a/ui/views/controls/button/custom_button.h b/ui/views/controls/button/custom_button.h
index c769d1b..9ac502d 100644
--- a/ui/views/controls/button/custom_button.h
+++ b/ui/views/controls/button/custom_button.h
@@ -21,7 +21,7 @@ class CustomButtonStateChangedDelegate;
// A button with custom rendering. The common base class of ImageButton and
// TextButton.
// Note that this type of button is not focusable by default and will not be
-// part of the focus chain. Call set_focusable(true) to make it part of the
+// part of the focus chain. Call SetFocusable(true) to make it part of the
// focus chain.
class VIEWS_EXPORT CustomButton : public Button,
public gfx::AnimationDelegate {
diff --git a/ui/views/controls/button/image_button.h b/ui/views/controls/button/image_button.h
index d74eceb..4977b06 100644
--- a/ui/views/controls/button/image_button.h
+++ b/ui/views/controls/button/image_button.h
@@ -18,7 +18,7 @@ class Painter;
// An image button.
// Note that this type of button is not focusable by default and will not be
-// part of the focus chain. Call set_focusable(true) to make it part of the
+// part of the focus chain. Call SetFocusable(true) to make it part of the
// focus chain.
class VIEWS_EXPORT ImageButton : public CustomButton {
diff --git a/ui/views/controls/button/label_button.cc b/ui/views/controls/button/label_button.cc
index 58e3fe6..30db5d1 100644
--- a/ui/views/controls/button/label_button.cc
+++ b/ui/views/controls/button/label_button.cc
@@ -154,7 +154,7 @@ void LabelButton::SetStyle(ButtonStyle style) {
}
if (style == STYLE_BUTTON || style == STYLE_NATIVE_TEXTBUTTON) {
label_->SetHorizontalAlignment(gfx::ALIGN_CENTER);
- set_focusable(true);
+ SetFocusable(true);
}
if (style == STYLE_BUTTON)
set_min_size(gfx::Size(70, 33));
diff --git a/ui/views/controls/button/text_button.h b/ui/views/controls/button/text_button.h
index 18d2ba2..4dc6157 100644
--- a/ui/views/controls/button/text_button.h
+++ b/ui/views/controls/button/text_button.h
@@ -49,7 +49,7 @@ class VIEWS_EXPORT TextButtonBorder : public Border {
// the button frame in the hot/pushed states.
//
// Note that this type of button is not focusable by default and will not be
-// part of the focus chain. Call set_focusable(true) to make it part of the
+// part of the focus chain. Call SetFocusable(true) to make it part of the
// focus chain.
class VIEWS_EXPORT TextButtonDefaultBorder : public TextButtonBorder {
public:
diff --git a/ui/views/controls/combobox/combobox.cc b/ui/views/controls/combobox/combobox.cc
index e366442..ce8d93a 100644
--- a/ui/views/controls/combobox/combobox.cc
+++ b/ui/views/controls/combobox/combobox.cc
@@ -249,7 +249,7 @@ Combobox::Combobox(ui::ComboboxModel* model)
arrow_button_(new TransparentButton(this)) {
model_->AddObserver(this);
UpdateFromModel();
- set_focusable(true);
+ SetFocusable(true);
UpdateBorder();
// Initialize the button images.
@@ -274,8 +274,8 @@ Combobox::Combobox(ui::ComboboxModel* model)
text_button_->SetVisible(true);
arrow_button_->SetVisible(true);
- text_button_->set_focusable(false);
- arrow_button_->set_focusable(false);
+ text_button_->SetFocusable(false);
+ arrow_button_->SetFocusable(false);
AddChildView(text_button_);
AddChildView(arrow_button_);
}
diff --git a/ui/views/controls/label_unittest.cc b/ui/views/controls/label_unittest.cc
index c36b5de..e2a37c3 100644
--- a/ui/views/controls/label_unittest.cc
+++ b/ui/views/controls/label_unittest.cc
@@ -201,7 +201,7 @@ TEST(LabelTest, MultilineSmallAvailableWidthSizing) {
TEST(LabelTest, MultiLineSizing) {
Label label;
- label.set_focusable(false);
+ label.SetFocusable(false);
string16 test_text(
ASCIIToUTF16("A random string\nwith multiple lines\nand returns!"));
label.SetText(test_text);
@@ -322,7 +322,7 @@ TEST(LabelTest, AutoDetectDirectionality) {
TEST(LabelTest, DrawSingleLineString) {
Label label;
- label.set_focusable(false);
+ label.SetFocusable(false);
// Turn off mirroring so that we don't need to figure out if
// align right really means align left.
@@ -458,7 +458,7 @@ TEST(LabelTest, DrawSingleLineString) {
// multiline lables to not ellide in Linux only.
TEST(LabelTest, DrawMultiLineString) {
Label label;
- label.set_focusable(false);
+ label.SetFocusable(false);
// Turn off mirroring so that we don't need to figure out if
// align right really means align left.
@@ -599,7 +599,7 @@ TEST(LabelTest, DrawMultiLineString) {
TEST(LabelTest, DrawSingleLineStringInRTL) {
Label label;
- label.set_focusable(false);
+ label.SetFocusable(false);
std::string locale = l10n_util::GetApplicationLocale("");
base::i18n::SetICUDefaultLocale("he");
@@ -738,7 +738,7 @@ TEST(LabelTest, DrawSingleLineStringInRTL) {
// multiline lables to not ellide in Linux only.
TEST(LabelTest, DrawMultiLineStringInRTL) {
Label label;
- label.set_focusable(false);
+ label.SetFocusable(false);
// Test for RTL.
std::string locale = l10n_util::GetApplicationLocale("");
diff --git a/ui/views/controls/link.cc b/ui/views/controls/link.cc
index 5a5729a..d02a0b8 100644
--- a/ui/views/controls/link.cc
+++ b/ui/views/controls/link.cc
@@ -205,7 +205,7 @@ void Link::Init() {
SetPressedColor(SK_ColorRED);
#endif
RecalculateFont();
- set_focusable(true);
+ SetFocusable(true);
}
void Link::SetPressed(bool pressed) {
diff --git a/ui/views/controls/native_control.cc b/ui/views/controls/native_control.cc
index 3a1fe58..faebbc8 100644
--- a/ui/views/controls/native_control.cc
+++ b/ui/views/controls/native_control.cc
@@ -177,7 +177,7 @@ NativeControl::NativeControl() : hwnd_view_(NULL),
horizontal_alignment_(CENTER),
fixed_height_(-1),
vertical_alignment_(CENTER) {
- set_focusable(true);
+ SetFocusable(true);
}
NativeControl::~NativeControl() {
diff --git a/ui/views/controls/scrollbar/native_scroll_bar_views.cc b/ui/views/controls/scrollbar/native_scroll_bar_views.cc
index 6c3506f..a8402e5 100644
--- a/ui/views/controls/scrollbar/native_scroll_bar_views.cc
+++ b/ui/views/controls/scrollbar/native_scroll_bar_views.cc
@@ -76,8 +76,8 @@ class ScrollBarThumb : public BaseScrollBarThumb {
ScrollBarButton::ScrollBarButton(ButtonListener* listener, Type type)
: BaseScrollBarButton(listener),
type_(type) {
- set_focusable(false);
- set_accessibility_focusable(false);
+ SetFocusable(false);
+ SetAccessibilityFocusable(false);
}
ScrollBarButton::~ScrollBarButton() {
@@ -157,8 +157,8 @@ ui::NativeTheme::State
ScrollBarThumb::ScrollBarThumb(BaseScrollBar* scroll_bar)
: BaseScrollBarThumb(scroll_bar),
scroll_bar_(scroll_bar) {
- set_focusable(false);
- set_accessibility_focusable(false);
+ SetFocusable(false);
+ SetAccessibilityFocusable(false);
}
ScrollBarThumb::~ScrollBarThumb() {
diff --git a/ui/views/controls/separator.cc b/ui/views/controls/separator.cc
index f8ce470..bbac3ed 100644
--- a/ui/views/controls/separator.cc
+++ b/ui/views/controls/separator.cc
@@ -19,7 +19,7 @@ const int kSeparatorHeight = 1;
const SkColor kDefaultColor = SkColorSetARGB(255, 233, 233, 233);
Separator::Separator(Orientation orientation) : orientation_(orientation) {
- set_focusable(false);
+ SetFocusable(false);
}
Separator::~Separator() {
diff --git a/ui/views/controls/slider.cc b/ui/views/controls/slider.cc
index 242ff5e..4be6f5a 100644
--- a/ui/views/controls/slider.cc
+++ b/ui/views/controls/slider.cc
@@ -61,7 +61,7 @@ Slider::Slider(SliderListener* listener, Orientation orientation)
bar_active_images_(kBarImagesActive),
bar_disabled_images_(kBarImagesDisabled) {
EnableCanvasFlippingForRTLUI(true);
- set_focusable(true);
+ SetFocusable(true);
UpdateState(true);
}
diff --git a/ui/views/controls/tabbed_pane/tabbed_pane.cc b/ui/views/controls/tabbed_pane/tabbed_pane.cc
index aa46af6..3f2d5da9 100644
--- a/ui/views/controls/tabbed_pane/tabbed_pane.cc
+++ b/ui/views/controls/tabbed_pane/tabbed_pane.cc
@@ -238,7 +238,7 @@ TabbedPane::TabbedPane()
tab_strip_(new TabStrip(this)),
contents_(new View()),
selected_tab_index_(-1) {
- set_focusable(true);
+ SetFocusable(true);
AddChildView(tab_strip_);
AddChildView(contents_);
}
diff --git a/ui/views/controls/table/table_view.cc b/ui/views/controls/table/table_view.cc
index cf9c0ff..8a27a1f 100644
--- a/ui/views/controls/table/table_view.cc
+++ b/ui/views/controls/table/table_view.cc
@@ -134,7 +134,7 @@ TableView::TableView(ui::TableModel* model,
visible_column.column = columns[i];
visible_columns_.push_back(visible_column);
}
- set_focusable(true);
+ SetFocusable(true);
SetModel(model);
}
diff --git a/ui/views/controls/textfield/textfield.cc b/ui/views/controls/textfield/textfield.cc
index 04003ba..de590dc 100644
--- a/ui/views/controls/textfield/textfield.cc
+++ b/ui/views/controls/textfield/textfield.cc
@@ -72,7 +72,7 @@ Textfield::Textfield()
placeholder_text_color_(kDefaultPlaceholderTextColor),
text_input_type_(ui::TEXT_INPUT_TYPE_TEXT),
weak_ptr_factory_(this) {
- set_focusable(true);
+ SetFocusable(true);
if (ViewsDelegate::views_delegate) {
obscured_reveal_duration_ = ViewsDelegate::views_delegate->
@@ -100,7 +100,7 @@ Textfield::Textfield(StyleFlags style)
placeholder_text_color_(kDefaultPlaceholderTextColor),
text_input_type_(ui::TEXT_INPUT_TYPE_TEXT),
weak_ptr_factory_(this) {
- set_focusable(true);
+ SetFocusable(true);
if (IsObscured())
SetTextInputType(ui::TEXT_INPUT_TYPE_PASSWORD);
diff --git a/ui/views/controls/tree/tree_view.cc b/ui/views/controls/tree/tree_view.cc
index 055b9b9..2c7bd55 100644
--- a/ui/views/controls/tree/tree_view.cc
+++ b/ui/views/controls/tree/tree_view.cc
@@ -80,7 +80,7 @@ TreeView::TreeView()
root_shown_(true),
has_custom_icons_(false),
row_height_(font_.GetHeight() + kTextVerticalPadding * 2) {
- set_focusable(true);
+ SetFocusable(true);
closed_icon_ = *ui::ResourceBundle::GetSharedInstance().GetImageNamed(
(base::i18n::IsRTL() ? IDR_FOLDER_CLOSED_RTL
: IDR_FOLDER_CLOSED)).ToImageSkia();
diff --git a/ui/views/examples/button_example.cc b/ui/views/examples/button_example.cc
index 1bff590..a791559 100644
--- a/ui/views/examples/button_example.cc
+++ b/ui/views/examples/button_example.cc
@@ -49,11 +49,11 @@ void ButtonExample::CreateExampleView(View* container) {
container->SetLayoutManager(new BoxLayout(BoxLayout::kVertical, 10, 10, 10));
text_button_ = new TextButton(this, ASCIIToUTF16(kTextButton));
- text_button_->set_focusable(true);
+ text_button_->SetFocusable(true);
container->AddChildView(text_button_);
label_button_ = new LabelButton(this, ASCIIToUTF16(kLabelButton));
- label_button_->set_focusable(true);
+ label_button_->SetFocusable(true);
container->AddChildView(label_button_);
LabelButton* disabled_button =
@@ -66,7 +66,7 @@ void ButtonExample::CreateExampleView(View* container) {
ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
image_button_ = new ImageButton(this);
- image_button_->set_focusable(true);
+ image_button_->SetFocusable(true);
image_button_->SetImage(ImageButton::STATE_NORMAL,
rb.GetImageNamed(IDR_CLOSE).ToImageSkia());
image_button_->SetImage(ImageButton::STATE_HOVERED,
@@ -161,7 +161,7 @@ void ButtonExample::LabelButtonPressed(const ui::Event& event) {
}
} else if (event.IsShiftDown()) {
if (event.IsAltDown()) {
- label_button_->set_focusable(!label_button_->focusable());
+ label_button_->SetFocusable(!label_button_->focusable());
} else {
label_button_->SetStyle(static_cast<Button::ButtonStyle>(
(label_button_->style() + 1) % Button::STYLE_COUNT));
diff --git a/ui/views/examples/tree_view_example.cc b/ui/views/examples/tree_view_example.cc
index a7a51cb..6dfc558 100644
--- a/ui/views/examples/tree_view_example.cc
+++ b/ui/views/examples/tree_view_example.cc
@@ -45,11 +45,11 @@ void TreeViewExample::CreateExampleView(View* container) {
tree_view_->SetModel(&model_);
tree_view_->SetController(this);
add_ = new LabelButton(this, ASCIIToUTF16("Add"));
- add_->set_focusable(true);
+ add_->SetFocusable(true);
remove_ = new LabelButton(this, ASCIIToUTF16("Remove"));
- remove_->set_focusable(true);
+ remove_->SetFocusable(true);
change_title_ = new LabelButton(this, ASCIIToUTF16("Change Title"));
- change_title_->set_focusable(true);
+ change_title_->SetFocusable(true);
GridLayout* layout = new GridLayout(container);
container->SetLayoutManager(layout);
diff --git a/ui/views/examples/widget_example.cc b/ui/views/examples/widget_example.cc
index 3722ba0..0d42a65 100644
--- a/ui/views/examples/widget_example.cc
+++ b/ui/views/examples/widget_example.cc
@@ -78,7 +78,7 @@ void WidgetExample::BuildButton(View* container,
const std::string& label,
int tag) {
LabelButton* button = new LabelButton(this, ASCIIToUTF16(label));
- button->set_focusable(true);
+ button->SetFocusable(true);
button->set_tag(tag);
container->AddChildView(button);
}
diff --git a/ui/views/focus/focus_manager_unittest.cc b/ui/views/focus/focus_manager_unittest.cc
index a2c9d48..fcb82b7 100644
--- a/ui/views/focus/focus_manager_unittest.cc
+++ b/ui/views/focus/focus_manager_unittest.cc
@@ -53,7 +53,7 @@ class SimpleTestView : public View {
public:
SimpleTestView(std::vector<FocusTestEvent>* event_list, int view_id)
: event_list_(event_list) {
- set_focusable(true);
+ SetFocusable(true);
set_id(view_id);
}
@@ -103,9 +103,9 @@ TEST_F(FocusManagerTest, ViewFocusCallbacks) {
TEST_F(FocusManagerTest, FocusChangeListener) {
View* view1 = new View();
- view1->set_focusable(true);
+ view1->SetFocusable(true);
View* view2 = new View();
- view2->set_focusable(true);
+ view2->SetFocusable(true);
GetContentsView()->AddChildView(view1);
GetContentsView()->AddChildView(view2);
@@ -630,17 +630,17 @@ TEST_F(FocusManagerTest, FocusInAboutToRequestFocusFromTabTraversal) {
// Create 3 views focuses the 3 and advances to the second. The 2nd views
// implementation of AboutToRequestFocusFromTabTraversal() focuses the first.
views::View* v1 = new View;
- v1->set_focusable(true);
+ v1->SetFocusable(true);
GetContentsView()->AddChildView(v1);
FocusInAboutToRequestFocusFromTabTraversalView* v2 =
new FocusInAboutToRequestFocusFromTabTraversalView;
- v2->set_focusable(true);
+ v2->SetFocusable(true);
v2->set_view_to_focus(v1);
GetContentsView()->AddChildView(v2);
views::View* v3 = new View;
- v3->set_focusable(true);
+ v3->SetFocusable(true);
GetContentsView()->AddChildView(v3);
v3->RequestFocus();
@@ -653,22 +653,22 @@ TEST_F(FocusManagerTest, RotatePaneFocus) {
GetContentsView()->AddChildView(pane1);
views::View* v1 = new View;
- v1->set_focusable(true);
+ v1->SetFocusable(true);
pane1->AddChildView(v1);
views::View* v2 = new View;
- v2->set_focusable(true);
+ v2->SetFocusable(true);
pane1->AddChildView(v2);
views::AccessiblePaneView* pane2 = new AccessiblePaneView();
GetContentsView()->AddChildView(pane2);
views::View* v3 = new View;
- v3->set_focusable(true);
+ v3->SetFocusable(true);
pane2->AddChildView(v3);
views::View* v4 = new View;
- v4->set_focusable(true);
+ v4->SetFocusable(true);
pane2->AddChildView(v4);
std::vector<views::View*> panes;
@@ -723,11 +723,11 @@ TEST_F(FocusManagerTest, RotatePaneFocus) {
// Verifies the stored focus view tracks the focused view.
TEST_F(FocusManagerTest, ImplicitlyStoresFocus) {
views::View* v1 = new View;
- v1->set_focusable(true);
+ v1->SetFocusable(true);
GetContentsView()->AddChildView(v1);
views::View* v2 = new View;
- v2->set_focusable(true);
+ v2->SetFocusable(true);
GetContentsView()->AddChildView(v2);
// Verify a focus request on |v1| implicitly updates the stored focus view.
@@ -785,7 +785,7 @@ TEST_F(FocusManagerArrowKeyTraversalTest, ArrowKeyTraversal) {
std::vector<views::View*> v;
for (size_t i = 0; i < 2; ++i) {
views::View* view = new View;
- view->set_focusable(true);
+ view->SetFocusable(true);
GetContentsView()->AddChildView(view);
v.push_back(view);
}
@@ -864,7 +864,7 @@ class AdvanceFocusWidgetDelegate : public WidgetDelegate {
TEST_F(FocusManagerTest, AdvanceFocusStaysInWidget) {
// Add |widget_view| as a child of the Widget.
View* widget_view = new View;
- widget_view->set_focusable(true);
+ widget_view->SetFocusable(true);
widget_view->SetBounds(20, 0, 20, 20);
GetContentsView()->AddChildView(widget_view);
@@ -880,10 +880,10 @@ TEST_F(FocusManagerTest, AdvanceFocusStaysInWidget) {
params.delegate = delegate.get();
child_widget.Init(params);
View* view1 = new View;
- view1->set_focusable(true);
+ view1->SetFocusable(true);
view1->SetBounds(0, 0, 20, 20);
View* view2 = new View;
- view2->set_focusable(true);
+ view2->SetFocusable(true);
view2->SetBounds(20, 0, 20, 20);
child_widget.client_view()->AddChildView(view1);
child_widget.client_view()->AddChildView(view2);
diff --git a/ui/views/focus/focus_manager_unittest_win.cc b/ui/views/focus/focus_manager_unittest_win.cc
index 1309ed2..267a8b7 100644
--- a/ui/views/focus/focus_manager_unittest_win.cc
+++ b/ui/views/focus/focus_manager_unittest_win.cc
@@ -73,7 +73,7 @@ TEST_F(FocusManagerTest, FocusStoreRestore) {
LabelButton* button = new LabelButton(NULL, ASCIIToUTF16("Press me"));
button->SetStyle(Button::STYLE_NATIVE_TEXTBUTTON);
View* view = new View();
- view->set_focusable(true);
+ view->SetFocusable(true);
GetContentsView()->AddChildView(button);
button->SetBounds(10, 10, 200, 30);
diff --git a/ui/views/focus/focus_traversal_unittest.cc b/ui/views/focus/focus_traversal_unittest.cc
index 03bf165..c3e8159 100644
--- a/ui/views/focus/focus_traversal_unittest.cc
+++ b/ui/views/focus/focus_traversal_unittest.cc
@@ -136,7 +136,7 @@ class BorderView : public NativeViewHost {
public:
explicit BorderView(View* child) : child_(child), widget_(NULL) {
DCHECK(child);
- set_focusable(false);
+ SetFocusable(false);
}
virtual ~BorderView() {}
@@ -545,7 +545,7 @@ void FocusTraversalTest::InitContentView() {
y += 60;
contents = new View();
- contents->set_focusable(true);
+ contents->SetFocusable(true);
contents->set_background(Background::CreateSolidBackground(SK_ColorBLUE));
contents->set_id(kThumbnailContainerID);
button = new LabelButton(NULL, ASCIIToUTF16("Star"));
@@ -758,10 +758,10 @@ TEST_F(FocusTraversalTest, PaneTraversal) {
FocusSearch focus_search_right(right_container_, true, true);
right_container_->EnablePaneFocus(&focus_search_right);
- FindViewByID(kRosettaLinkID)->set_focusable(false);
- FindViewByID(kStupeurEtTremblementLinkID)->set_focusable(false);
- FindViewByID(kDinerGameLinkID)->set_accessibility_focusable(true);
- FindViewByID(kDinerGameLinkID)->set_focusable(false);
+ FindViewByID(kRosettaLinkID)->SetFocusable(false);
+ FindViewByID(kStupeurEtTremblementLinkID)->SetFocusable(false);
+ FindViewByID(kDinerGameLinkID)->SetAccessibilityFocusable(true);
+ FindViewByID(kDinerGameLinkID)->SetFocusable(false);
FindViewByID(kAsterixLinkID)->RequestFocus();
// Traverse the focus hierarchy within the pane several times.
diff --git a/ui/views/touchui/touch_editing_menu.cc b/ui/views/touchui/touch_editing_menu.cc
index bd0efb1..dec9113 100644
--- a/ui/views/touchui/touch_editing_menu.cc
+++ b/ui/views/touchui/touch_editing_menu.cc
@@ -128,7 +128,7 @@ void TouchEditingMenuView::CreateButtons() {
Button* TouchEditingMenuView::CreateButton(const string16& title, int tag) {
string16 label = gfx::RemoveAcceleratorChar(title, '&', NULL, NULL);
LabelButton* button = new LabelButton(this, label);
- button->set_focusable(true);
+ button->SetFocusable(true);
button->set_request_focus_on_press(false);
gfx::Font font = ui::ResourceBundle::GetSharedInstance().GetFont(
ui::ResourceBundle::SmallFont);
diff --git a/ui/views/view.cc b/ui/views/view.cc
index ee4ed58..0cec760 100644
--- a/ui/views/view.cc
+++ b/ui/views/view.cc
@@ -1200,6 +1200,13 @@ void View::SetNextFocusableView(View* view) {
next_focusable_view_ = view;
}
+void View::SetFocusable(bool focusable) {
+ if (focusable_ == focusable)
+ return;
+
+ focusable_ = focusable;
+}
+
bool View::IsFocusable() const {
return focusable_ && enabled_ && IsDrawn();
}
@@ -1208,6 +1215,13 @@ bool View::IsAccessibilityFocusable() const {
return (focusable_ || accessibility_focusable_) && enabled_ && IsDrawn();
}
+void View::SetAccessibilityFocusable(bool accessibility_focusable) {
+ if (accessibility_focusable_ == accessibility_focusable)
+ return;
+
+ accessibility_focusable_ = accessibility_focusable;
+}
+
FocusManager* View::GetFocusManager() {
Widget* widget = GetWidget();
return widget ? widget->GetFocusManager() : NULL;
diff --git a/ui/views/view.h b/ui/views/view.h
index e391dbe..848d847 100644
--- a/ui/views/view.h
+++ b/ui/views/view.h
@@ -770,7 +770,7 @@ class VIEWS_EXPORT View : public ui::LayerDelegate,
// Sets whether this view is capable of taking focus.
// Note that this is false by default so that a view used as a container does
// not get the focus.
- void set_focusable(bool focusable) { focusable_ = focusable; }
+ void SetFocusable(bool focusable);
// Returns true if this view is capable of taking focus.
bool focusable() const { return focusable_ && enabled_ && visible_; }
@@ -785,9 +785,7 @@ class VIEWS_EXPORT View : public ui::LayerDelegate,
// Set whether this view can be made focusable if the user requires
// full keyboard access, even though it's not normally focusable.
// Note that this is false by default.
- void set_accessibility_focusable(bool accessibility_focusable) {
- accessibility_focusable_ = accessibility_focusable;
- }
+ void SetAccessibilityFocusable(bool accessibility_focusable);
// Convenience method to retrieve the FocusManager associated with the
// Widget that contains this view. This can return NULL if this view is not
diff --git a/ui/views/view_unittest.cc b/ui/views/view_unittest.cc
index e680160..1597f5d 100644
--- a/ui/views/view_unittest.cc
+++ b/ui/views/view_unittest.cc
@@ -2796,9 +2796,9 @@ TEST_F(ViewTest, ReorderChildren) {
child->AddChildView(foo2);
View* foo3 = new View();
child->AddChildView(foo3);
- foo1->set_focusable(true);
- foo2->set_focusable(true);
- foo3->set_focusable(true);
+ foo1->SetFocusable(true);
+ foo2->SetFocusable(true);
+ foo3->SetFocusable(true);
ASSERT_EQ(0, child->GetIndexOf(foo1));
ASSERT_EQ(1, child->GetIndexOf(foo2));
diff --git a/ui/views/widget/widget_interactive_uitest.cc b/ui/views/widget/widget_interactive_uitest.cc
index 889ee6b..30d44a3 100644
--- a/ui/views/widget/widget_interactive_uitest.cc
+++ b/ui/views/widget/widget_interactive_uitest.cc
@@ -162,7 +162,7 @@ class NestedLoopCaptureView : public View {
TEST_F(WidgetTest, DesktopNativeWidgetAuraActivationAndFocusTest) {
// Create widget 1 and expect the active window to be its window.
View* contents_view1 = new View;
- contents_view1->set_focusable(true);
+ contents_view1->SetFocusable(true);
Widget widget1;
Widget::InitParams init_params =
CreateParams(Widget::InitParams::TYPE_WINDOW_FRAMELESS);
diff --git a/ui/views/widget/widget_unittest.cc b/ui/views/widget/widget_unittest.cc
index cb29c4e..51b444f 100644
--- a/ui/views/widget/widget_unittest.cc
+++ b/ui/views/widget/widget_unittest.cc
@@ -951,7 +951,7 @@ TEST_F(WidgetTest, KeyboardInputEvent) {
TEST_F(WidgetTest, DISABLED_FocusChangesOnBubble) {
// Create a widget, show and activate it and focus the contents view.
View* contents_view = new View;
- contents_view->set_focusable(true);
+ contents_view->SetFocusable(true);
Widget widget;
Widget::InitParams init_params =
CreateParams(Widget::InitParams::TYPE_WINDOW_FRAMELESS);
@@ -970,7 +970,7 @@ TEST_F(WidgetTest, DISABLED_FocusChangesOnBubble) {
// Show a bubble.
BubbleDelegateView* bubble_delegate_view =
new BubbleDelegateView(contents_view, BubbleBorder::TOP_LEFT);
- bubble_delegate_view->set_focusable(true);
+ bubble_delegate_view->SetFocusable(true);
BubbleDelegateView::CreateBubble(bubble_delegate_view)->Show();
bubble_delegate_view->RequestFocus();
@@ -1052,7 +1052,7 @@ class DesktopAuraTestValidPaintWidget : public views::Widget {
TEST_F(WidgetTest, DesktopNativeWidgetAuraNoPaintAfterCloseTest) {
View* contents_view = new View;
- contents_view->set_focusable(true);
+ contents_view->SetFocusable(true);
DesktopAuraTestValidPaintWidget widget;
Widget::InitParams init_params =
CreateParams(Widget::InitParams::TYPE_WINDOW_FRAMELESS);
@@ -1072,7 +1072,7 @@ TEST_F(WidgetTest, DesktopNativeWidgetAuraNoPaintAfterCloseTest) {
TEST_F(WidgetTest, DesktopNativeWidgetAuraNoPaintAfterHideTest) {
View* contents_view = new View;
- contents_view->set_focusable(true);
+ contents_view->SetFocusable(true);
DesktopAuraTestValidPaintWidget widget;
Widget::InitParams init_params =
CreateParams(Widget::InitParams::TYPE_WINDOW_FRAMELESS);
diff --git a/ui/views/window/dialog_client_view.cc b/ui/views/window/dialog_client_view.cc
index eb83230..bfb870e 100644
--- a/ui/views/window/dialog_client_view.cc
+++ b/ui/views/window/dialog_client_view.cc
@@ -369,7 +369,7 @@ LabelButton* DialogClientView::CreateDialogButton(ui::DialogButton type) {
button = new LabelButton(this, title);
button->SetStyle(Button::STYLE_NATIVE_TEXTBUTTON);
}
- button->set_focusable(true);
+ button->SetFocusable(true);
const int kDialogMinButtonWidth = 75;
button->set_min_size(gfx::Size(kDialogMinButtonWidth, 0));