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

Side by Side Diff: base/mac/mac_util.mm

Issue 2433773008: Suppress a declarated-declaration warning for GetProcessInformation. (Closed)
Patch Set: remove whitespace. Created 4 years, 2 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "base/mac/mac_util.h" 5 #include "base/mac/mac_util.h"
6 6
7 #import <Cocoa/Cocoa.h> 7 #import <Cocoa/Cocoa.h>
8 #import <IOKit/IOKitLib.h> 8 #import <IOKit/IOKitLib.h>
9 #include <errno.h> 9 #include <errno.h>
10 #include <stddef.h> 10 #include <stddef.h>
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 } 289 }
290 290
291 LSSharedFileListItemRemove(login_items, item); 291 LSSharedFileListItemRemove(login_items, item);
292 } 292 }
293 293
294 bool WasLaunchedAsLoginOrResumeItem() { 294 bool WasLaunchedAsLoginOrResumeItem() {
295 ProcessSerialNumber psn = { 0, kCurrentProcess }; 295 ProcessSerialNumber psn = { 0, kCurrentProcess };
296 ProcessInfoRec info = {}; 296 ProcessInfoRec info = {};
297 info.processInfoLength = sizeof(info); 297 info.processInfoLength = sizeof(info);
298 298
299 // GetProcessInformation has been deprecated since macOS 10.9, but there is no
300 // replacement that provides the information we need. See
301 // https://crbug.com/650854.
302 #pragma clang diagnostic push
303 #pragma clang diagnostic ignored "-Wdeprecated-declarations"
299 if (GetProcessInformation(&psn, &info) == noErr) { 304 if (GetProcessInformation(&psn, &info) == noErr) {
305 #pragma clang diagnostic pop
300 ProcessInfoRec parent_info = {}; 306 ProcessInfoRec parent_info = {};
301 parent_info.processInfoLength = sizeof(parent_info); 307 parent_info.processInfoLength = sizeof(parent_info);
302 if (GetProcessInformation(&info.processLauncher, &parent_info) == noErr) 308 #pragma clang diagnostic push
309 #pragma clang diagnostic ignored "-Wdeprecated-declarations"
310 if (GetProcessInformation(&info.processLauncher, &parent_info) == noErr) {
311 #pragma clang diagnostic pop
303 return parent_info.processSignature == 'lgnw'; 312 return parent_info.processSignature == 'lgnw';
313 }
304 } 314 }
305 return false; 315 return false;
306 } 316 }
307 317
308 bool WasLaunchedAsLoginItemRestoreState() { 318 bool WasLaunchedAsLoginItemRestoreState() {
309 // "Reopen windows..." option was added for Lion. Prior OS versions should 319 // "Reopen windows..." option was added for Lion. Prior OS versions should
310 // not have this behavior. 320 // not have this behavior.
311 if (!WasLaunchedAsLoginOrResumeItem()) 321 if (!WasLaunchedAsLoginOrResumeItem())
312 return false; 322 return false;
313 323
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
462 StringPiece(begin + comma_loc + 1, ident.end()), &minor_tmp)) 472 StringPiece(begin + comma_loc + 1, ident.end()), &minor_tmp))
463 return false; 473 return false;
464 *type = ident.substr(0, number_loc); 474 *type = ident.substr(0, number_loc);
465 *major = major_tmp; 475 *major = major_tmp;
466 *minor = minor_tmp; 476 *minor = minor_tmp;
467 return true; 477 return true;
468 } 478 }
469 479
470 } // namespace mac 480 } // namespace mac
471 } // namespace base 481 } // namespace base
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698