Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(413)

Unified Diff: ui/views/view.cc

Issue 1898633004: Views: Add new SetFocusBehavior method. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased. Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/views/view.h ('k') | ui/views/view_targeter_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/view.cc
diff --git a/ui/views/view.cc b/ui/views/view.cc
index 391abaced2076fb90c88d62a7bbd0ec45feabc8f..8127f797aebbc81ba1f44621b5a15876f599154e 100644
--- a/ui/views/view.cc
+++ b/ui/views/view.cc
@@ -115,8 +115,7 @@ View::View()
registered_accelerator_count_(0),
next_focusable_view_(NULL),
previous_focusable_view_(NULL),
- focusable_(false),
- accessibility_focusable_(false),
+ focus_behavior_(FocusBehavior::NEVER),
context_menu_controller_(NULL),
drag_controller_(NULL),
native_view_accessibility_(NULL) {
@@ -1199,28 +1198,20 @@ void View::SetNextFocusableView(View* view) {
next_focusable_view_ = view;
}
-void View::SetFocusable(bool focusable) {
- if (focusable_ == focusable)
+void View::SetFocusBehavior(FocusBehavior focus_behavior) {
+ if (focus_behavior_ == focus_behavior)
return;
- focusable_ = focusable;
+ focus_behavior_ = focus_behavior;
AdvanceFocusIfNecessary();
}
bool View::IsFocusable() const {
- return focusable_ && enabled_ && IsDrawn();
+ return focus_behavior_ == FocusBehavior::ALWAYS && enabled_ && IsDrawn();
}
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;
- AdvanceFocusIfNecessary();
+ return focus_behavior_ != FocusBehavior::NEVER && enabled_ && IsDrawn();
}
FocusManager* View::GetFocusManager() {
« no previous file with comments | « ui/views/view.h ('k') | ui/views/view_targeter_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698