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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 #include "chrome/browser/ui/browser_finder.h" | 57 #include "chrome/browser/ui/browser_finder.h" |
58 #include "chrome/browser/ui/browser_list.h" | 58 #include "chrome/browser/ui/browser_list.h" |
59 #include "chrome/browser/ui/browser_mac.h" | 59 #include "chrome/browser/ui/browser_mac.h" |
60 #include "chrome/browser/ui/browser_window.h" | 60 #include "chrome/browser/ui/browser_window.h" |
61 #include "chrome/browser/ui/chrome_pages.h" | 61 #include "chrome/browser/ui/chrome_pages.h" |
62 #import "chrome/browser/ui/cocoa/apps/app_shim_menu_controller_mac.h" | 62 #import "chrome/browser/ui/cocoa/apps/app_shim_menu_controller_mac.h" |
63 #include "chrome/browser/ui/cocoa/apps/quit_with_apps_controller_mac.h" | 63 #include "chrome/browser/ui/cocoa/apps/quit_with_apps_controller_mac.h" |
64 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_menu_bridge.h" | 64 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_menu_bridge.h" |
65 #import "chrome/browser/ui/cocoa/confirm_quit.h" | 65 #import "chrome/browser/ui/cocoa/confirm_quit.h" |
66 #import "chrome/browser/ui/cocoa/confirm_quit_panel_controller.h" | 66 #import "chrome/browser/ui/cocoa/confirm_quit_panel_controller.h" |
67 #import "chrome/browser/ui/cocoa/encoding_menu_controller_delegate_mac.h" | |
68 #include "chrome/browser/ui/cocoa/handoff_active_url_observer_bridge.h" | 67 #include "chrome/browser/ui/cocoa/handoff_active_url_observer_bridge.h" |
69 #import "chrome/browser/ui/cocoa/history_menu_bridge.h" | 68 #import "chrome/browser/ui/cocoa/history_menu_bridge.h" |
70 #include "chrome/browser/ui/cocoa/last_active_browser_cocoa.h" | 69 #include "chrome/browser/ui/cocoa/last_active_browser_cocoa.h" |
71 #import "chrome/browser/ui/cocoa/profiles/profile_menu_controller.h" | 70 #import "chrome/browser/ui/cocoa/profiles/profile_menu_controller.h" |
72 #include "chrome/browser/ui/extensions/application_launch.h" | 71 #include "chrome/browser/ui/extensions/application_launch.h" |
73 #include "chrome/browser/ui/startup/startup_browser_creator.h" | 72 #include "chrome/browser/ui/startup/startup_browser_creator.h" |
74 #include "chrome/browser/ui/startup/startup_browser_creator_impl.h" | 73 #include "chrome/browser/ui/startup/startup_browser_creator_impl.h" |
75 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 74 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
76 #include "chrome/browser/ui/user_manager.h" | 75 #include "chrome/browser/ui/user_manager.h" |
77 #include "chrome/browser/web_applications/web_app_mac.h" | 76 #include "chrome/browser/web_applications/web_app_mac.h" |
(...skipping 661 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
739 // main menu item titles are not yet initialized in awakeFromNib. | 738 // main menu item titles are not yet initialized in awakeFromNib. |
740 [self initAppShimMenuController]; | 739 [self initAppShimMenuController]; |
741 | 740 |
742 // If enabled, keep Chrome alive when apps are open instead of quitting all | 741 // If enabled, keep Chrome alive when apps are open instead of quitting all |
743 // apps. | 742 // apps. |
744 quitWithAppsController_ = new QuitWithAppsController(); | 743 quitWithAppsController_ = new QuitWithAppsController(); |
745 | 744 |
746 // Dynamically update shortcuts for "Close Window" and "Close Tab" menu items. | 745 // Dynamically update shortcuts for "Close Window" and "Close Tab" menu items. |
747 [[closeTabMenuItem_ menu] setDelegate:self]; | 746 [[closeTabMenuItem_ menu] setDelegate:self]; |
748 | 747 |
749 // Build up the encoding menu, the order of the items differs based on the | |
750 // current locale (see http://crbug.com/7647 for details). | |
751 // We need a valid g_browser_process to get the profile which is why we can't | |
752 // call this from awakeFromNib. | |
753 NSMenu* viewMenu = [[[NSApp mainMenu] itemWithTag:IDC_VIEW_MENU] submenu]; | |
754 NSMenuItem* encodingMenuItem = [viewMenu itemWithTag:IDC_ENCODING_MENU]; | |
755 NSMenu* encodingMenu = [encodingMenuItem submenu]; | |
756 EncodingMenuControllerDelegate::BuildEncodingMenu([self lastProfile], | |
757 encodingMenu); | |
758 | |
759 // Instantiate the ProfileAttributesStorage observer so that we can get | 748 // Instantiate the ProfileAttributesStorage observer so that we can get |
760 // notified when a profile is deleted. | 749 // notified when a profile is deleted. |
761 profileAttributesStorageObserver_.reset(new AppControllerProfileObserver( | 750 profileAttributesStorageObserver_.reset(new AppControllerProfileObserver( |
762 g_browser_process->profile_manager(), self)); | 751 g_browser_process->profile_manager(), self)); |
763 | 752 |
764 // Since Chrome is localized to more languages than the OS, tell Cocoa which | 753 // Since Chrome is localized to more languages than the OS, tell Cocoa which |
765 // menu is the Help so it can add the search item to it. | 754 // menu is the Help so it can add the search item to it. |
766 [NSApp setHelpMenu:helpMenu_]; | 755 [NSApp setHelpMenu:helpMenu_]; |
767 | 756 |
768 // Record the path to the (browser) app bundle; this is used by the app mode | 757 // Record the path to the (browser) app bundle; this is used by the app mode |
(...skipping 921 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1690 | 1679 |
1691 //--------------------------------------------------------------------------- | 1680 //--------------------------------------------------------------------------- |
1692 | 1681 |
1693 namespace app_controller_mac { | 1682 namespace app_controller_mac { |
1694 | 1683 |
1695 bool IsOpeningNewWindow() { | 1684 bool IsOpeningNewWindow() { |
1696 return g_is_opening_new_window; | 1685 return g_is_opening_new_window; |
1697 } | 1686 } |
1698 | 1687 |
1699 } // namespace app_controller_mac | 1688 } // namespace app_controller_mac |
OLD | NEW |