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/file_path.h" | 10 #include "base/file_path.h" |
(...skipping 907 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
918 } | 918 } |
919 | 919 |
920 // Run a (background) application in a new tab. | 920 // Run a (background) application in a new tab. |
921 - (void)executeApplication:(id)sender { | 921 - (void)executeApplication:(id)sender { |
922 NSInteger tag = [sender tag]; | 922 NSInteger tag = [sender tag]; |
923 Profile* profile = [self lastProfile]; | 923 Profile* profile = [self lastProfile]; |
924 DCHECK(profile); | 924 DCHECK(profile); |
925 BackgroundApplicationListModel applications(profile); | 925 BackgroundApplicationListModel applications(profile); |
926 DCHECK(tag >= 0 && | 926 DCHECK(tag >= 0 && |
927 tag < static_cast<int>(applications.size())); | 927 tag < static_cast<int>(applications.size())); |
928 const Extension* extension = applications.GetExtension(tag); | 928 const extensions::Extension* extension = applications.GetExtension(tag); |
929 BackgroundModeManager::LaunchBackgroundApplication(profile, extension); | 929 BackgroundModeManager::LaunchBackgroundApplication(profile, extension); |
930 } | 930 } |
931 | 931 |
932 // Same as |-commandDispatch:|, but executes commands using a disposition | 932 // Same as |-commandDispatch:|, but executes commands using a disposition |
933 // determined by the key flags. This will get called in the case where the | 933 // determined by the key flags. This will get called in the case where the |
934 // frontmost window is not a browser window, and the user has command-clicked | 934 // frontmost window is not a browser window, and the user has command-clicked |
935 // a button in a background browser window whose action is | 935 // a button in a background browser window whose action is |
936 // |-commandDispatchUsingKeyModifiers:| | 936 // |-commandDispatchUsingKeyModifiers:| |
937 - (void)commandDispatchUsingKeyModifiers:(id)sender { | 937 - (void)commandDispatchUsingKeyModifiers:(id)sender { |
938 DCHECK(sender); | 938 DCHECK(sender); |
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1232 // tests which use the mock in place of the profile-initialized model. | 1232 // tests which use the mock in place of the profile-initialized model. |
1233 | 1233 |
1234 // Avoid breaking unit tests which have no profile. | 1234 // Avoid breaking unit tests which have no profile. |
1235 if (profile) { | 1235 if (profile) { |
1236 BackgroundApplicationListModel applications(profile); | 1236 BackgroundApplicationListModel applications(profile); |
1237 if (applications.size()) { | 1237 if (applications.size()) { |
1238 int position = 0; | 1238 int position = 0; |
1239 NSString* menuStr = | 1239 NSString* menuStr = |
1240 l10n_util::GetNSStringWithFixup(IDS_BACKGROUND_APPS_MAC); | 1240 l10n_util::GetNSStringWithFixup(IDS_BACKGROUND_APPS_MAC); |
1241 scoped_nsobject<NSMenu> appMenu([[NSMenu alloc] initWithTitle:menuStr]); | 1241 scoped_nsobject<NSMenu> appMenu([[NSMenu alloc] initWithTitle:menuStr]); |
1242 for (ExtensionList::const_iterator cursor = applications.begin(); | 1242 for (extensions::ExtensionList::const_iterator cursor = |
| 1243 applications.begin(); |
1243 cursor != applications.end(); | 1244 cursor != applications.end(); |
1244 ++cursor, ++position) { | 1245 ++cursor, ++position) { |
1245 DCHECK_EQ(applications.GetPosition(*cursor), position); | 1246 DCHECK_EQ(applications.GetPosition(*cursor), position); |
1246 NSString* itemStr = | 1247 NSString* itemStr = |
1247 base::SysUTF16ToNSString(UTF8ToUTF16((*cursor)->name())); | 1248 base::SysUTF16ToNSString(UTF8ToUTF16((*cursor)->name())); |
1248 scoped_nsobject<NSMenuItem> appItem([[NSMenuItem alloc] | 1249 scoped_nsobject<NSMenuItem> appItem([[NSMenuItem alloc] |
1249 initWithTitle:itemStr | 1250 initWithTitle:itemStr |
1250 action:@selector(commandFromDock:) | 1251 action:@selector(commandFromDock:) |
1251 keyEquivalent:@""]); | 1252 keyEquivalent:@""]); |
1252 [appItem setTarget:self]; | 1253 [appItem setTarget:self]; |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1315 | 1316 |
1316 } // namespace browser | 1317 } // namespace browser |
1317 | 1318 |
1318 namespace app_controller_mac { | 1319 namespace app_controller_mac { |
1319 | 1320 |
1320 bool IsOpeningNewWindow() { | 1321 bool IsOpeningNewWindow() { |
1321 return g_is_opening_new_window; | 1322 return g_is_opening_new_window; |
1322 } | 1323 } |
1323 | 1324 |
1324 } // namespace app_controller_mac | 1325 } // namespace app_controller_mac |
OLD | NEW |