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

Unified Diff: chrome/browser/cocoa/focus_tracker.mm

Issue 201116: Reverting 26214. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 11 years, 3 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 | « chrome/browser/cocoa/focus_tracker.h ('k') | chrome/browser/cocoa/focus_tracker_unittest.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/cocoa/focus_tracker.mm
===================================================================
--- chrome/browser/cocoa/focus_tracker.mm (revision 26217)
+++ chrome/browser/cocoa/focus_tracker.mm (working copy)
@@ -1,46 +0,0 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#import "chrome/browser/cocoa/focus_tracker.h"
-
-#include "base/logging.h"
-
-@implementation FocusTracker
-
-- (id)initWithWindow:(NSWindow*)window {
- if ((self = [super init])) {
- NSResponder* current_focus = [window firstResponder];
-
- // Special case NSTextViews, because they are removed from the
- // view hierarchy when their text field does not have focus. If
- // an NSTextView is the current first responder, save a pointer to
- // its NSTextField delegate instead.
- if ([current_focus isKindOfClass:[NSTextView class]]) {
- id delegate = [(NSTextView*)current_focus delegate];
- if ([delegate isKindOfClass:[NSTextField class]])
- current_focus = delegate;
- else
- current_focus = nil;
- }
-
- if ([current_focus isKindOfClass:[NSView class]]) {
- NSView* current_focus_view = (NSView*)current_focus;
- focusedView_.reset([current_focus_view retain]);
- }
- }
-
- return self;
-}
-
-- (BOOL)restoreFocusInWindow:(NSWindow*)window {
- if (!focusedView_.get())
- return NO;
-
- if ([focusedView_ window] && [focusedView_ window] == window)
- return [window makeFirstResponder:focusedView_.get()];
-
- return NO;
-}
-
-@end
« no previous file with comments | « chrome/browser/cocoa/focus_tracker.h ('k') | chrome/browser/cocoa/focus_tracker_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698