summaryrefslogtreecommitdiffstats
path: root/chrome/browser/app_controller_mac.mm
diff options
context:
space:
mode:
authorjrg@chromium.org <jrg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-20 22:13:07 +0000
committerjrg@chromium.org <jrg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-20 22:13:07 +0000
commitbde3dda19eb3154ef97dcad61705c0705be86ba0 (patch)
treec551c4d00f6510f1a1253f38fefdc7c8c6292cde /chrome/browser/app_controller_mac.mm
parentfc2fed4c16ecd0e341e6497f1863449ced9374c8 (diff)
downloadchromium_src-bde3dda19eb3154ef97dcad61705c0705be86ba0.zip
chromium_src-bde3dda19eb3154ef97dcad61705c0705be86ba0.tar.gz
chromium_src-bde3dda19eb3154ef97dcad61705c0705be86ba0.tar.bz2
About box development.
BUG=http://codereview.chromium.org/112044 Note pieces of chrome.gyp come from a different CL (keystone_glue work associated with this). Review URL: http://codereview.chromium.org/113614 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@16545 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/app_controller_mac.mm')
-rw-r--r--chrome/browser/app_controller_mac.mm54
1 files changed, 49 insertions, 5 deletions
diff --git a/chrome/browser/app_controller_mac.mm b/chrome/browser/app_controller_mac.mm
index 0b88c36..74667c7 100644
--- a/chrome/browser/app_controller_mac.mm
+++ b/chrome/browser/app_controller_mac.mm
@@ -12,6 +12,7 @@
#include "chrome/browser/browser_init.h"
#include "chrome/browser/browser_list.h"
#include "chrome/browser/browser_shutdown.h"
+#import "chrome/browser/cocoa/about_window_controller.h"
#import "chrome/browser/cocoa/bookmark_menu_bridge.h"
#import "chrome/browser/cocoa/encoding_menu_controller_delegate_mac.h"
#import "chrome/browser/cocoa/menu_localizer.h"
@@ -93,10 +94,6 @@
[self openPendingURLs];
}
-- (void)dealloc {
- [super dealloc];
-}
-
// We can't use the standard terminate: method because it will abruptly exit
// the app and leave things on the stack in an unfinalized state. We need to
// post a quit message to our run loop so the stack can gracefully unwind.
@@ -148,6 +145,8 @@
enable = YES;
} else if (action == @selector(showPreferences:)) {
enable = YES;
+ } else if (action == @selector(orderFrontStandardAboutPanel:)) {
+ enable = YES;
}
return enable;
}
@@ -285,7 +284,10 @@
// Called when the preferences window is closed. We use this to release the
// window controller.
- (void)prefsWindowClosed:(NSNotification*)notify {
- [[NSNotificationCenter defaultCenter] removeObserver:self];
+ [[NSNotificationCenter defaultCenter]
+ removeObserver:self
+ name:kUserDoneEditingPrefsNotification
+ object:prefsController_.get()];
prefsController_.reset(NULL);
}
@@ -306,4 +308,46 @@
[prefsController_ showPreferences:sender];
}
+// Called when the about window is closed. We use this to release the
+// window controller.
+- (void)aboutWindowClosed:(NSNotification*)notify {
+ [[NSNotificationCenter defaultCenter]
+ removeObserver:self
+ name:kUserClosedAboutNotification
+ object:aboutController_.get()];
+ aboutController_.reset(NULL);
+}
+
+- (IBAction)orderFrontStandardAboutPanel:(id)sender {
+#if !defined(GOOGLE_CHROME_BUILD)
+ // If not branded behave like a generic Cocoa app.
+ [NSApp orderFrontStandardAboutPanel:sender];
+#else
+ // Otherwise bring up our special dialog (e.g. with an auto-update button).
+ if (!aboutController_) {
+ aboutController_.reset([[AboutWindowController alloc]
+ initWithWindowNibName:@"About"]);
+ if (!aboutController_) {
+ // If we get here something is wacky. I managed to do it when
+ // testing by explicitly forcing an auto-update to an older
+ // version then trying to open the about box again (missing
+ // nib). This shouldn't be possible in general but let's try
+ // hard to not do nothing.
+ [NSApp orderFrontStandardAboutPanel:sender];
+ return;
+ }
+ // Watch for a notification of when it goes away so that we can destroy
+ // the controller.
+ [[NSNotificationCenter defaultCenter]
+ addObserver:self
+ selector:@selector(aboutWindowClosed:)
+ name:kUserClosedAboutNotification
+ object:aboutController_.get()];
+ }
+ if (![[aboutController_ window] isVisible])
+ [[aboutController_ window] center];
+ [aboutController_ showWindow:self];
+#endif
+}
+
@end