| OLD | NEW |
| 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/app_controller_mac.h" | 5 #import "chrome/browser/app_controller_mac.h" |
| 6 | 6 |
| 7 #include "app/l10n_util_mac.h" | 7 #include "app/l10n_util_mac.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/mac_util.h" | 9 #include "base/mac_util.h" |
| 10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
| (...skipping 647 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 658 name:kUserDoneEditingPrefsNotification | 658 name:kUserDoneEditingPrefsNotification |
| 659 object:prefsController_.get()]; | 659 object:prefsController_.get()]; |
| 660 } | 660 } |
| 661 [prefsController_ showPreferences:sender]; | 661 [prefsController_ showPreferences:sender]; |
| 662 } | 662 } |
| 663 | 663 |
| 664 // Called when the about window is closed. We use this to release the | 664 // Called when the about window is closed. We use this to release the |
| 665 // window controller. | 665 // window controller. |
| 666 - (void)aboutWindowClosed:(NSNotification*)notify { | 666 - (void)aboutWindowClosed:(NSNotification*)notify { |
| 667 [[NSNotificationCenter defaultCenter] | 667 [[NSNotificationCenter defaultCenter] |
| 668 removeObserver:self | 668 removeObserver:self |
| 669 name:kUserClosedAboutNotification | 669 name:kUserClosedAboutNotification |
| 670 object:aboutController_.get()]; | 670 object:aboutController_.get()]; |
| 671 aboutController_.reset(NULL); | 671 aboutController_.reset(nil); |
| 672 } | 672 } |
| 673 | 673 |
| 674 - (IBAction)orderFrontStandardAboutPanel:(id)sender { | 674 - (IBAction)orderFrontStandardAboutPanel:(id)sender { |
| 675 // Otherwise bring up our special dialog (e.g. with an auto-update button). | |
| 676 if (!aboutController_) { | 675 if (!aboutController_) { |
| 677 aboutController_.reset([[AboutWindowController alloc] | 676 aboutController_.reset([[AboutWindowController alloc] |
| 678 initWithProfile:[self defaultProfile]]); | 677 initWithProfile:[self defaultProfile]]); |
| 679 if (!aboutController_) { | 678 |
| 680 // If we get here something is wacky. I managed to do it when | |
| 681 // testing by explicitly forcing an auto-update to an older | |
| 682 // version then trying to open the about box again (missing | |
| 683 // nib). This shouldn't be possible in general but let's try | |
| 684 // hard to not do nothing. | |
| 685 [NSApp orderFrontStandardAboutPanel:sender]; | |
| 686 return; | |
| 687 } | |
| 688 // Watch for a notification of when it goes away so that we can destroy | 679 // Watch for a notification of when it goes away so that we can destroy |
| 689 // the controller. | 680 // the controller. |
| 690 [[NSNotificationCenter defaultCenter] | 681 [[NSNotificationCenter defaultCenter] |
| 691 addObserver:self | 682 addObserver:self |
| 692 selector:@selector(aboutWindowClosed:) | 683 selector:@selector(aboutWindowClosed:) |
| 693 name:kUserClosedAboutNotification | 684 name:kUserClosedAboutNotification |
| 694 object:aboutController_.get()]; | 685 object:aboutController_.get()]; |
| 695 } | 686 } |
| 687 |
| 696 if (![[aboutController_ window] isVisible]) | 688 if (![[aboutController_ window] isVisible]) |
| 697 [[aboutController_ window] center]; | 689 [[aboutController_ window] center]; |
| 690 |
| 698 [aboutController_ showWindow:self]; | 691 [aboutController_ showWindow:self]; |
| 699 } | 692 } |
| 700 | 693 |
| 701 // Explicitly bring to the foreground when creating new windows from the dock. | 694 // Explicitly bring to the foreground when creating new windows from the dock. |
| 702 - (void)newWindowFromDock:(id)sender { | 695 - (void)newWindowFromDock:(id)sender { |
| 703 [NSApp activateIgnoringOtherApps:YES]; | 696 [NSApp activateIgnoringOtherApps:YES]; |
| 704 [self commandDispatch:sender]; | 697 [self commandDispatch:sender]; |
| 705 } | 698 } |
| 706 | 699 |
| 707 - (NSMenu*)applicationDockMenu:(id)sender { | 700 - (NSMenu*)applicationDockMenu:(id)sender { |
| (...skipping 21 matching lines...) Expand all Loading... |
| 729 @end | 722 @end |
| 730 | 723 |
| 731 //--------------------------------------------------------------------------- | 724 //--------------------------------------------------------------------------- |
| 732 | 725 |
| 733 // Stub for cross-platform method that isn't called on Mac OS X. | 726 // Stub for cross-platform method that isn't called on Mac OS X. |
| 734 void ShowOptionsWindow(OptionsPage page, | 727 void ShowOptionsWindow(OptionsPage page, |
| 735 OptionsGroup highlight_group, | 728 OptionsGroup highlight_group, |
| 736 Profile* profile) { | 729 Profile* profile) { |
| 737 NOTIMPLEMENTED(); | 730 NOTIMPLEMENTED(); |
| 738 } | 731 } |
| OLD | NEW |