Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / ui / base / cocoa / focus_tracker.h
blob301a48f37fde4240b2a2da6790b5c189c8e2f088
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
3 // found in the LICENSE file.
5 #import <Cocoa/Cocoa.h>
7 #include "base/mac/scoped_nsobject.h"
8 #include "ui/base/ui_base_export.h"
10 // A class that handles saving and restoring focus. An instance of
11 // this class snapshots the currently focused view when it is
12 // constructed, and callers can use restoreFocus to return focus to
13 // that view. FocusTracker will not restore focus to views that are
14 // no longer in the view hierarchy or are not in the correct window.
15 UI_BASE_EXPORT
16 @interface FocusTracker : NSObject {
17 @private
18 base::scoped_nsobject<NSView> focusedView_;
21 // |window| is the window that we are saving focus for. This
22 // method snapshots the currently focused view.
23 - (id)initWithWindow:(NSWindow*)window;
25 // Attempts to restore focus to the snapshotted view. Returns YES if
26 // focus was restored. Will not restore focus if the view is no
27 // longer in the view hierarchy under |window|.
28 - (BOOL)restoreFocusInWindow:(NSWindow*)window;
29 @end