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

Side by Side Diff: ui/views/view.cc

Issue 1690543004: MacViews: Implement Full Keyboard Access. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address review comments. Make patch smaller temporarily. Created 4 years, 9 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 unified diff | Download patch
« ui/views/view.h ('K') | « ui/views/view.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #define _USE_MATH_DEFINES // For VC++ to get M_PI. This has to be first. 5 #define _USE_MATH_DEFINES // For VC++ to get M_PI. This has to be first.
6 6
7 #include "ui/views/view.h" 7 #include "ui/views/view.h"
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <cmath> 10 #include <cmath>
(...skipping 1183 matching lines...) Expand 10 before | Expand all | Expand 10 after
1194 View* View::GetPreviousFocusableView() { 1194 View* View::GetPreviousFocusableView() {
1195 return previous_focusable_view_; 1195 return previous_focusable_view_;
1196 } 1196 }
1197 1197
1198 void View::SetNextFocusableView(View* view) { 1198 void View::SetNextFocusableView(View* view) {
1199 if (view) 1199 if (view)
1200 view->previous_focusable_view_ = this; 1200 view->previous_focusable_view_ = this;
1201 next_focusable_view_ = view; 1201 next_focusable_view_ = view;
1202 } 1202 }
1203 1203
1204 void View::SetFocusBehavior(FocusBehavior focus_behavior) {
1205 switch (focus_behavior) {
1206 case ALWAYS:
1207 SetFocusable(true);
1208 SetAccessibilityFocusable(true);
1209 break;
1210 case NEVER:
1211 SetFocusable(false);
1212 SetAccessibilityFocusable(false);
1213 break;
1214 case ACCESSIBLE_ONLY:
1215 SetFocusable(false);
1216 SetAccessibilityFocusable(true);
1217 break;
1218 case CONTROL:
1219 #if defined(OS_MACOSX)
tapted 2016/03/15 05:05:32 This might be more readable with something like (a
karandeepb 2016/03/17 07:24:47 Done.
1220 SetFocusable(false);
1221 SetAccessibilityFocusable(true);
1222 #else
1223 SetFocusable(true);
1224 SetAccessibilityFocusable(true);
1225 #endif
1226 break;
1227 }
1228 }
1229
1204 void View::SetFocusable(bool focusable) { 1230 void View::SetFocusable(bool focusable) {
1205 if (focusable_ == focusable) 1231 if (focusable_ == focusable)
1206 return; 1232 return;
1207 1233
1208 focusable_ = focusable; 1234 focusable_ = focusable;
1209 AdvanceFocusIfNecessary(); 1235 AdvanceFocusIfNecessary();
1210 } 1236 }
1211 1237
1212 bool View::IsFocusable() const { 1238 bool View::IsFocusable() const {
1213 return focusable_ && enabled_ && IsDrawn(); 1239 return focusable_ && enabled_ && IsDrawn();
(...skipping 1214 matching lines...) Expand 10 before | Expand all | Expand 10 after
2428 // Message the RootView to do the drag and drop. That way if we're removed 2454 // Message the RootView to do the drag and drop. That way if we're removed
2429 // the RootView can detect it and avoid calling us back. 2455 // the RootView can detect it and avoid calling us back.
2430 gfx::Point widget_location(event.location()); 2456 gfx::Point widget_location(event.location());
2431 ConvertPointToWidget(this, &widget_location); 2457 ConvertPointToWidget(this, &widget_location);
2432 widget->RunShellDrag(this, data, widget_location, drag_operations, source); 2458 widget->RunShellDrag(this, data, widget_location, drag_operations, source);
2433 // WARNING: we may have been deleted. 2459 // WARNING: we may have been deleted.
2434 return true; 2460 return true;
2435 } 2461 }
2436 2462
2437 } // namespace views 2463 } // namespace views
OLDNEW
« ui/views/view.h ('K') | « ui/views/view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698