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 // On Linux, when the user tries to launch a second copy of chrome, we check | 5 // On Linux, when the user tries to launch a second copy of chrome, we check |
6 // for a socket in the user's profile directory. If the socket file is open we | 6 // for a socket in the user's profile directory. If the socket file is open we |
7 // send a message to the first chrome browser process with the current | 7 // send a message to the first chrome browser process with the current |
8 // directory and second process command line flags. The second process then | 8 // directory and second process command line flags. The second process then |
9 // exits. | 9 // exits. |
10 // | 10 // |
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
295 return true; | 295 return true; |
296 } | 296 } |
297 | 297 |
298 void DisplayProfileInUseError(const std::string& lock_path, | 298 void DisplayProfileInUseError(const std::string& lock_path, |
299 const std::string& hostname, | 299 const std::string& hostname, |
300 int pid) { | 300 int pid) { |
301 string16 error = l10n_util::GetStringFUTF16( | 301 string16 error = l10n_util::GetStringFUTF16( |
302 IDS_PROFILE_IN_USE_LINUX, | 302 IDS_PROFILE_IN_USE_LINUX, |
303 base::IntToString16(pid), | 303 base::IntToString16(pid), |
304 ASCIIToUTF16(hostname), | 304 ASCIIToUTF16(hostname), |
305 WideToUTF16(base::SysNativeMBToWide(lock_path)), | 305 base::WideToUTF16(base::SysNativeMBToWide(lock_path)), |
306 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)); | 306 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)); |
307 LOG(ERROR) << base::SysWideToNativeMB(UTF16ToWide(error)).c_str(); | 307 LOG(ERROR) << base::SysWideToNativeMB(base::UTF16ToWide(error)).c_str(); |
308 if (!g_disable_prompt) { | 308 if (!g_disable_prompt) { |
309 #if defined(TOOLKIT_GTK) | 309 #if defined(TOOLKIT_GTK) |
310 ProcessSingletonDialog::ShowAndRun(UTF16ToUTF8(error)); | 310 ProcessSingletonDialog::ShowAndRun(UTF16ToUTF8(error)); |
311 #else | 311 #else |
312 NOTIMPLEMENTED(); | 312 NOTIMPLEMENTED(); |
313 #endif | 313 #endif |
314 } | 314 } |
315 } | 315 } |
316 | 316 |
317 bool IsChromeProcess(pid_t pid) { | 317 bool IsChromeProcess(pid_t pid) { |
(...skipping 675 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
993 | 993 |
994 void ProcessSingleton::KillProcess(int pid) { | 994 void ProcessSingleton::KillProcess(int pid) { |
995 // TODO(james.su@gmail.com): Is SIGKILL ok? | 995 // TODO(james.su@gmail.com): Is SIGKILL ok? |
996 int rv = kill(static_cast<base::ProcessHandle>(pid), SIGKILL); | 996 int rv = kill(static_cast<base::ProcessHandle>(pid), SIGKILL); |
997 // ESRCH = No Such Process (can happen if the other process is already in | 997 // ESRCH = No Such Process (can happen if the other process is already in |
998 // progress of shutting down and finishes before we try to kill it). | 998 // progress of shutting down and finishes before we try to kill it). |
999 DCHECK(rv == 0 || errno == ESRCH) << "Error killing process: " | 999 DCHECK(rv == 0 || errno == ESRCH) << "Error killing process: " |
1000 << safe_strerror(errno); | 1000 << safe_strerror(errno); |
1001 } | 1001 } |
1002 | 1002 |
OLD | NEW |