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 "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 #include "chrome/browser/browser_shutdown.h" | 26 #include "chrome/browser/browser_shutdown.h" |
27 #include "chrome/browser/chrome_notification_types.h" | 27 #include "chrome/browser/chrome_notification_types.h" |
28 #include "chrome/browser/command_updater.h" | 28 #include "chrome/browser/command_updater.h" |
29 #include "chrome/browser/download/download_service.h" | 29 #include "chrome/browser/download/download_service.h" |
30 #include "chrome/browser/download/download_service_factory.h" | 30 #include "chrome/browser/download/download_service_factory.h" |
31 #include "chrome/browser/extensions/extension_service.h" | 31 #include "chrome/browser/extensions/extension_service.h" |
32 #include "chrome/browser/first_run/first_run.h" | 32 #include "chrome/browser/first_run/first_run.h" |
33 #include "chrome/browser/lifetime/application_lifetime.h" | 33 #include "chrome/browser/lifetime/application_lifetime.h" |
34 #include "chrome/browser/mac/handoff_utility.h" | 34 #include "chrome/browser/mac/handoff_utility.h" |
35 #include "chrome/browser/mac/mac_startup_profiler.h" | 35 #include "chrome/browser/mac/mac_startup_profiler.h" |
| 36 #include "chrome/browser/prefs/incognito_mode_prefs.h" |
36 #include "chrome/browser/profiles/profile_info_cache_observer.h" | 37 #include "chrome/browser/profiles/profile_info_cache_observer.h" |
37 #include "chrome/browser/profiles/profile_manager.h" | 38 #include "chrome/browser/profiles/profile_manager.h" |
38 #include "chrome/browser/profiles/profiles_state.h" | 39 #include "chrome/browser/profiles/profiles_state.h" |
39 #include "chrome/browser/sessions/session_restore.h" | 40 #include "chrome/browser/sessions/session_restore.h" |
40 #include "chrome/browser/sessions/session_service.h" | 41 #include "chrome/browser/sessions/session_service.h" |
41 #include "chrome/browser/sessions/session_service_factory.h" | 42 #include "chrome/browser/sessions/session_service_factory.h" |
42 #include "chrome/browser/sessions/tab_restore_service.h" | 43 #include "chrome/browser/sessions/tab_restore_service.h" |
43 #include "chrome/browser/sessions/tab_restore_service_factory.h" | 44 #include "chrome/browser/sessions/tab_restore_service_factory.h" |
44 #include "chrome/browser/signin/signin_manager_factory.h" | 45 #include "chrome/browser/signin/signin_manager_factory.h" |
45 #include "chrome/browser/signin/signin_promo.h" | 46 #include "chrome/browser/signin/signin_promo.h" |
(...skipping 1414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1460 base::scoped_nsobject<NSMenuItem> item( | 1461 base::scoped_nsobject<NSMenuItem> item( |
1461 [[NSMenuItem alloc] initWithTitle:titleStr | 1462 [[NSMenuItem alloc] initWithTitle:titleStr |
1462 action:@selector(commandFromDock:) | 1463 action:@selector(commandFromDock:) |
1463 keyEquivalent:@""]); | 1464 keyEquivalent:@""]); |
1464 [item setTarget:self]; | 1465 [item setTarget:self]; |
1465 [item setTag:IDC_NEW_WINDOW]; | 1466 [item setTag:IDC_NEW_WINDOW]; |
1466 [item setEnabled:[self validateUserInterfaceItem:item]]; | 1467 [item setEnabled:[self validateUserInterfaceItem:item]]; |
1467 [dockMenu addItem:item]; | 1468 [dockMenu addItem:item]; |
1468 | 1469 |
1469 // |profile| can be NULL during unit tests. | 1470 // |profile| can be NULL during unit tests. |
1470 if (!profile || !profile->IsSupervised()) { | 1471 if (!profile || |
| 1472 IncognitoModePrefs::GetAvailability(profile->GetPrefs()) != |
| 1473 IncognitoModePrefs::DISABLED) { |
1471 titleStr = l10n_util::GetNSStringWithFixup(IDS_NEW_INCOGNITO_WINDOW_MAC); | 1474 titleStr = l10n_util::GetNSStringWithFixup(IDS_NEW_INCOGNITO_WINDOW_MAC); |
1472 item.reset( | 1475 item.reset( |
1473 [[NSMenuItem alloc] initWithTitle:titleStr | 1476 [[NSMenuItem alloc] initWithTitle:titleStr |
1474 action:@selector(commandFromDock:) | 1477 action:@selector(commandFromDock:) |
1475 keyEquivalent:@""]); | 1478 keyEquivalent:@""]); |
1476 [item setTarget:self]; | 1479 [item setTarget:self]; |
1477 [item setTag:IDC_NEW_INCOGNITO_WINDOW]; | 1480 [item setTag:IDC_NEW_INCOGNITO_WINDOW]; |
1478 [item setEnabled:[self validateUserInterfaceItem:item]]; | 1481 [item setEnabled:[self validateUserInterfaceItem:item]]; |
1479 [dockMenu addItem:item]; | 1482 [dockMenu addItem:item]; |
1480 } | 1483 } |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1619 | 1622 |
1620 //--------------------------------------------------------------------------- | 1623 //--------------------------------------------------------------------------- |
1621 | 1624 |
1622 namespace app_controller_mac { | 1625 namespace app_controller_mac { |
1623 | 1626 |
1624 bool IsOpeningNewWindow() { | 1627 bool IsOpeningNewWindow() { |
1625 return g_is_opening_new_window; | 1628 return g_is_opening_new_window; |
1626 } | 1629 } |
1627 | 1630 |
1628 } // namespace app_controller_mac | 1631 } // namespace app_controller_mac |
OLD | NEW |