aboutsummaryrefslogtreecommitdiff
path: root/AppKit/GTMNSWorkspace+Running.h
diff options
context:
space:
mode:
authorGravatar thomasvl@gmail.com <thomasvl@gmail.com@7dc7ac4e-7543-0410-b95c-c1676fc8e2a3>2009-01-09 20:34:30 +0000
committerGravatar thomasvl@gmail.com <thomasvl@gmail.com@7dc7ac4e-7543-0410-b95c-c1676fc8e2a3>2009-01-09 20:34:30 +0000
commit4fd103b5de98d2f469b982677ea389e7ee7d64b3 (patch)
treed0eb379fdc78996bc2e201515d26c7521d1fc8dc /AppKit/GTMNSWorkspace+Running.h
parent84d1232477f398339e48ea504c45048e9328ef9b (diff)
- turned off _debug framework support in tests since we now capture a lot more
in log validation. - Added GTM_SUPPORT_GC for controlling the inclusion of GC related code. - If you are using GTMUnitTestDevLog, it also tries to capture logs from NSAssert. - Added GTM_FOREACH_OBJECT/GTM_FOREACH_KEY that uses NSEnumerator and objectEnumerator/keyEnumerator on 10.4, but on 10.5+/iPhone uses FastEnumeration. - GTMNSWorkspace+Running gives a variety of ways of determining the attributes of running processes.
Diffstat (limited to 'AppKit/GTMNSWorkspace+Running.h')
-rw-r--r--AppKit/GTMNSWorkspace+Running.h80
1 files changed, 80 insertions, 0 deletions
diff --git a/AppKit/GTMNSWorkspace+Running.h b/AppKit/GTMNSWorkspace+Running.h
new file mode 100644
index 0000000..7e9dc6d
--- /dev/null
+++ b/AppKit/GTMNSWorkspace+Running.h
@@ -0,0 +1,80 @@
+//
+// GTMNSWorkspace+Running.h
+//
+// Copyright 2007-2008 Google Inc.
+//
+// Licensed under the Apache License, Version 2.0 (the "License"); you may not
+// use this file except in compliance with the License. You may obtain a copy
+// of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+// License for the specific language governing permissions and limitations under
+// the License.
+//
+
+#import <AppKit/AppKit.h>
+#import "GTMDefines.h"
+
+// Process Dictionary keys
+// Make sure to use numberToProcessSerialNumber: on the return values
+// of these keys to get valid PSNs on both Leopard and Tiger.
+// Numeric types come back as a NSNumber.
+GTM_EXTERN NSString *const kGTMWorkspaceRunningPSN; // long long
+GTM_EXTERN NSString *const kGTMWorkspaceRunningParentPSN; // long long
+
+GTM_EXTERN NSString *const kGTMWorkspaceRunningFlavor; // SInt32
+GTM_EXTERN NSString *const kGTMWorkspaceRunningAttributes; // SInt32
+GTM_EXTERN NSString *const kGTMWorkspaceRunningFileType; // NSString
+GTM_EXTERN NSString *const kGTMWorkspaceRunningFileCreator; // NSString
+GTM_EXTERN NSString *const kGTMWorkspaceRunningPID; // long
+GTM_EXTERN NSString *const kGTMWorkspaceRunningLSBackgroundOnly; // bool
+GTM_EXTERN NSString *const kGTMWorkspaceRunningLSUIElement; // bool
+GTM_EXTERN NSString *const kGTMWorkspaceRunningIsHidden; // bool
+GTM_EXTERN NSString *const kGTMWorkspaceRunningCheckedIn; // bool
+GTM_EXTERN NSString *const kGTMWorkspaceRunningLSUIPresentationMode; // Short
+GTM_EXTERN NSString *const kGTMWorkspaceRunningBundlePath; // NSString
+GTM_EXTERN NSString *const kGTMWorkspaceRunningBundleExecutable; // NSString
+GTM_EXTERN NSString *const kGTMWorkspaceRunningBundleName; // NSString
+GTM_EXTERN NSString *const kGTMWorkspaceRunningBundleIdentifier; // NSString
+GTM_EXTERN NSString *const kGTMWorkspaceRunningBundleVersion; // NSString
+
+// A category for getting information about other running processes
+@interface NSWorkspace (GTMWorkspaceRunningAdditions)
+
+// Returns a YES/NO if a process w/ the given identifier is running
+- (BOOL)gtm_isAppWithIdentifierRunning:(NSString *)identifier;
+
+// Returns a dictionary with info for our process.
+//See Process Dictionary Keys above for values
+- (NSDictionary *)gtm_processInfoDictionary;
+
+// Returns a dictionary with info for the active process.
+// See Process Dictionary Keys above for values
+- (NSDictionary *)gtm_processInfoDictionaryForActiveApp;
+
+// Returns a dictionary with info for the process.
+//See Process Dictionary Keys above for values
+- (NSDictionary *)gtm_processInfoDictionaryForPID:(pid_t)pid;
+
+// Returns a dictionary with info for the process.
+// See Process Dictionary Keys above for values
+- (NSDictionary *)gtm_processInfoDictionaryForPSN:(const ProcessSerialNumberPtr)psn;
+
+// Returns true if we were launched as a login item.
+- (BOOL)gtm_wasLaunchedAsLoginItem;
+
+// Returns true if we were launched by a given bundleid
+- (BOOL)gtm_wasLaunchedByProcess:(NSString*)bundleid;
+
+// Returns true if the PSN was found for the running app with bundleID
+- (BOOL)gtm_processSerialNumber:(ProcessSerialNumber*)outPSN
+ withBundleID:(NSString*)bundleID;
+
+// Converts PSNs stored in NSNumbers to real PSNs
+- (ProcessSerialNumber)gtm_numberToProcessSerialNumber:(NSNumber*)number;
+
+@end