OLD | NEW |
---|---|
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "chrome/browser/cocoa/authorization_util.h" | 5 #include "chrome/browser/cocoa/authorization_util.h" |
6 | 6 |
7 #import <Foundation/Foundation.h> | 7 #import <Foundation/Foundation.h> |
8 #include <sys/wait.h> | 8 #include <sys/wait.h> |
9 | 9 |
10 #include <string> | 10 #include <string> |
(...skipping 30 matching lines...) Expand all Loading... | |
41 // product_logo_32.png is used instead of app.icns because Authorization | 41 // product_logo_32.png is used instead of app.icns because Authorization |
42 // Services can't deal with .icns files. | 42 // Services can't deal with .icns files. |
43 NSString* icon_path = | 43 NSString* icon_path = |
44 [mac_util::MainAppBundle() pathForResource:@"product_logo_32" | 44 [mac_util::MainAppBundle() pathForResource:@"product_logo_32" |
45 ofType:@"png"]; | 45 ofType:@"png"]; |
46 const char* icon_path_c = [icon_path fileSystemRepresentation]; | 46 const char* icon_path_c = [icon_path fileSystemRepresentation]; |
47 size_t icon_path_length = icon_path_c ? strlen(icon_path_c) : 0; | 47 size_t icon_path_length = icon_path_c ? strlen(icon_path_c) : 0; |
48 | 48 |
49 // The OS will append " Type an administrator's name and password to allow | 49 // The OS will append " Type an administrator's name and password to allow |
50 // <CFBundleDisplayName> to make changes." | 50 // <CFBundleDisplayName> to make changes." |
51 NSString* prompt_ns = reinterpret_cast<const NSString*>(prompt); | 51 NSString* prompt_ns = const_cast<NSString*>( |
Mark Mentovai
2010/09/22 16:38:36
Double casts are worse, readability-wise, than a C
| |
52 reinterpret_cast<const NSString*>(prompt)); | |
52 const char* prompt_c = [prompt_ns UTF8String]; | 53 const char* prompt_c = [prompt_ns UTF8String]; |
53 size_t prompt_length = prompt_c ? strlen(prompt_c) : 0; | 54 size_t prompt_length = prompt_c ? strlen(prompt_c) : 0; |
54 | 55 |
55 AuthorizationItem environment_items[] = { | 56 AuthorizationItem environment_items[] = { |
56 {kAuthorizationEnvironmentIcon, icon_path_length, (void*)icon_path_c, 0}, | 57 {kAuthorizationEnvironmentIcon, icon_path_length, (void*)icon_path_c, 0}, |
57 {kAuthorizationEnvironmentPrompt, prompt_length, (void*)prompt_c, 0} | 58 {kAuthorizationEnvironmentPrompt, prompt_length, (void*)prompt_c, 0} |
58 }; | 59 }; |
59 | 60 |
60 AuthorizationEnvironment environment = {arraysize(environment_items), | 61 AuthorizationEnvironment environment = {arraysize(environment_items), |
61 environment_items}; | 62 environment_items}; |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
174 *exit_status_pointer = -1; | 175 *exit_status_pointer = -1; |
175 } | 176 } |
176 } else { | 177 } else { |
177 *exit_status_pointer = -1; | 178 *exit_status_pointer = -1; |
178 } | 179 } |
179 | 180 |
180 return status; | 181 return status; |
181 } | 182 } |
182 | 183 |
183 } // namespace authorization_util | 184 } // namespace authorization_util |
OLD | NEW |