Index: chrome/browser/process_singleton.h |
diff --git a/chrome/browser/process_singleton.h b/chrome/browser/process_singleton.h |
index 504f2ad155f9064293acb0901427367da89f7a39..d85d82efc33a8209c2225a9ce940b3c2778d9535 100644 |
--- a/chrome/browser/process_singleton.h |
+++ b/chrome/browser/process_singleton.h |
@@ -67,16 +67,6 @@ class ProcessSingleton : public base::NonThreadSafe { |
explicit ProcessSingleton(const FilePath& user_data_dir); |
~ProcessSingleton(); |
- // Notify another process, if available. |
- // Returns true if another process was found and notified, false if we |
- // should continue with this process. |
- // Windows code roughly based on Mozilla. |
- // |
- // TODO(brettw): this will not handle all cases. If two process start up too |
- // close to each other, the Create() might not yet have happened for the |
- // first one, so this function won't find it. |
- NotifyResult NotifyOtherProcess(); |
- |
// Notify another process, if available. Otherwise sets ourselves as the |
// singleton instance and stores the provided callback for notification from |
// future processes. Returns PROCESS_NONE if we became the singleton |
@@ -84,27 +74,16 @@ class ProcessSingleton : public base::NonThreadSafe { |
NotifyResult NotifyOtherProcessOrCreate( |
const NotificationCallback& notification_callback); |
-#if defined(OS_LINUX) || defined(OS_OPENBSD) |
- // Exposed for testing. We use a timeout on Linux, and in tests we want |
- // this timeout to be short. |
- NotifyResult NotifyOtherProcessWithTimeout(const CommandLine& command_line, |
- int timeout_seconds, |
- bool kill_unresponsive); |
- NotifyResult NotifyOtherProcessWithTimeoutOrCreate( |
- const CommandLine& command_line, |
- const NotificationCallback& notification_callback, |
- int timeout_seconds); |
- void OverrideCurrentPidForTesting(base::ProcessId pid); |
- void OverrideKillCallbackForTesting(const base::Callback<void(int)>& callback); |
- static void DisablePromptForTesting(); |
-#endif // defined(OS_LINUX) || defined(OS_OPENBSD) |
- |
- // Sets ourself up as the singleton instance. Returns true on success. If |
- // false is returned, we are not the singleton instance and the caller must |
- // exit. Otherwise, stores the provided callback for notification from |
- // future processes. |
- bool Create( |
- const NotificationCallback& notification_callback); |
+#if defined(OS_WIN) |
+ // Used in specific cases to let us know that there is an existing instance |
+ // of Chrome running with this profile. In general, you should not use this |
+ // function. Instead consider using NotifyOtherProcessOrCreate(). |
+ // For non profile-specific method, use |
+ // browser_util::IsBrowserAlreadyRunning(). |
+ bool FoundOtherProcessWindow() const { |
+ return (NULL != remote_window_); |
+ } |
+#endif // defined(OS_WIN) |
// Clear any lock state during shutdown. |
void Cleanup(); |
@@ -137,6 +116,44 @@ class ProcessSingleton : public base::NonThreadSafe { |
LRESULT WndProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam); |
#endif |
+#if defined(OS_LINUX) || defined(OS_OPENBSD) |
+ static void DisablePromptForTesting(); |
+#endif // defined(OS_LINUX) || defined(OS_OPENBSD) |
+ |
+ protected: |
+ // Notify another process, if available. |
+ // Returns true if another process was found and notified, false if we |
+ // should continue with this process. |
+ // Windows code roughly based on Mozilla. |
+ // |
+ // TODO(brettw): this will not handle all cases. If two processes start up too |
+ // close to each other, the Create() might not yet have happened for the |
+ // first one, so this function won't find it. |
+ virtual NotifyResult NotifyOtherProcess(); |
+ |
+ // Sets ourself up as the singleton instance. Returns true on success. If |
+ // false is returned, we are not the singleton instance and the caller must |
+ // exit. Otherwise, stores the provided callback for notification from |
+ // future processes. |
+ virtual bool Create( |
+ const NotificationCallback& notification_callback); |
+ |
+#if defined(OS_LINUX) || defined(OS_OPENBSD) |
+ // Exposed for testing. We use a timeout on Linux, and in tests we want |
+ // this timeout to be short. |
+ virtual NotifyResult NotifyOtherProcessWithTimeout( |
+ const CommandLine& command_line, |
+ int timeout_seconds, |
+ bool kill_unresponsive); |
+ virtual NotifyResult NotifyOtherProcessWithTimeoutOrCreate( |
+ const CommandLine& command_line, |
+ const NotificationCallback& notification_callback, |
+ int timeout_seconds); |
+ virtual void OverrideCurrentPidForTesting(base::ProcessId pid); |
+ virtual void OverrideKillCallbackForTesting( |
+ const base::Callback<void(int)>& callback); |
+#endif // defined(OS_LINUX) || defined(OS_OPENBSD) |
+ |
private: |
typedef std::pair<CommandLine::StringVector, FilePath> DelayedStartupMessage; |