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" |
11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
12 #include "base/files/file_path.h" | 12 #include "base/files/file_path.h" |
13 #include "base/mac/foundation_util.h" | 13 #include "base/mac/foundation_util.h" |
14 #include "base/mac/mac_util.h" | 14 #include "base/mac/mac_util.h" |
15 #include "base/mac/sdk_forward_declarations.h" | 15 #include "base/mac/sdk_forward_declarations.h" |
16 #include "base/macros.h" | 16 #include "base/macros.h" |
17 #include "base/memory/ptr_util.h" | 17 #include "base/memory/ptr_util.h" |
18 #include "base/message_loop/message_loop.h" | |
19 #include "base/metrics/histogram_macros.h" | 18 #include "base/metrics/histogram_macros.h" |
20 #include "base/metrics/user_metrics.h" | 19 #include "base/metrics/user_metrics.h" |
| 20 #include "base/run_loop.h" |
21 #include "base/strings/string_number_conversions.h" | 21 #include "base/strings/string_number_conversions.h" |
22 #include "base/strings/sys_string_conversions.h" | 22 #include "base/strings/sys_string_conversions.h" |
23 #include "base/strings/utf_string_conversions.h" | 23 #include "base/strings/utf_string_conversions.h" |
24 #include "chrome/app/chrome_command_ids.h" | 24 #include "chrome/app/chrome_command_ids.h" |
25 #include "chrome/browser/apps/app_shim/extension_app_shim_handler_mac.h" | 25 #include "chrome/browser/apps/app_shim/extension_app_shim_handler_mac.h" |
26 #include "chrome/browser/apps/app_window_registry_util.h" | 26 #include "chrome/browser/apps/app_window_registry_util.h" |
27 #include "chrome/browser/background/background_application_list_model.h" | 27 #include "chrome/browser/background/background_application_list_model.h" |
28 #include "chrome/browser/background/background_mode_manager.h" | 28 #include "chrome/browser/background/background_mode_manager.h" |
29 #include "chrome/browser/browser_process.h" | 29 #include "chrome/browser/browser_process.h" |
30 #include "chrome/browser/browser_shutdown.h" | 30 #include "chrome/browser/browser_shutdown.h" |
(...skipping 908 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
939 if ([delegate respondsToSelector:@selector(commandDispatch:)]) { | 939 if ([delegate respondsToSelector:@selector(commandDispatch:)]) { |
940 [delegate commandDispatch:sender]; | 940 [delegate commandDispatch:sender]; |
941 return; | 941 return; |
942 } | 942 } |
943 } | 943 } |
944 | 944 |
945 // Ignore commands during session restore's browser creation. It uses a | 945 // Ignore commands during session restore's browser creation. It uses a |
946 // nested message loop and commands dispatched during this operation cause | 946 // nested message loop and commands dispatched during this operation cause |
947 // havoc. | 947 // havoc. |
948 if (SessionRestore::IsRestoring(lastProfile) && | 948 if (SessionRestore::IsRestoring(lastProfile) && |
949 base::MessageLoop::current()->IsNested()) | 949 base::RunLoop::IsNestedOnCurrentThread()) { |
950 return; | 950 return; |
| 951 } |
951 | 952 |
952 NSInteger tag = [sender tag]; | 953 NSInteger tag = [sender tag]; |
953 | 954 |
954 // If there are no browser windows, and we are trying to open a browser | 955 // If there are no browser windows, and we are trying to open a browser |
955 // for a locked profile or the system profile, we have to show the User | 956 // for a locked profile or the system profile, we have to show the User |
956 // Manager instead as the locked profile needs authentication and the system | 957 // Manager instead as the locked profile needs authentication and the system |
957 // profile cannot have a browser. | 958 // profile cannot have a browser. |
958 if (IsProfileSignedOut(lastProfile) || lastProfile->IsSystemProfile()) { | 959 if (IsProfileSignedOut(lastProfile) || lastProfile->IsSystemProfile()) { |
959 UserManager::Show(base::FilePath(), | 960 UserManager::Show(base::FilePath(), |
960 profiles::USER_MANAGER_NO_TUTORIAL, | 961 profiles::USER_MANAGER_NO_TUTORIAL, |
(...skipping 647 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1608 | 1609 |
1609 //--------------------------------------------------------------------------- | 1610 //--------------------------------------------------------------------------- |
1610 | 1611 |
1611 namespace app_controller_mac { | 1612 namespace app_controller_mac { |
1612 | 1613 |
1613 bool IsOpeningNewWindow() { | 1614 bool IsOpeningNewWindow() { |
1614 return g_is_opening_new_window; | 1615 return g_is_opening_new_window; |
1615 } | 1616 } |
1616 | 1617 |
1617 } // namespace app_controller_mac | 1618 } // namespace app_controller_mac |
OLD | NEW |