OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/process_singleton.h" | 5 #include "chrome/browser/process_singleton.h" |
6 | 6 |
7 #include "base/base_paths.h" | 7 #include "base/base_paths.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/file_path.h" | 9 #include "base/file_path.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
304 } | 304 } |
305 | 305 |
306 // Get command line. | 306 // Get command line. |
307 const std::wstring cmd_line = | 307 const std::wstring cmd_line = |
308 msg.substr(second_null + 1, third_null - second_null); | 308 msg.substr(second_null + 1, third_null - second_null); |
309 | 309 |
310 CommandLine parsed_command_line = CommandLine::FromString(cmd_line); | 310 CommandLine parsed_command_line = CommandLine::FromString(cmd_line); |
311 PrefService* prefs = g_browser_process->local_state(); | 311 PrefService* prefs = g_browser_process->local_state(); |
312 DCHECK(prefs); | 312 DCHECK(prefs); |
313 | 313 |
314 Profile* profile = ProfileManager::GetLastUsedProfile(); | |
315 if (!profile) { | |
316 // We should only be able to get here if the profile already exists and | |
317 // has been created. | |
318 NOTREACHED(); | |
319 return TRUE; | |
320 } | |
321 | |
322 // Handle the --uninstall-extension startup action. This needs to done here | 314 // Handle the --uninstall-extension startup action. This needs to done here |
323 // in the process that is running with the target profile, otherwise the | 315 // in the process that is running with the target profile, otherwise the |
324 // uninstall will fail to unload and remove all components. | 316 // uninstall will fail to unload and remove all components. |
325 if (parsed_command_line.HasSwitch(switches::kUninstallExtension)) { | 317 if (parsed_command_line.HasSwitch(switches::kUninstallExtension)) { |
| 318 // The uninstall extension switch can't be combined with the profile |
| 319 // directory switch. |
| 320 DCHECK(!parsed_command_line.HasSwitch(switches::kProfileDirectory)); |
| 321 |
| 322 Profile* profile = ProfileManager::GetLastUsedProfile(); |
| 323 if (!profile) { |
| 324 // We should only be able to get here if the profile already exists and |
| 325 // has been created. |
| 326 NOTREACHED(); |
| 327 return TRUE; |
| 328 } |
| 329 |
326 ExtensionsStartupUtil ext_startup_util; | 330 ExtensionsStartupUtil ext_startup_util; |
327 ext_startup_util.UninstallExtension(parsed_command_line, profile); | 331 ext_startup_util.UninstallExtension(parsed_command_line, profile); |
328 return TRUE; | 332 return TRUE; |
329 } | 333 } |
330 | 334 |
331 // Run the browser startup sequence again, with the command line of the | 335 // Run the browser startup sequence again, with the command line of the |
332 // signalling process. | 336 // signalling process. |
333 BrowserInit::ProcessCommandLine(parsed_command_line, cur_dir, false, | 337 BrowserInit::ProcessCommandLineAlreadyRunning(parsed_command_line, cur_dir); |
334 profile, NULL); | |
335 return TRUE; | 338 return TRUE; |
336 } | 339 } |
337 return TRUE; | 340 return TRUE; |
338 } | 341 } |
339 | 342 |
340 LRESULT CALLBACK ProcessSingleton::WndProc(HWND hwnd, UINT message, | 343 LRESULT CALLBACK ProcessSingleton::WndProc(HWND hwnd, UINT message, |
341 WPARAM wparam, LPARAM lparam) { | 344 WPARAM wparam, LPARAM lparam) { |
342 switch (message) { | 345 switch (message) { |
343 case WM_COPYDATA: | 346 case WM_COPYDATA: |
344 return OnCopyData(reinterpret_cast<HWND>(wparam), | 347 return OnCopyData(reinterpret_cast<HWND>(wparam), |
345 reinterpret_cast<COPYDATASTRUCT*>(lparam)); | 348 reinterpret_cast<COPYDATASTRUCT*>(lparam)); |
346 default: | 349 default: |
347 break; | 350 break; |
348 } | 351 } |
349 | 352 |
350 return ::DefWindowProc(hwnd, message, wparam, lparam); | 353 return ::DefWindowProc(hwnd, message, wparam, lparam); |
351 } | 354 } |
OLD | NEW |