Close the "try chrome again" modal dialog upon rendezvous.

Chrome will continue startup, handling the command line from the other
process.

BUG=717091

Change-Id: Ifb496c84f29853314ad752d6047fcf9b5b257bbe
Reviewed-on: https://chromium-review.googlesource.com/647527
Commit-Queue: Greg Thompson <[email protected]>
Reviewed-by: Nico Weber <[email protected]>
Cr-Commit-Position: refs/heads/master@{#499785}
diff --git a/chrome/browser/chrome_process_singleton.h b/chrome/browser/chrome_process_singleton.h
index 7d62731..71df237 100644
--- a/chrome/browser/chrome_process_singleton.h
+++ b/chrome/browser/chrome_process_singleton.h
@@ -5,39 +5,31 @@
 #ifndef CHROME_BROWSER_CHROME_PROCESS_SINGLETON_H_
 #define CHROME_BROWSER_CHROME_PROCESS_SINGLETON_H_
 
+#include "base/callback.h"
 #include "base/files/file_path.h"
 #include "base/macros.h"
 #include "chrome/browser/process_singleton.h"
 #include "chrome/browser/process_singleton_modal_dialog_lock.h"
 #include "chrome/browser/process_singleton_startup_lock.h"
-#include "ui/gfx/native_widget_types.h"
 
 // Composes a basic ProcessSingleton with ProcessSingletonStartupLock and
 // ProcessSingletonModalDialogLock.
 //
-// Notifications from ProcessSingleton will be discarded if a modal dialog is
-// active. Otherwise, until |Unlock()| is called, they will be queued up.
-// Once unlocked, notifications will be passed to the client-supplied
+// Notifications from ProcessSingleton will first close a modal dialog if
+// active. Otherwise, until |Unlock()| is called, they will be queued up. Once
+// unlocked, notifications will be passed to the client-supplied
 // NotificationCallback.
 //
-// The client must ensure that SetActiveModalDialog is called appropriately when
-// dialogs are displayed or dismissed during startup. While a dialog is active:
-// 1. Neither this process nor the invoking process will handle the command
-//    line.
-// 2. The active dialog is brought to the foreground and/or the taskbar icon
-//    flashed (using ::SetForegroundWindow on Windows).
+// The client must ensure that SetModalDialogNotificationHandler is called
+// appropriately when dialogs are displayed or dismissed during startup. If a
+// dialog is active, it is closed (via the provided handler) and then the
+// notification is processed as normal.
 class ChromeProcessSingleton {
  public:
   ChromeProcessSingleton(
       const base::FilePath& user_data_dir,
       const ProcessSingleton::NotificationCallback& notification_callback);
 
-  ChromeProcessSingleton(
-      const base::FilePath& user_data_dir,
-      const ProcessSingleton::NotificationCallback& notification_callback,
-      const ProcessSingletonModalDialogLock::SetForegroundWindowHandler&
-          set_foreground_window_handler);
-
   ~ChromeProcessSingleton();
 
   // Notify another process, if available. Otherwise sets ourselves as the
@@ -50,9 +42,9 @@
   // Clear any lock state during shutdown.
   void Cleanup();
 
-  // Receives a handle to the active modal dialog, or NULL if the active dialog
-  // is dismissed.
-  void SetActiveModalDialog(gfx::NativeWindow active_dialog);
+  // Receives a callback to be run to close the active modal dialog, or an empty
+  // closure if the active dialog is dismissed.
+  void SetModalDialogNotificationHandler(base::Closure notification_handler);
 
   // Executes previously queued command-line invocations and allows future
   // invocations to be executed immediately.