Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6797)

Unified Diff: chrome/browser/process_singleton_linux.cc

Issue 23506011: Improve the UI for handling profile lock contention. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Only do it if we're REALLY sure it's a stale lock. Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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;
}
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)) {
+ // 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_);

Powered by Google App Engine
This is Rietveld 408576698