| 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.h" | 7 #include "app/l10n_util.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 29 matching lines...) Expand all Loading... |
| 40 - (void)initMenuState; | 40 - (void)initMenuState; |
| 41 - (void)openURLs:(const std::vector<GURL>&)urls; | 41 - (void)openURLs:(const std::vector<GURL>&)urls; |
| 42 - (void)openPendingURLs; | 42 - (void)openPendingURLs; |
| 43 - (void)getUrl:(NSAppleEventDescriptor*)event | 43 - (void)getUrl:(NSAppleEventDescriptor*)event |
| 44 withReply:(NSAppleEventDescriptor*)reply; | 44 withReply:(NSAppleEventDescriptor*)reply; |
| 45 - (void)openFiles:(NSAppleEventDescriptor*)event | 45 - (void)openFiles:(NSAppleEventDescriptor*)event |
| 46 withReply:(NSAppleEventDescriptor*)reply; | 46 withReply:(NSAppleEventDescriptor*)reply; |
| 47 - (void)windowLayeringDidChange:(NSNotification*)inNotification; | 47 - (void)windowLayeringDidChange:(NSNotification*)inNotification; |
| 48 - (BOOL)userWillWaitForInProgressDownloads:(int)downloadCount; | 48 - (BOOL)userWillWaitForInProgressDownloads:(int)downloadCount; |
| 49 - (BOOL)shouldQuitWithInProgressDownloads; | 49 - (BOOL)shouldQuitWithInProgressDownloads; |
| 50 - (NSMenu*)applicationDockMenu:(NSApplication*)sender; |
| 50 @end | 51 @end |
| 51 | 52 |
| 52 @implementation AppController | 53 @implementation AppController |
| 53 | 54 |
| 54 // This method is called very early in application startup (ie, before | 55 // This method is called very early in application startup (ie, before |
| 55 // the profile is loaded or any preferences have been registered). Defer any | 56 // the profile is loaded or any preferences have been registered). Defer any |
| 56 // user-data initialization until -applicationDidFinishLaunching:. | 57 // user-data initialization until -applicationDidFinishLaunching:. |
| 57 - (void)awakeFromNib { | 58 - (void)awakeFromNib { |
| 58 pendingURLs_.reset(new std::vector<GURL>()); | 59 pendingURLs_.reset(new std::vector<GURL>()); |
| 59 | 60 |
| (...skipping 587 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 647 addObserver:self | 648 addObserver:self |
| 648 selector:@selector(aboutWindowClosed:) | 649 selector:@selector(aboutWindowClosed:) |
| 649 name:kUserClosedAboutNotification | 650 name:kUserClosedAboutNotification |
| 650 object:aboutController_.get()]; | 651 object:aboutController_.get()]; |
| 651 } | 652 } |
| 652 if (![[aboutController_ window] isVisible]) | 653 if (![[aboutController_ window] isVisible]) |
| 653 [[aboutController_ window] center]; | 654 [[aboutController_ window] center]; |
| 654 [aboutController_ showWindow:self]; | 655 [aboutController_ showWindow:self]; |
| 655 } | 656 } |
| 656 | 657 |
| 658 - (NSMenu*)applicationDockMenu:(id)sender { |
| 659 NSMenu* result = [[[NSMenu alloc] initWithTitle: @""] autorelease]; |
| 660 NSString* titleStr; |
| 661 id item; |
| 662 |
| 663 titleStr = base::SysWideToNSString( |
| 664 l10n_util::GetString(IDS_NEW_WINDOW_MAC)); |
| 665 item = [[[NSMenuItem alloc] initWithTitle:titleStr |
| 666 action:@selector(commandDispatch:) |
| 667 keyEquivalent:@""] autorelease]; |
| 668 [item setTarget:self]; |
| 669 [item setTag:IDC_NEW_WINDOW]; |
| 670 [result addItem:item]; |
| 671 |
| 672 titleStr = base::SysWideToNSString( |
| 673 l10n_util::GetString(IDS_NEW_INCOGNITO_WINDOW_MAC)); |
| 674 item = [[[NSMenuItem alloc] initWithTitle:titleStr |
| 675 action:@selector(commandDispatch:) |
| 676 keyEquivalent:@""] autorelease]; |
| 677 [item setTarget:self]; |
| 678 [item setTag:IDC_NEW_INCOGNITO_WINDOW]; |
| 679 [result addItem:item]; |
| 680 |
| 681 return result; |
| 682 } |
| 683 |
| 657 @end | 684 @end |
| OLD | NEW |