Index: chrome/browser/process_singleton_win.cc |
diff --git a/chrome/browser/process_singleton_win.cc b/chrome/browser/process_singleton_win.cc |
index fc55aac7a49da6a507b46cfd219f835ba3b4ae93..bfa7c01f49add5a1cd49c33c12b9ddc92623a37e 100644 |
--- a/chrome/browser/process_singleton_win.cc |
+++ b/chrome/browser/process_singleton_win.cc |
@@ -12,15 +12,8 @@ |
#include "base/utf_string_conversions.h" |
#include "base/win/scoped_handle.h" |
#include "base/win/wrapped_window_proc.h" |
-#include "chrome/browser/browser_process.h" |
-#include "chrome/browser/extensions/extensions_startup.h" |
-#include "chrome/browser/profiles/profile.h" |
-#include "chrome/browser/profiles/profile_manager.h" |
#include "chrome/browser/simple_message_box.h" |
-#include "chrome/browser/ui/browser_init.h" |
#include "chrome/common/chrome_constants.h" |
-#include "chrome/common/chrome_paths.h" |
-#include "chrome/common/chrome_switches.h" |
#include "chrome/installer/util/wmi.h" |
#include "content/public/common/result_codes.h" |
#include "grit/chromium_strings.h" |
@@ -193,9 +186,6 @@ ProcessSingleton::ProcessSingleton(const FilePath& user_data_dir) |
ATOM clazz = ::RegisterClassEx(&wc); |
DCHECK(clazz); |
- FilePath user_data_dir; |
- PathService::Get(chrome::DIR_USER_DATA, &user_data_dir); |
- |
// Set the window's title to the path of our user data directory so other |
// Chrome instances can decide if they should forward to us or not. |
window_ = ::CreateWindow(MAKEINTATOM(clazz), |
@@ -289,19 +279,26 @@ ProcessSingleton::NotifyResult ProcessSingleton::NotifyOtherProcess() { |
return PROCESS_NONE; |
} |
-ProcessSingleton::NotifyResult ProcessSingleton::NotifyOtherProcessOrCreate() { |
+ProcessSingleton::NotifyResult ProcessSingleton::NotifyOtherProcessOrCreate( |
+ const NotificationCallback& notification_callback) { |
NotifyResult result = NotifyOtherProcess(); |
if (result != PROCESS_NONE) |
return result; |
- return window_ ? PROCESS_NONE : PROFILE_IN_USE; |
+ return Create(notification_callback) ? PROCESS_NONE : PROFILE_IN_USE; |
} |
// On Windows, there is no need to call Create() since the message |
// window is created in the constructor but to avoid having more |
// platform specific code in browser_main.cc we tolerate calls to |
-// Create(), which will do nothing. |
-bool ProcessSingleton::Create() { |
+// Create(). |
+bool ProcessSingleton::Create( |
+ const NotificationCallback& notification_callback) { |
DCHECK(!remote_window_); |
+ DCHECK(notification_callback_.is_null()); |
+ |
+ if (window_ != NULL) |
+ notification_callback_ = notification_callback; |
+ |
return window_ != NULL; |
} |
@@ -343,18 +340,12 @@ LRESULT ProcessSingleton::OnCopyData(HWND hwnd, const COPYDATASTRUCT* cds) { |
return TRUE; |
} |
- // Ignore the request if the browser process is already in shutdown path. |
- if (!g_browser_process || g_browser_process->IsShuttingDown()) { |
- LOG(WARNING) << "Not handling WM_COPYDATA as browser is shutting down"; |
- return FALSE; |
- } |
- |
CommandLine parsed_command_line(CommandLine::NO_PROGRAM); |
FilePath current_directory; |
if (!ParseCommandLine(cds, &parsed_command_line, ¤t_directory)) |
return TRUE; |
- ProcessCommandLine(parsed_command_line, current_directory); |
- return TRUE; |
+ return notification_callback_.Run(parsed_command_line, current_directory) ? |
+ TRUE : FALSE; |
} |
LRESULT ProcessSingleton::WndProc(HWND hwnd, UINT message, |
@@ -369,35 +360,3 @@ LRESULT ProcessSingleton::WndProc(HWND hwnd, UINT message, |
return ::DefWindowProc(hwnd, message, wparam, lparam); |
} |
- |
-void ProcessSingleton::ProcessCommandLine(const CommandLine& command_line, |
- const FilePath& current_directory) { |
- PrefService* prefs = g_browser_process->local_state(); |
- DCHECK(prefs); |
- |
- // Handle the --uninstall-extension startup action. This needs to done here |
- // in the process that is running with the target profile, otherwise the |
- // uninstall will fail to unload and remove all components. |
- if (command_line.HasSwitch(switches::kUninstallExtension)) { |
- // The uninstall extension switch can't be combined with the profile |
- // directory switch. |
- DCHECK(!command_line.HasSwitch(switches::kProfileDirectory)); |
- |
- Profile* profile = ProfileManager::GetLastUsedProfile(); |
- if (!profile) { |
- // We should only be able to get here if the profile already exists and |
- // has been created. |
- NOTREACHED(); |
- return; |
- } |
- |
- ExtensionsStartupUtil ext_startup_util; |
- ext_startup_util.UninstallExtension(command_line, profile); |
- return; |
- } |
- |
- // Run the browser startup sequence again, with the command line of the |
- // signalling process. |
- BrowserInit::ProcessCommandLineAlreadyRunning(command_line, |
- current_directory); |
-} |