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

Side by Side Diff: ui/base/test/scoped_fake_full_keyboard_access.h

Issue 1894383002: MacViews: Implement Full Keyboard Access. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@SetFocusBehavior
Patch Set: Address review comments. Created 4 years, 7 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
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef UI_BASE_TEST_SCOPED_FAKE_FULL_KEYBOARD_ACCESS_H_
6 #define UI_BASE_TEST_SCOPED_FAKE_FULL_KEYBOARD_ACCESS_H_
7
8 #include <memory>
9
10 #include "base/macros.h"
11
12 namespace base {
13 namespace mac {
14 class ScopedObjCClassSwizzler;
15 }
16 }
17
18 namespace ui {
19 namespace test {
20
21 // A singleton class which swizzles [NSApp isFullKeyboardAccessEnabled] so
22 // that it returns the value set using SetFullKeyboardAccessState.
23 class ScopedFakeFullKeyboardAccess {
24 public:
25 ScopedFakeFullKeyboardAccess();
26 ~ScopedFakeFullKeyboardAccess();
27
28 // Returns the ScopedFakeFullKeyboardAccess singleton or null if one hasn't
29 // been created yet.
30 static ScopedFakeFullKeyboardAccess* GetInstance();
31
32 // Set the value to be returned by [NSApp isFullKeyboardAccessEnabled].
33 void SetFullKeyboardAccessState(bool new_state);
34
35 private:
36 std::unique_ptr<base::mac::ScopedObjCClassSwizzler> swizzler_;
37
38 DISALLOW_COPY_AND_ASSIGN(ScopedFakeFullKeyboardAccess);
39 };
40
41 } // namespace test
42 } // namespace ui
43
44 #endif // UI_BASE_TEST_SCOPED_FAKE_FULL_KEYBOARD_ACCESS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698