summaryrefslogtreecommitdiffstats
path: root/chrome/browser/cocoa/browser_window_controller.mm
diff options
context:
space:
mode:
authorrohitrao@chromium.org <rohitrao@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-29 14:37:55 +0000
committerrohitrao@chromium.org <rohitrao@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-29 14:37:55 +0000
commit0b5f62f66a72fb3b1ae447637a492960d6de517c (patch)
tree06559eff09d9d3f5f19047e4c3f7e8d69f4dffe6 /chrome/browser/cocoa/browser_window_controller.mm
parent671eb86daacffc11f4f96c65d58375d5d28aeb95 (diff)
downloadchromium_src-0b5f62f66a72fb3b1ae447637a492960d6de517c.zip
chromium_src-0b5f62f66a72fb3b1ae447637a492960d6de517c.tar.gz
chromium_src-0b5f62f66a72fb3b1ae447637a492960d6de517c.tar.bz2
Adds items to the Window menu on Mac.
TEST=Open multiple windows, make sure the entries in the Window menu match the titles of the currently selected tabs. Review URL: http://codereview.chromium.org/100121 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@14841 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/cocoa/browser_window_controller.mm')
-rw-r--r--chrome/browser/cocoa/browser_window_controller.mm21
1 files changed, 21 insertions, 0 deletions
diff --git a/chrome/browser/cocoa/browser_window_controller.mm b/chrome/browser/cocoa/browser_window_controller.mm
index c9d325f..efc08fc 100644
--- a/chrome/browser/cocoa/browser_window_controller.mm
+++ b/chrome/browser/cocoa/browser_window_controller.mm
@@ -143,6 +143,8 @@ willPositionSheet:(NSWindow *)sheet
}
- (void)destroyBrowser {
+ [NSApp removeWindowsItem:[self window]];
+
// We need the window to go away now.
[self autorelease];
}
@@ -423,6 +425,13 @@ willPositionSheet:(NSWindow *)sheet
#endif
newContents->DidBecomeSelected();
+ // Change the entry in the Window menu to match the title of the
+ // currently selected tab. This will create an entry if one does
+ // not already exist.
+ [NSApp changeWindowsItem:[self window]
+ title:base::SysUTF16ToNSString(newContents->GetTitle())
+ filename:NO];
+
if (BrowserList::GetLastActive() == browser_ &&
!browser_->tabstrip_model()->closing_all() &&
newContents->AsWebContents()) {
@@ -439,6 +448,18 @@ willPositionSheet:(NSWindow *)sheet
#endif
}
+- (void)tabChangedWithContents:(TabContents*)contents
+ atIndex:(NSInteger)index
+ loadingOnly:(BOOL)loading {
+ // Change the entry in the Window menu to match the new title of the tab,
+ // but only if this is the currently selected tab.
+ if (index == browser_->tabstrip_model()->selected_index()) {
+ [NSApp changeWindowsItem:[self window]
+ title:base::SysUTF16ToNSString(contents->GetTitle())
+ filename:NO];
+ }
+}
+
@end