OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
337 addObserver:self | 337 addObserver:self |
338 selector:@selector(willPowerOff:) | 338 selector:@selector(willPowerOff:) |
339 name:NSWorkspaceWillPowerOffNotification | 339 name:NSWorkspaceWillPowerOffNotification |
340 object:nil]; | 340 object:nil]; |
341 | 341 |
342 // Set up the command updater for when there are no windows open | 342 // Set up the command updater for when there are no windows open |
343 [self initMenuState]; | 343 [self initMenuState]; |
344 | 344 |
345 // Initialize the Profile menu. | 345 // Initialize the Profile menu. |
346 [self initProfileMenu]; | 346 [self initProfileMenu]; |
| 347 |
| 348 // If the OSX version supports this method, the system will automatically |
| 349 // hide the item if there's no touch bar. However, for unsupported versions, |
| 350 // we'll have to manually remove the item from the menu. |
| 351 if (![NSApp |
| 352 respondsToSelector:@selector(toggleTouchBarCustomizationPalette:)]) { |
| 353 NSMenu* mainMenu = [NSApp mainMenu]; |
| 354 NSMenu* viewMenu = [[mainMenu itemWithTag:IDC_VIEW_MENU] submenu]; |
| 355 NSMenuItem* customizeItem = [viewMenu itemWithTag:IDC_CUSTOMIZE_TOUCH_BAR]; |
| 356 if (customizeItem) |
| 357 [viewMenu removeItem:customizeItem]; |
| 358 } |
347 } | 359 } |
348 | 360 |
349 - (void)unregisterEventHandlers { | 361 - (void)unregisterEventHandlers { |
350 NSAppleEventManager* em = [NSAppleEventManager sharedAppleEventManager]; | 362 NSAppleEventManager* em = [NSAppleEventManager sharedAppleEventManager]; |
351 [em removeEventHandlerForEventClass:kInternetEventClass | 363 [em removeEventHandlerForEventClass:kInternetEventClass |
352 andEventID:kAEGetURL]; | 364 andEventID:kAEGetURL]; |
353 [em removeEventHandlerForEventClass:cloud_print::kAECloudPrintClass | 365 [em removeEventHandlerForEventClass:cloud_print::kAECloudPrintClass |
354 andEventID:cloud_print::kAECloudPrintClass]; | 366 andEventID:cloud_print::kAECloudPrintClass]; |
355 [em removeEventHandlerForEventClass:'WWW!' | 367 [em removeEventHandlerForEventClass:'WWW!' |
356 andEventID:'OURL']; | 368 andEventID:'OURL']; |
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
734 if (localState) { | 746 if (localState) { |
735 localPrefRegistrar_.Init(localState); | 747 localPrefRegistrar_.Init(localState); |
736 localPrefRegistrar_.Add( | 748 localPrefRegistrar_.Add( |
737 prefs::kAllowFileSelectionDialogs, | 749 prefs::kAllowFileSelectionDialogs, |
738 base::Bind(&chrome::BrowserCommandController::UpdateOpenFileState, | 750 base::Bind(&chrome::BrowserCommandController::UpdateOpenFileState, |
739 menuState_.get())); | 751 menuState_.get())); |
740 } | 752 } |
741 | 753 |
742 handoff_active_url_observer_bridge_.reset( | 754 handoff_active_url_observer_bridge_.reset( |
743 new HandoffActiveURLObserverBridge(self)); | 755 new HandoffActiveURLObserverBridge(self)); |
744 | |
745 NSApplication* application = [NSApplication sharedApplication]; | |
746 if ([application respondsToSelector: | |
747 @selector(setAutomaticCustomizeTouchBarMenuItemEnabled:)]) { | |
748 [application setAutomaticCustomizeTouchBarMenuItemEnabled:YES]; | |
749 } | |
750 } | 756 } |
751 | 757 |
752 // Helper function for populating and displaying the in progress downloads at | 758 // Helper function for populating and displaying the in progress downloads at |
753 // exit alert panel. | 759 // exit alert panel. |
754 - (BOOL)userWillWaitForInProgressDownloads:(int)downloadCount { | 760 - (BOOL)userWillWaitForInProgressDownloads:(int)downloadCount { |
755 NSString* titleText = nil; | 761 NSString* titleText = nil; |
756 NSString* explanationText = nil; | 762 NSString* explanationText = nil; |
757 NSString* waitTitle = nil; | 763 NSString* waitTitle = nil; |
758 NSString* exitTitle = nil; | 764 NSString* exitTitle = nil; |
759 | 765 |
(...skipping 849 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1609 | 1615 |
1610 //--------------------------------------------------------------------------- | 1616 //--------------------------------------------------------------------------- |
1611 | 1617 |
1612 namespace app_controller_mac { | 1618 namespace app_controller_mac { |
1613 | 1619 |
1614 bool IsOpeningNewWindow() { | 1620 bool IsOpeningNewWindow() { |
1615 return g_is_opening_new_window; | 1621 return g_is_opening_new_window; |
1616 } | 1622 } |
1617 | 1623 |
1618 } // namespace app_controller_mac | 1624 } // namespace app_controller_mac |
OLD | NEW |