OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/file_path.h" | 9 #include "base/file_path.h" |
10 #include "base/mac/foundation_util.h" | 10 #include "base/mac/foundation_util.h" |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 #import "chrome/browser/ui/cocoa/confirm_quit_panel_controller.h" | 47 #import "chrome/browser/ui/cocoa/confirm_quit_panel_controller.h" |
48 #import "chrome/browser/ui/cocoa/encoding_menu_controller_delegate_mac.h" | 48 #import "chrome/browser/ui/cocoa/encoding_menu_controller_delegate_mac.h" |
49 #import "chrome/browser/ui/cocoa/history_menu_bridge.h" | 49 #import "chrome/browser/ui/cocoa/history_menu_bridge.h" |
50 #import "chrome/browser/ui/cocoa/profile_menu_controller.h" | 50 #import "chrome/browser/ui/cocoa/profile_menu_controller.h" |
51 #import "chrome/browser/ui/cocoa/tabs/tab_strip_controller.h" | 51 #import "chrome/browser/ui/cocoa/tabs/tab_strip_controller.h" |
52 #import "chrome/browser/ui/cocoa/tabs/tab_window_controller.h" | 52 #import "chrome/browser/ui/cocoa/tabs/tab_window_controller.h" |
53 #include "chrome/browser/ui/cocoa/task_manager_mac.h" | 53 #include "chrome/browser/ui/cocoa/task_manager_mac.h" |
54 #include "chrome/common/chrome_notification_types.h" | 54 #include "chrome/common/chrome_notification_types.h" |
55 #include "chrome/common/chrome_paths_internal.h" | 55 #include "chrome/common/chrome_paths_internal.h" |
56 #include "chrome/common/chrome_switches.h" | 56 #include "chrome/common/chrome_switches.h" |
| 57 #include "chrome/common/cloud_print/cloud_print_class_mac.h" |
57 #include "chrome/common/mac/app_mode_common.h" | 58 #include "chrome/common/mac/app_mode_common.h" |
58 #include "chrome/common/pref_names.h" | 59 #include "chrome/common/pref_names.h" |
59 #include "chrome/common/service_messages.h" | 60 #include "chrome/common/service_messages.h" |
60 #include "chrome/common/url_constants.h" | 61 #include "chrome/common/url_constants.h" |
61 #include "content/browser/browser_thread.h" | 62 #include "content/browser/browser_thread.h" |
62 #include "content/browser/download/download_manager.h" | 63 #include "content/browser/download/download_manager.h" |
63 #include "content/browser/tab_contents/tab_contents.h" | 64 #include "content/browser/tab_contents/tab_contents.h" |
64 #include "content/browser/user_metrics.h" | 65 #include "content/browser/user_metrics.h" |
65 #include "content/common/cloud_print_class_mac.h" | |
66 #include "content/public/browser/notification_service.h" | 66 #include "content/public/browser/notification_service.h" |
67 #include "content/public/browser/notification_types.h" | 67 #include "content/public/browser/notification_types.h" |
68 #include "grit/chromium_strings.h" | 68 #include "grit/chromium_strings.h" |
69 #include "grit/generated_resources.h" | 69 #include "grit/generated_resources.h" |
70 #include "net/base/net_util.h" | 70 #include "net/base/net_util.h" |
71 #include "ui/base/l10n/l10n_util.h" | 71 #include "ui/base/l10n/l10n_util.h" |
72 #include "ui/base/l10n/l10n_util_mac.h" | 72 #include "ui/base/l10n/l10n_util_mac.h" |
73 #include "ui/base/models/accelerator_cocoa.h" | 73 #include "ui/base/models/accelerator_cocoa.h" |
74 | 74 |
75 // 10.6 adds a public API for the Spotlight-backed search menu item in the Help | 75 // 10.6 adds a public API for the Spotlight-backed search menu item in the Help |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 // user-data initialization until -applicationDidFinishLaunching:. | 193 // user-data initialization until -applicationDidFinishLaunching:. |
194 - (void)awakeFromNib { | 194 - (void)awakeFromNib { |
195 // We need to register the handlers early to catch events fired on launch. | 195 // We need to register the handlers early to catch events fired on launch. |
196 NSAppleEventManager* em = [NSAppleEventManager sharedAppleEventManager]; | 196 NSAppleEventManager* em = [NSAppleEventManager sharedAppleEventManager]; |
197 [em setEventHandler:self | 197 [em setEventHandler:self |
198 andSelector:@selector(getUrl:withReply:) | 198 andSelector:@selector(getUrl:withReply:) |
199 forEventClass:kInternetEventClass | 199 forEventClass:kInternetEventClass |
200 andEventID:kAEGetURL]; | 200 andEventID:kAEGetURL]; |
201 [em setEventHandler:self | 201 [em setEventHandler:self |
202 andSelector:@selector(submitCloudPrintJob:) | 202 andSelector:@selector(submitCloudPrintJob:) |
203 forEventClass:content::kAECloudPrintClass | 203 forEventClass:cloud_print::kAECloudPrintClass |
204 andEventID:content::kAECloudPrintClass]; | 204 andEventID:cloud_print::kAECloudPrintClass]; |
205 // Install and uninstall handlers for virtual drivers. | 205 // Install and uninstall handlers for virtual drivers. |
206 [em setEventHandler:self | 206 [em setEventHandler:self |
207 andSelector:@selector(installCloudPrint:) | 207 andSelector:@selector(installCloudPrint:) |
208 forEventClass:kAECloudPrintInstallClass | 208 forEventClass:kAECloudPrintInstallClass |
209 andEventID:kAECloudPrintInstallClass]; | 209 andEventID:kAECloudPrintInstallClass]; |
210 [em setEventHandler:self | 210 [em setEventHandler:self |
211 andSelector:@selector(uninstallCloudPrint:) | 211 andSelector:@selector(uninstallCloudPrint:) |
212 forEventClass:kAECloudPrintUninstallClass | 212 forEventClass:kAECloudPrintUninstallClass |
213 andEventID:kAECloudPrintUninstallClass]; | 213 andEventID:kAECloudPrintUninstallClass]; |
214 [em setEventHandler:self | 214 [em setEventHandler:self |
(...skipping 873 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1088 gurlVector.push_back(gurl); | 1088 gurlVector.push_back(gurl); |
1089 | 1089 |
1090 [self openUrls:gurlVector]; | 1090 [self openUrls:gurlVector]; |
1091 } | 1091 } |
1092 | 1092 |
1093 // Apple Event handler that receives print event from service | 1093 // Apple Event handler that receives print event from service |
1094 // process, gets the required data and launches Print dialog. | 1094 // process, gets the required data and launches Print dialog. |
1095 - (void)submitCloudPrintJob:(NSAppleEventDescriptor*)event { | 1095 - (void)submitCloudPrintJob:(NSAppleEventDescriptor*)event { |
1096 // Pull parameter list out of Apple Event. | 1096 // Pull parameter list out of Apple Event. |
1097 NSAppleEventDescriptor *paramList = | 1097 NSAppleEventDescriptor *paramList = |
1098 [event paramDescriptorForKeyword:content::kAECloudPrintClass]; | 1098 [event paramDescriptorForKeyword:cloud_print::kAECloudPrintClass]; |
1099 | 1099 |
1100 if (paramList != nil) { | 1100 if (paramList != nil) { |
1101 // Pull required fields out of parameter list. | 1101 // Pull required fields out of parameter list. |
1102 NSString* mime = [[paramList descriptorAtIndex:1] stringValue]; | 1102 NSString* mime = [[paramList descriptorAtIndex:1] stringValue]; |
1103 NSString* inputPath = [[paramList descriptorAtIndex:2] stringValue]; | 1103 NSString* inputPath = [[paramList descriptorAtIndex:2] stringValue]; |
1104 NSString* printTitle = [[paramList descriptorAtIndex:3] stringValue]; | 1104 NSString* printTitle = [[paramList descriptorAtIndex:3] stringValue]; |
1105 NSString* printTicket = [[paramList descriptorAtIndex:4] stringValue]; | 1105 NSString* printTicket = [[paramList descriptorAtIndex:4] stringValue]; |
1106 // Convert the title to UTF 16 as required. | 1106 // Convert the title to UTF 16 as required. |
1107 string16 title16 = base::SysNSStringToUTF16(printTitle); | 1107 string16 title16 = base::SysNSStringToUTF16(printTitle); |
1108 string16 printTicket16 = base::SysNSStringToUTF16(printTicket); | 1108 string16 printTicket16 = base::SysNSStringToUTF16(printTicket); |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1283 | 1283 |
1284 } // namespace browser | 1284 } // namespace browser |
1285 | 1285 |
1286 namespace app_controller_mac { | 1286 namespace app_controller_mac { |
1287 | 1287 |
1288 bool IsOpeningNewWindow() { | 1288 bool IsOpeningNewWindow() { |
1289 return g_is_opening_new_window; | 1289 return g_is_opening_new_window; |
1290 } | 1290 } |
1291 | 1291 |
1292 } // namespace app_controller_mac | 1292 } // namespace app_controller_mac |
OLD | NEW |