Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8)

Side by Side Diff: chrome/browser/app_controller_mac.mm

Issue 303030: Mac: Enable help when there are no windows. (Closed)
Patch Set: Created 11 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/browser.h » ('j') | chrome/browser/browser.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 484 matching lines...) Expand 10 before | Expand all | Expand 10 after
495 Browser::OpenEmptyWindow(defaultProfile->GetOffTheRecordProfile()); 495 Browser::OpenEmptyWindow(defaultProfile->GetOffTheRecordProfile());
496 break; 496 break;
497 case IDC_RESTORE_TAB: 497 case IDC_RESTORE_TAB:
498 Browser::OpenWindowWithRestoredTabs(defaultProfile); 498 Browser::OpenWindowWithRestoredTabs(defaultProfile);
499 break; 499 break;
500 case IDC_OPEN_FILE: 500 case IDC_OPEN_FILE:
501 Browser::OpenEmptyWindow(defaultProfile); 501 Browser::OpenEmptyWindow(defaultProfile);
502 BrowserList::GetLastActive()-> 502 BrowserList::GetLastActive()->
503 ExecuteCommandWithDisposition(IDC_OPEN_FILE, CURRENT_TAB); 503 ExecuteCommandWithDisposition(IDC_OPEN_FILE, CURRENT_TAB);
504 break; 504 break;
505 case IDC_CLEAR_BROWSING_DATA: 505 case IDC_CLEAR_BROWSING_DATA: {
506 // There may not be a browser open, so use the default profile. 506 // There may not be a browser open, so use the default profile.
507 scoped_nsobject<ClearBrowsingDataController> controller( 507 scoped_nsobject<ClearBrowsingDataController> controller(
508 [[ClearBrowsingDataController alloc] 508 [[ClearBrowsingDataController alloc]
509 initWithProfile:defaultProfile]); 509 initWithProfile:defaultProfile]);
510 [controller runModalDialog]; 510 [controller runModalDialog];
511 break; 511 break;
512 }
513 case IDC_HELP_PAGE:
514 Browser::OpenHelpWindow(defaultProfile);
515 break;
512 }; 516 };
513 } 517 }
514 518
515 // NSApplication delegate method called when someone clicks on the 519 // NSApplication delegate method called when someone clicks on the
516 // dock icon and there are no open windows. To match standard mac 520 // dock icon and there are no open windows. To match standard mac
517 // behavior, we should open a new window. 521 // behavior, we should open a new window.
518 - (BOOL)applicationShouldHandleReopen:(NSApplication*)theApplication 522 - (BOOL)applicationShouldHandleReopen:(NSApplication*)theApplication
519 hasVisibleWindows:(BOOL)flag { 523 hasVisibleWindows:(BOOL)flag {
520 // Don't do anything if there are visible windows. This will cause 524 // Don't do anything if there are visible windows. This will cause
521 // AppKit to unminimize the most recently minimized window. 525 // AppKit to unminimize the most recently minimized window.
522 if (flag) 526 if (flag)
523 return YES; 527 return YES;
524 528
525 // Otherwise open a new window. 529 // Otherwise open a new window.
526 Browser::OpenEmptyWindow([self defaultProfile]); 530 Browser::OpenEmptyWindow([self defaultProfile]);
527 531
528 // We've handled the reopen event, so return NO to tell AppKit not 532 // We've handled the reopen event, so return NO to tell AppKit not
529 // to do anything. 533 // to do anything.
530 return NO; 534 return NO;
531 } 535 }
532 536
533 - (void)initMenuState { 537 - (void)initMenuState {
534 menuState_.reset(new CommandUpdater(NULL)); 538 menuState_.reset(new CommandUpdater(NULL));
535 menuState_->UpdateCommandEnabled(IDC_NEW_TAB, true); 539 menuState_->UpdateCommandEnabled(IDC_NEW_TAB, true);
536 menuState_->UpdateCommandEnabled(IDC_NEW_WINDOW, true); 540 menuState_->UpdateCommandEnabled(IDC_NEW_WINDOW, true);
537 menuState_->UpdateCommandEnabled(IDC_NEW_INCOGNITO_WINDOW, true); 541 menuState_->UpdateCommandEnabled(IDC_NEW_INCOGNITO_WINDOW, true);
538 menuState_->UpdateCommandEnabled(IDC_OPEN_FILE, true); 542 menuState_->UpdateCommandEnabled(IDC_OPEN_FILE, true);
539 menuState_->UpdateCommandEnabled(IDC_CLEAR_BROWSING_DATA, true); 543 menuState_->UpdateCommandEnabled(IDC_CLEAR_BROWSING_DATA, true);
540 menuState_->UpdateCommandEnabled(IDC_RESTORE_TAB, false); 544 menuState_->UpdateCommandEnabled(IDC_RESTORE_TAB, false);
545 menuState_->UpdateCommandEnabled(IDC_HELP_PAGE, true);
541 // TODO(pinkerton): ...more to come... 546 // TODO(pinkerton): ...more to come...
542 } 547 }
543 548
544 - (Profile*)defaultProfile { 549 - (Profile*)defaultProfile {
545 // TODO(jrg): Find a better way to get the "default" profile. 550 // TODO(jrg): Find a better way to get the "default" profile.
546 if (g_browser_process->profile_manager()) 551 if (g_browser_process->profile_manager())
547 return* g_browser_process->profile_manager()->begin(); 552 return* g_browser_process->profile_manager()->begin();
548 553
549 return NULL; 554 return NULL;
550 } 555 }
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
724 @end 729 @end
725 730
726 //--------------------------------------------------------------------------- 731 //---------------------------------------------------------------------------
727 732
728 // Stub for cross-platform method that isn't called on Mac OS X. 733 // Stub for cross-platform method that isn't called on Mac OS X.
729 void ShowOptionsWindow(OptionsPage page, 734 void ShowOptionsWindow(OptionsPage page,
730 OptionsGroup highlight_group, 735 OptionsGroup highlight_group,
731 Profile* profile) { 736 Profile* profile) {
732 NOTIMPLEMENTED(); 737 NOTIMPLEMENTED();
733 } 738 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/browser.h » ('j') | chrome/browser/browser.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698