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

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

Issue 7215040: Fix relaunches on the Mac (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 6 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) 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 #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 #include <string.h> 8 #include <string.h>
9 #include <sys/utsname.h> 9 #include <sys/utsname.h>
10 10
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 void ActivateProcess(pid_t pid) { 235 void ActivateProcess(pid_t pid) {
236 ProcessSerialNumber process; 236 ProcessSerialNumber process;
237 OSStatus status = GetProcessForPID(pid, &process); 237 OSStatus status = GetProcessForPID(pid, &process);
238 if (status == noErr) { 238 if (status == noErr) {
239 SetFrontProcess(&process); 239 SetFrontProcess(&process);
240 } else { 240 } else {
241 LOG(WARNING) << "Unable to get process for pid " << pid; 241 LOG(WARNING) << "Unable to get process for pid " << pid;
242 } 242 }
243 } 243 }
244 244
245 bool AmIForeground() {
246 ProcessSerialNumber foreground_psn = { 0 };
247 OSErr err = GetFrontProcess(&foreground_psn);
248 if (err != noErr) {
249 LOG(WARNING) << "GetFrontProcess: " << err;
250 return false;
251 }
252
253 ProcessSerialNumber my_psn = { 0, kCurrentProcess };
254
255 Boolean result = FALSE;
256 err = SameProcess(&foreground_psn, &my_psn, &result);
257 if (err != noErr) {
258 LOG(WARNING) << "SameProcess: " << err;
259 return false;
260 }
261
262 return result;
263 }
264
245 bool SetFileBackupExclusion(const FilePath& file_path) { 265 bool SetFileBackupExclusion(const FilePath& file_path) {
246 NSString* file_path_ns = 266 NSString* file_path_ns =
247 [NSString stringWithUTF8String:file_path.value().c_str()]; 267 [NSString stringWithUTF8String:file_path.value().c_str()];
248 NSURL* file_url = [NSURL fileURLWithPath:file_path_ns]; 268 NSURL* file_url = [NSURL fileURLWithPath:file_path_ns];
249 269
250 // When excludeByPath is true the application must be running with root 270 // When excludeByPath is true the application must be running with root
251 // privileges (admin for 10.6 and earlier) but the URL does not have to 271 // privileges (admin for 10.6 and earlier) but the URL does not have to
252 // already exist. When excludeByPath is false the URL must already exist but 272 // already exist. When excludeByPath is false the URL must already exist but
253 // can be used in non-root (or admin as above) mode. We use false so that 273 // can be used in non-root (or admin as above) mode. We use false so that
254 // non-root (or admin) users don't get their TimeMachine drive filled up with 274 // non-root (or admin) users don't get their TimeMachine drive filled up with
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after
588 #endif 608 #endif
589 609
590 #if !defined(BASE_MAC_MAC_UTIL_H_INLINED_GT_10_7) 610 #if !defined(BASE_MAC_MAC_UTIL_H_INLINED_GT_10_7)
591 bool IsOSLaterThanLion() { 611 bool IsOSLaterThanLion() {
592 return MacOSXMinorVersion() > LION_MINOR_VERSION; 612 return MacOSXMinorVersion() > LION_MINOR_VERSION;
593 } 613 }
594 #endif 614 #endif
595 615
596 } // namespace mac 616 } // namespace mac
597 } // namespace base 617 } // namespace base
OLDNEW
« no previous file with comments | « base/mac/mac_util.h ('k') | chrome/app/chrome_main.cc » ('j') | chrome/common/chrome_switches.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698