OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <shellapi.h> | 7 #include <shellapi.h> |
8 #include <shobjidl.h> | 8 #include <shobjidl.h> |
9 | 9 |
10 #include "base/base_paths.h" | 10 #include "base/base_paths.h" |
11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
12 #include "base/file_path.h" | 12 #include "base/file_path.h" |
13 #include "base/path_service.h" | 13 #include "base/path_service.h" |
14 #include "base/process_util.h" | 14 #include "base/process_util.h" |
15 #include "base/stringprintf.h" | 15 #include "base/stringprintf.h" |
16 #include "base/utf_string_conversions.h" | 16 #include "base/utf_string_conversions.h" |
17 #include "base/win/metro.h" | 17 #include "base/win/metro.h" |
18 #include "base/win/registry.h" | 18 #include "base/win/registry.h" |
19 #include "base/win/scoped_com_initializer.h" | 19 #include "base/win/scoped_com_initializer.h" |
20 #include "base/win/scoped_comptr.h" | 20 #include "base/win/scoped_comptr.h" |
21 #include "base/win/scoped_handle.h" | 21 #include "base/win/scoped_handle.h" |
22 #include "base/win/win_util.h" | 22 #include "base/win/win_util.h" |
23 #include "base/win/windows_version.h" | 23 #include "base/win/windows_version.h" |
24 #include "base/win/wrapped_window_proc.h" | 24 #include "base/win/wrapped_window_proc.h" |
| 25 #include "chrome/browser/browser_process.h" |
25 #include "chrome/browser/shell_integration.h" | 26 #include "chrome/browser/shell_integration.h" |
26 #include "chrome/browser/ui/simple_message_box.h" | 27 #include "chrome/browser/ui/simple_message_box.h" |
27 #include "chrome/common/chrome_constants.h" | 28 #include "chrome/common/chrome_constants.h" |
28 #include "chrome/common/chrome_paths.h" | 29 #include "chrome/common/chrome_paths.h" |
29 #include "chrome/common/chrome_paths_internal.h" | 30 #include "chrome/common/chrome_paths_internal.h" |
30 #include "chrome/common/chrome_switches.h" | 31 #include "chrome/common/chrome_switches.h" |
31 #include "chrome/installer/util/browser_distribution.h" | 32 #include "chrome/installer/util/browser_distribution.h" |
32 #include "chrome/installer/util/install_util.h" | 33 #include "chrome/installer/util/install_util.h" |
33 #include "chrome/installer/util/shell_util.h" | 34 #include "chrome/installer/util/shell_util.h" |
34 #include "chrome/installer/util/wmi.h" | 35 #include "chrome/installer/util/wmi.h" |
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
361 ::UnregisterClass(chrome::kMessageWindowClass, | 362 ::UnregisterClass(chrome::kMessageWindowClass, |
362 base::GetModuleFromAddress(&ThunkWndProc)); | 363 base::GetModuleFromAddress(&ThunkWndProc)); |
363 } | 364 } |
364 if (lock_file_ != INVALID_HANDLE_VALUE) | 365 if (lock_file_ != INVALID_HANDLE_VALUE) |
365 CloseHandle(lock_file_); | 366 CloseHandle(lock_file_); |
366 } | 367 } |
367 | 368 |
368 ProcessSingleton::NotifyResult ProcessSingleton::NotifyOtherProcess() { | 369 ProcessSingleton::NotifyResult ProcessSingleton::NotifyOtherProcess() { |
369 if (is_virtualized_) | 370 if (is_virtualized_) |
370 return PROCESS_NOTIFIED; // We already spawned the process in this case. | 371 return PROCESS_NOTIFIED; // We already spawned the process in this case. |
371 if (lock_file_ == INVALID_HANDLE_VALUE && !remote_window_) | 372 if (lock_file_ == INVALID_HANDLE_VALUE && !remote_window_) { |
372 return LOCK_ERROR; | 373 return LOCK_ERROR; |
373 else if (!remote_window_) | 374 } else if (!remote_window_) { |
| 375 g_browser_process->PlatformSpecificCommandLineProcessing( |
| 376 *CommandLine::ForCurrentProcess()); |
374 return PROCESS_NONE; | 377 return PROCESS_NONE; |
| 378 } |
375 | 379 |
376 DWORD process_id = 0; | 380 DWORD process_id = 0; |
377 DWORD thread_id = GetWindowThreadProcessId(remote_window_, &process_id); | 381 DWORD thread_id = GetWindowThreadProcessId(remote_window_, &process_id); |
378 // It is possible that the process owning this window may have died by now. | 382 // It is possible that the process owning this window may have died by now. |
379 if (!thread_id || !process_id) { | 383 if (!thread_id || !process_id) { |
380 remote_window_ = NULL; | 384 remote_window_ = NULL; |
381 return PROCESS_NONE; | 385 return PROCESS_NONE; |
382 } | 386 } |
383 | 387 |
384 if (base::win::IsMetroProcess()) { | 388 if (base::win::IsMetroProcess()) { |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
537 switch (message) { | 541 switch (message) { |
538 case WM_COPYDATA: | 542 case WM_COPYDATA: |
539 return OnCopyData(reinterpret_cast<HWND>(wparam), | 543 return OnCopyData(reinterpret_cast<HWND>(wparam), |
540 reinterpret_cast<COPYDATASTRUCT*>(lparam)); | 544 reinterpret_cast<COPYDATASTRUCT*>(lparam)); |
541 default: | 545 default: |
542 break; | 546 break; |
543 } | 547 } |
544 | 548 |
545 return ::DefWindowProc(hwnd, message, wparam, lparam); | 549 return ::DefWindowProc(hwnd, message, wparam, lparam); |
546 } | 550 } |
OLD | NEW |