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