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 | 8 |
9 #include "base/base_paths.h" | 9 #include "base/base_paths.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
316 sei.fMask = SEE_MASK_FLAG_LOG_USAGE; | 316 sei.fMask = SEE_MASK_FLAG_LOG_USAGE; |
317 sei.nShow = SW_SHOWNORMAL; | 317 sei.nShow = SW_SHOWNORMAL; |
318 sei.lpFile = url.c_str(); | 318 sei.lpFile = url.c_str(); |
319 ::OutputDebugStringA(sei.lpFile); | 319 ::OutputDebugStringA(sei.lpFile); |
320 sei.lpDirectory = ""; | 320 sei.lpDirectory = ""; |
321 ::ShellExecuteExA(&sei); | 321 ::ShellExecuteExA(&sei); |
322 } | 322 } |
323 return PROCESS_NOTIFIED; | 323 return PROCESS_NOTIFIED; |
324 } | 324 } |
325 | 325 |
| 326 CommandLine command_line(*CommandLine::ForCurrentProcess()); |
| 327 command_line.AppendSwitchASCII( |
| 328 switches::kOriginalProcessStartTime, |
| 329 base::Int64ToString( |
| 330 base::CurrentProcessInfo::CreationTime()->ToInternalValue())); |
| 331 |
326 // Non-metro mode, send our command line to the other chrome message window. | 332 // Non-metro mode, send our command line to the other chrome message window. |
327 // format is "START\0<<<current directory>>>\0<<<commandline>>>". | 333 // format is "START\0<<<current directory>>>\0<<<commandline>>>". |
328 std::wstring to_send(L"START\0", 6); // want the NULL in the string. | 334 std::wstring to_send(L"START\0", 6); // want the NULL in the string. |
329 base::FilePath cur_dir; | 335 base::FilePath cur_dir; |
330 if (!PathService::Get(base::DIR_CURRENT, &cur_dir)) | 336 if (!PathService::Get(base::DIR_CURRENT, &cur_dir)) |
331 return PROCESS_NONE; | 337 return PROCESS_NONE; |
332 to_send.append(cur_dir.value()); | 338 to_send.append(cur_dir.value()); |
333 to_send.append(L"\0", 1); // Null separator. | 339 to_send.append(L"\0", 1); // Null separator. |
334 to_send.append(::GetCommandLineW()); | 340 to_send.append(command_line.GetCommandLineString()); |
335 // Add the process start time as a flag. | |
336 to_send.append(L" --"); | |
337 to_send.append(ASCIIToWide(switches::kOriginalProcessStartTime)); | |
338 to_send.append(L"="); | |
339 to_send.append(base::Int64ToString16( | |
340 base::CurrentProcessInfo::CreationTime()->ToInternalValue())); | |
341 to_send.append(L"\0", 1); // Null separator. | 341 to_send.append(L"\0", 1); // Null separator. |
342 | 342 |
343 base::win::ScopedHandle process_handle; | 343 base::win::ScopedHandle process_handle; |
344 if (base::win::GetVersion() >= base::win::VERSION_WIN8 && | 344 if (base::win::GetVersion() >= base::win::VERSION_WIN8 && |
345 base::OpenProcessHandleWithAccess( | 345 base::OpenProcessHandleWithAccess( |
346 process_id, PROCESS_QUERY_INFORMATION, | 346 process_id, PROCESS_QUERY_INFORMATION, |
347 process_handle.Receive()) && | 347 process_handle.Receive()) && |
348 base::win::IsProcessImmersive(process_handle.Get())) { | 348 base::win::IsProcessImmersive(process_handle.Get())) { |
349 chrome::ActivateMetroChrome(); | 349 chrome::ActivateMetroChrome(); |
350 } | 350 } |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
564 switch (message) { | 564 switch (message) { |
565 case WM_COPYDATA: | 565 case WM_COPYDATA: |
566 return OnCopyData(reinterpret_cast<HWND>(wparam), | 566 return OnCopyData(reinterpret_cast<HWND>(wparam), |
567 reinterpret_cast<COPYDATASTRUCT*>(lparam)); | 567 reinterpret_cast<COPYDATASTRUCT*>(lparam)); |
568 default: | 568 default: |
569 break; | 569 break; |
570 } | 570 } |
571 | 571 |
572 return ::DefWindowProc(hwnd, message, wparam, lparam); | 572 return ::DefWindowProc(hwnd, message, wparam, lparam); |
573 } | 573 } |
OLD | NEW |