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

Side by Side Diff: chrome/browser/cocoa/tab_contents_controller.mm

Issue 402091: Fix tab focus/blur events on tab switch on the Mac (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 1 month 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 #import "chrome/browser/cocoa/tab_contents_controller.h" 5 #import "chrome/browser/cocoa/tab_contents_controller.h"
6 6
7 #include "base/mac_util.h" 7 #include "base/mac_util.h"
8 #include "base/sys_string_conversions.h" 8 #include "base/sys_string_conversions.h"
9 #include "chrome/browser/bookmarks/bookmark_model.h" 9 #include "chrome/browser/bookmarks/bookmark_model.h"
10 #include "chrome/browser/tab_contents/tab_contents.h" 10 #include "chrome/browser/tab_contents/tab_contents.h"
(...skipping 21 matching lines...) Expand all
32 [contentsBox_ setContentView:contents_->GetNativeView()]; 32 [contentsBox_ setContentView:contents_->GetNativeView()];
33 } 33 }
34 34
35 // Returns YES if the tab represented by this controller is the front-most. 35 // Returns YES if the tab represented by this controller is the front-most.
36 - (BOOL)isCurrentTab { 36 - (BOOL)isCurrentTab {
37 // We're the current tab if we're in the view hierarchy, otherwise some other 37 // We're the current tab if we're in the view hierarchy, otherwise some other
38 // tab is. 38 // tab is.
39 return [[self view] superview] ? YES : NO; 39 return [[self view] superview] ? YES : NO;
40 } 40 }
41 41
42 - (void)willBecomeUnselectedTab {
43 RenderViewHost* rvh = contents_->render_view_host();
44 if (rvh)
45 rvh->Blur();
46 }
47
42 - (void)willBecomeSelectedTab { 48 - (void)willBecomeSelectedTab {
49 RenderViewHost* rvh = contents_->render_view_host();
50 if (rvh)
51 rvh->Focus();
43 } 52 }
44 53
45 - (void)tabDidChange:(TabContents*)updatedContents { 54 - (void)tabDidChange:(TabContents*)updatedContents {
46 // Calling setContentView: here removes any first responder status 55 // Calling setContentView: here removes any first responder status
47 // the view may have, so avoid changing the view hierarchy unless 56 // the view may have, so avoid changing the view hierarchy unless
48 // the view is different. 57 // the view is different.
49 if (contents_ != updatedContents) { 58 if (contents_ != updatedContents) {
50 contents_ = updatedContents; 59 contents_ = updatedContents;
51 [contentsBox_ setContentView:contents_->GetNativeView()]; 60 [contentsBox_ setContentView:contents_->GetNativeView()];
52 } 61 }
53 } 62 }
54 63
55 @end 64 @end
OLDNEW
« no previous file with comments | « chrome/browser/cocoa/tab_contents_controller.h ('k') | chrome/browser/cocoa/tab_strip_controller.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698