| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 // |
| 11 // Because many networked filesystem implementations do not support unix domain | 11 // Because many networked filesystem implementations do not support unix domain |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 | 43 |
| 44 #include <errno.h> | 44 #include <errno.h> |
| 45 #include <fcntl.h> | 45 #include <fcntl.h> |
| 46 #include <gdk/gdk.h> | 46 #include <gdk/gdk.h> |
| 47 #include <signal.h> | 47 #include <signal.h> |
| 48 #include <sys/socket.h> | 48 #include <sys/socket.h> |
| 49 #include <sys/stat.h> | 49 #include <sys/stat.h> |
| 50 #include <sys/types.h> | 50 #include <sys/types.h> |
| 51 #include <sys/un.h> | 51 #include <sys/un.h> |
| 52 #include <unistd.h> | 52 #include <unistd.h> |
| 53 |
| 53 #include <cstring> | 54 #include <cstring> |
| 54 #include <set> | 55 #include <set> |
| 55 #include <string> | 56 #include <string> |
| 56 | 57 |
| 57 #include "app/l10n_util.h" | 58 #include "app/l10n_util.h" |
| 58 #include "base/base_paths.h" | 59 #include "base/base_paths.h" |
| 59 #include "base/basictypes.h" | 60 #include "base/basictypes.h" |
| 60 #include "base/command_line.h" | 61 #include "base/command_line.h" |
| 61 #include "base/eintr_wrapper.h" | 62 #include "base/eintr_wrapper.h" |
| 62 #include "base/file_path.h" | 63 #include "base/file_path.h" |
| 63 #include "base/file_util.h" | 64 #include "base/file_util.h" |
| 64 #include "base/logging.h" | 65 #include "base/logging.h" |
| 65 #include "base/message_loop.h" | 66 #include "base/message_loop.h" |
| 66 #include "base/path_service.h" | 67 #include "base/path_service.h" |
| 67 #include "base/process_util.h" | 68 #include "base/process_util.h" |
| 68 #include "base/rand_util.h" | 69 #include "base/rand_util.h" |
| 69 #include "base/safe_strerror_posix.h" | 70 #include "base/safe_strerror_posix.h" |
| 70 #include "base/stl_util-inl.h" | 71 #include "base/stl_util-inl.h" |
| 71 #include "base/string_number_conversions.h" | 72 #include "base/string_number_conversions.h" |
| 72 #include "base/string_split.h" | 73 #include "base/string_split.h" |
| 73 #include "base/sys_string_conversions.h" | 74 #include "base/sys_string_conversions.h" |
| 74 #include "base/threading/platform_thread.h" | 75 #include "base/threading/platform_thread.h" |
| 75 #include "base/time.h" | 76 #include "base/time.h" |
| 76 #include "base/timer.h" | 77 #include "base/timer.h" |
| 77 #include "base/utf_string_conversions.h" | 78 #include "base/utf_string_conversions.h" |
| 78 #include "chrome/browser/browser_process.h" | 79 #include "chrome/browser/browser_process.h" |
| 79 #include "chrome/browser/browser_thread.h" | 80 #include "chrome/browser/browser_thread.h" |
| 80 #if defined(TOOLKIT_GTK) | 81 #if defined(TOOLKIT_GTK) |
| 81 #include "chrome/browser/gtk/process_singleton_dialog.h" | 82 #include "chrome/browser/ui/gtk/process_singleton_dialog.h" |
| 82 #endif | 83 #endif |
| 83 #include "chrome/browser/io_thread.h" | 84 #include "chrome/browser/io_thread.h" |
| 84 #include "chrome/browser/profiles/profile.h" | 85 #include "chrome/browser/profiles/profile.h" |
| 85 #include "chrome/browser/profiles/profile_manager.h" | 86 #include "chrome/browser/profiles/profile_manager.h" |
| 86 #include "chrome/browser/ui/browser_init.h" | 87 #include "chrome/browser/ui/browser_init.h" |
| 87 #include "chrome/common/chrome_constants.h" | 88 #include "chrome/common/chrome_constants.h" |
| 88 #include "chrome/common/chrome_paths.h" | 89 #include "chrome/common/chrome_paths.h" |
| 89 #include "chrome/common/chrome_switches.h" | 90 #include "chrome/common/chrome_switches.h" |
| 90 #include "grit/chromium_strings.h" | 91 #include "grit/chromium_strings.h" |
| 91 #include "grit/generated_resources.h" | 92 #include "grit/generated_resources.h" |
| (...skipping 886 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 978 sock)); | 979 sock)); |
| 979 | 980 |
| 980 return true; | 981 return true; |
| 981 } | 982 } |
| 982 | 983 |
| 983 void ProcessSingleton::Cleanup() { | 984 void ProcessSingleton::Cleanup() { |
| 984 UnlinkPath(socket_path_); | 985 UnlinkPath(socket_path_); |
| 985 UnlinkPath(cookie_path_); | 986 UnlinkPath(cookie_path_); |
| 986 UnlinkPath(lock_path_); | 987 UnlinkPath(lock_path_); |
| 987 } | 988 } |
| OLD | NEW |