diff options
Diffstat (limited to 'base')
-rw-r--r-- | base/mac_util.h | 3 | ||||
-rw-r--r-- | base/mac_util.mm | 10 |
2 files changed, 13 insertions, 0 deletions
diff --git a/base/mac_util.h b/base/mac_util.h index 3c99b2a..093ae63 100644 --- a/base/mac_util.h +++ b/base/mac_util.h @@ -75,6 +75,9 @@ void RequestFullScreen(); // this will show the menu bar. Must be called on main thread. void ReleaseFullScreen(); +// Activates the process with the given PID. +void ActivateProcess(pid_t); + // Pulls a snapshot of the entire browser into png_representation. void GrabWindowSnapshot(NSWindow* window, std::vector<unsigned char>* png_representation); diff --git a/base/mac_util.mm b/base/mac_util.mm index 3ffab82..de07c88 100644 --- a/base/mac_util.mm +++ b/base/mac_util.mm @@ -178,4 +178,14 @@ void GrabWindowSnapshot(NSWindow* window, } } +void ActivateProcess(pid_t pid) { + ProcessSerialNumber process; + OSStatus status = GetProcessForPID(pid, &process); + if (status == noErr) { + SetFrontProcess(&process); + } else { + LOG(WARNING) << "Unable to get process for pid " << pid; + } +} + } // namespace mac_util |