Chromium Code Reviews| Index: chrome/browser/process_singleton_linux.cc |
| diff --git a/chrome/browser/process_singleton_linux.cc b/chrome/browser/process_singleton_linux.cc |
| index fbba09f54c956c619b78ceb2838f40628a09f5ac..bb92a631adeb59702b688ef6815ceb68a3407587 100644 |
| --- a/chrome/browser/process_singleton_linux.cc |
| +++ b/chrome/browser/process_singleton_linux.cc |
| @@ -294,23 +294,28 @@ bool ParseLockPath(const base::FilePath& path, |
| return true; |
| } |
| -void DisplayProfileInUseError(const std::string& lock_path, |
| +// Returns true if the user opted to unlock the profile. |
| +bool DisplayProfileInUseError(const base::FilePath& lock_path, |
| const std::string& hostname, |
| int pid) { |
| string16 error = l10n_util::GetStringFUTF16( |
| IDS_PROFILE_IN_USE_LINUX, |
| base::IntToString16(pid), |
| ASCIIToUTF16(hostname), |
| - WideToUTF16(base::SysNativeMBToWide(lock_path)), |
| l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)); |
| + string16 relaunch_button_text = l10n_util::GetStringFUTF16( |
| + IDS_PROFILE_IN_USE_LINUX_RELAUNCH, |
| + string16()); |
| LOG(ERROR) << base::SysWideToNativeMB(UTF16ToWide(error)).c_str(); |
| if (!g_disable_prompt) { |
| #if defined(TOOLKIT_GTK) |
| - ProcessSingletonDialog::ShowAndRun(UTF16ToUTF8(error)); |
| + return ProcessSingletonDialog::ShowAndRun( |
| + UTF16ToUTF8(error), UTF16ToUTF8(relaunch_button_text)); |
| #else |
| NOTIMPLEMENTED(); |
| #endif |
| } |
| + return 0; |
|
Nico
2013/09/04 22:32:59
don't return 0 from a function returning bool (not
palmer
2013/09/04 23:12:25
Done.
|
| } |
| bool IsChromeProcess(pid_t pid) { |
| @@ -734,9 +739,13 @@ ProcessSingleton::NotifyResult ProcessSingleton::NotifyOtherProcessWithTimeout( |
| return PROCESS_NONE; |
| } |
| - if (hostname != net::GetHostName()) { |
| - // Locked by process on another host. |
| - DisplayProfileInUseError(lock_path_.value(), hostname, pid); |
| + if (hostname != net::GetHostName() && !IsChromeProcess(pid)) { |
|
Nico
2013/09/04 22:32:59
Now we won't show the dialog if the process holdin
palmer
2013/09/04 23:12:25
You are reading it correctly, but that is not the
|
| + // Locked by process on another host. If the user selected to unlock |
| + // the profile, try to continue; otherwise quit. |
| + if (DisplayProfileInUseError(lock_path_, hostname, pid)) { |
| + UnlinkPath(lock_path_); |
| + return PROCESS_NONE; |
| + } |
| return PROFILE_IN_USE; |
| } |
| @@ -958,8 +967,7 @@ bool ProcessSingleton::KillProcessByLockPath() { |
| ParseLockPath(lock_path_, &hostname, &pid); |
| if (!hostname.empty() && hostname != net::GetHostName()) { |
| - DisplayProfileInUseError(lock_path_.value(), hostname, pid); |
| - return false; |
| + return DisplayProfileInUseError(lock_path_, hostname, pid); |
| } |
| UnlinkPath(lock_path_); |