Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(47)

Side by Side Diff: cloud_print/virtual_driver/posix/printer_driver_util_mac.mm

Issue 9235084: Add OSSTATUS_LOG API (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 8 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 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 #include "cloud_print/virtual_driver/posix/printer_driver_util_posix.h" 5 #include "cloud_print/virtual_driver/posix/printer_driver_util_posix.h"
6 6
7 #import <ApplicationServices/ApplicationServices.h> 7 #import <ApplicationServices/ApplicationServices.h>
8 #import <CoreServices/CoreServices.h> 8 #import <CoreServices/CoreServices.h>
9 #import <Foundation/NSAutoreleasePool.h> 9 #import <Foundation/NSAutoreleasePool.h>
10 #import <Foundation/NSAppleEventDescriptor.h> 10 #import <Foundation/NSAppleEventDescriptor.h>
11 #import <ScriptingBridge/SBApplication.h> 11 #import <ScriptingBridge/SBApplication.h>
12 12
13 #include "base/logging.h" 13 #include "base/logging.h"
14 #include "base/mac/foundation_util.h" 14 #include "base/mac/foundation_util.h"
15 #include "base/mac/mac_logging.h"
15 16
16 #include <cups/backend.h> 17 #include <cups/backend.h>
17 18
18 #include <stdlib.h> 19 #include <stdlib.h>
19 #include <string> 20 #include <string>
20 21
21 // Duplicated is chrome/common/cloud_print/cloud_print_class_mac.h 22 // Duplicated is chrome/common/cloud_print/cloud_print_class_mac.h
22 const AEEventClass kAECloudPrintClass = 'GCPp'; 23 const AEEventClass kAECloudPrintClass = 'GCPp';
23 24
24 namespace cloud_print { 25 namespace cloud_print {
(...skipping 28 matching lines...) Expand all
53 CFStringRef bundleIDCF = CFStringCreateWithCString( 54 CFStringRef bundleIDCF = CFStringCreateWithCString(
54 NULL, 55 NULL,
55 bundleID.c_str(), 56 bundleID.c_str(),
56 kCFStringEncodingUTF8); 57 kCFStringEncodingUTF8);
57 CFURLRef* kDontWantURL = NULL; 58 CFURLRef* kDontWantURL = NULL;
58 // Locate the service process with the help of the bundle ID. 59 // Locate the service process with the help of the bundle ID.
59 status = LSFindApplicationForInfo(kLSUnknownCreator, bundleIDCF, 60 status = LSFindApplicationForInfo(kLSUnknownCreator, bundleIDCF,
60 NULL, &ref, kDontWantURL); 61 NULL, &ref, kDontWantURL);
61 62
62 if (status != noErr) { 63 if (status != noErr) {
63 LOG(ERROR) << "Couldn't locate the process to send Apple Event"; 64 OSSTATUS_LOG(ERROR, status)
65 << "Couldn't locate the process to send Apple Event";
64 exit(CUPS_BACKEND_CANCEL); 66 exit(CUPS_BACKEND_CANCEL);
65 } 67 }
66 68
67 // Create the actual Apple Event. 69 // Create the actual Apple Event.
68 NSAppleEventDescriptor* event = 70 NSAppleEventDescriptor* event =
69 [NSAppleEventDescriptor appleEventWithEventClass:kAECloudPrintClass 71 [NSAppleEventDescriptor appleEventWithEventClass:kAECloudPrintClass
70 eventID:kAECloudPrintClass 72 eventID:kAECloudPrintClass
71 targetDescriptor:nil 73 targetDescriptor:nil
72 returnID:kAutoGenerateReturnID 74 returnID:kAutoGenerateReturnID
73 transactionID:kAnyTransactionID]; 75 transactionID:kAnyTransactionID];
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 // Set the application launch parameters. 110 // Set the application launch parameters.
109 // We are just using launch services to deliver our Apple Event. 111 // We are just using launch services to deliver our Apple Event.
110 LSApplicationParameters params = { 112 LSApplicationParameters params = {
111 0, kLSLaunchDefaults , &ref, NULL, NULL, NULL, NULL }; 113 0, kLSLaunchDefaults , &ref, NULL, NULL, NULL, NULL };
112 114
113 AEDesc* initialEvent = const_cast<AEDesc*> ([event aeDesc]); 115 AEDesc* initialEvent = const_cast<AEDesc*> ([event aeDesc]);
114 params.initialEvent = static_cast<AppleEvent*> (initialEvent); 116 params.initialEvent = static_cast<AppleEvent*> (initialEvent);
115 // Deliver the Apple Event using launch services. 117 // Deliver the Apple Event using launch services.
116 status = LSOpenApplication(&params, NULL); 118 status = LSOpenApplication(&params, NULL);
117 if (status != noErr) { 119 if (status != noErr) {
118 LOG(ERROR) << "Unable to launch"; 120 OSSTATUS_LOG(ERROR, status) << "Unable to launch";
119 LOG(ERROR) << GetMacOSStatusErrorString(status);
120 LOG(ERROR) << GetMacOSStatusCommentString(status);
121 exit(CUPS_BACKEND_CANCEL); 121 exit(CUPS_BACKEND_CANCEL);
122 } 122 }
123 123
124 [pool release]; 124 [pool release];
125 return; 125 return;
126 } 126 }
127 127
128 } // namespace printer_driver_util 128 } // namespace printer_driver_util
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698