summaryrefslogtreecommitdiffstats
path: root/chrome/browser/cocoa
diff options
context:
space:
mode:
authoravi@google.com <avi@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-13 23:29:02 +0000
committeravi@google.com <avi@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-13 23:29:02 +0000
commit23576484b6f85938f72a1c993bfdf754b0c54660 (patch)
tree9f82476f21cc6f849ec3945bfbac3953d79f7f02 /chrome/browser/cocoa
parent321792ef1baac764227d55fc944f32cf29e50c6a (diff)
downloadchromium_src-23576484b6f85938f72a1c993bfdf754b0c54660.zip
chromium_src-23576484b6f85938f72a1c993bfdf754b0c54660.tar.gz
chromium_src-23576484b6f85938f72a1c993bfdf754b0c54660.tar.bz2
Save/restore the focused subview.
http://crbug.com/9420 Review URL: http://codereview.chromium.org/100358 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@16013 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/cocoa')
-rw-r--r--chrome/browser/cocoa/browser_window_controller.mm10
-rw-r--r--chrome/browser/cocoa/tab_strip_controller.mm7
2 files changed, 7 insertions, 10 deletions
diff --git a/chrome/browser/cocoa/browser_window_controller.mm b/chrome/browser/cocoa/browser_window_controller.mm
index 3dba768..6d87b9d 100644
--- a/chrome/browser/cocoa/browser_window_controller.mm
+++ b/chrome/browser/cocoa/browser_window_controller.mm
@@ -484,12 +484,6 @@ willPositionSheet:(NSWindow *)sheet
userGesture:(bool)wasUserGesture {
DCHECK(oldContents != newContents);
- // We do not store the focus when closing the tab to work-around bug 4633.
- // Some reports seem to show that the focus manager and/or focused view can
- // be garbage at that point, it is not clear why.
- if (oldContents && !oldContents->is_being_destroyed())
- oldContents->view()->StoreFocus();
-
// Update various elements that are interested in knowing the current
// TabContents.
#if 0
@@ -506,10 +500,6 @@ willPositionSheet:(NSWindow *)sheet
title:base::SysUTF16ToNSString(newContents->GetTitle())
filename:NO];
- if (BrowserList::GetLastActive() == browser_ &&
- !browser_->tabstrip_model()->closing_all())
- newContents->view()->RestoreFocus();
-
#if 0
// TODO(pinkerton):Update as more things become window-specific
// Update all the UI bits.
diff --git a/chrome/browser/cocoa/tab_strip_controller.mm b/chrome/browser/cocoa/tab_strip_controller.mm
index 88f1dac..bbc18f0 100644
--- a/chrome/browser/cocoa/tab_strip_controller.mm
+++ b/chrome/browser/cocoa/tab_strip_controller.mm
@@ -17,6 +17,7 @@
#import "chrome/browser/cocoa/tab_strip_model_observer_bridge.h"
#import "chrome/browser/cocoa/tab_view.h"
#include "chrome/browser/tab_contents/tab_contents.h"
+#include "chrome/browser/tab_contents/tab_contents_view.h"
#include "chrome/browser/tabs/tab_strip_model.h"
#include "grit/generated_resources.h"
@@ -325,8 +326,14 @@
// size than surrounding tabs if the user has many.
[self layoutTabs];
+ if (oldContents)
+ oldContents->view()->StoreFocus();
+
// Swap in the contents for the new tab
[self swapInTabAtIndex:index];
+
+ if (newContents)
+ newContents->view()->RestoreFocus();
}
// Called when a notification is received from the model that the given tab