When Retrier succeeds, record errors it encountered.
[chromium-blink-merge.git] / ui / base / cocoa / focus_tracker.h
blob82165c7efef65461113e5f15e89fb6c791570505
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/memory/scoped_nsobject.h"
8 #include "ui/base/ui_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_EXPORT
16 @interface FocusTracker : NSObject {
17 @private
18 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