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

Unified Diff: chrome/browser/process_singleton_posix.cc

Issue 218883008: Use process_singleton_linux on Mac. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments Created 6 years, 8 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_posix.cc
diff --git a/chrome/browser/process_singleton_linux.cc b/chrome/browser/process_singleton_posix.cc
similarity index 98%
rename from chrome/browser/process_singleton_linux.cc
rename to chrome/browser/process_singleton_posix.cc
index 54d7db296f329d29016c8f5ba35d64bbefadd778..c9d16a3c3d43f177bc98de5c3a912833eb1c81de 100644
--- a/chrome/browser/process_singleton_linux.cc
+++ b/chrome/browser/process_singleton_posix.cc
@@ -74,7 +74,6 @@
#include "base/threading/platform_thread.h"
#include "base/time/time.h"
#include "base/timer/timer.h"
-#include "chrome/browser/ui/process_singleton_dialog_linux.h"
#include "chrome/common/chrome_constants.h"
#include "content/public/browser/browser_thread.h"
#include "grit/chromium_strings.h"
@@ -82,6 +81,10 @@
#include "net/base/net_util.h"
#include "ui/base/l10n/l10n_util.h"
+#if defined(OS_LINUX)
+#include "chrome/browser/ui/process_singleton_dialog_linux.h"
+#endif
+
#if defined(TOOLKIT_VIEWS) && !defined(OS_CHROMEOS)
#include "ui/views/linux_ui/linux_ui.h"
#endif
@@ -298,14 +301,24 @@ bool DisplayProfileInUseError(const base::FilePath& lock_path,
const std::string& hostname,
int pid) {
base::string16 error = l10n_util::GetStringFUTF16(
- IDS_PROFILE_IN_USE_LINUX,
+ IDS_PROFILE_IN_USE_POSIX,
base::IntToString16(pid),
base::ASCIIToUTF16(hostname));
+ LOG(ERROR) << base::SysWideToNativeMB(base::UTF16ToWide(error)).c_str();
+
+ if (g_disable_prompt)
+ return false;
+
+#if defined(OS_LINUX)
base::string16 relaunch_button_text = l10n_util::GetStringUTF16(
IDS_PROFILE_IN_USE_LINUX_RELAUNCH);
- LOG(ERROR) << base::SysWideToNativeMB(base::UTF16ToWide(error)).c_str();
- if (!g_disable_prompt)
- return ShowProcessSingletonDialog(error, relaunch_button_text);
+ return ShowProcessSingletonDialog(error, relaunch_button_text);
+#elif defined(OS_MACOSX)
+ // On Mac, always usurp the lock.
+ return true;
+#endif
+
+ NOTREACHED();
return false;
}
@@ -895,6 +908,13 @@ bool ProcessSingleton::Create() {
LOG(ERROR) << "Failed to create socket directory.";
return false;
}
+
+ // Check that the directory was created with the correct permissions.
+ int dir_mode = 0;
+ CHECK(base::GetPosixFilePermissions(socket_dir_.path(), &dir_mode) &&
+ dir_mode == base::FILE_PERMISSION_USER_MASK)
+ << "Temp directory mode is not 700: " << std::oct << dir_mode;
Scott Hess - ex-Googler 2014/04/24 21:54:43 std::oct? Searches ... you just blew my mind! I'
+
// Setup the socket symlink and the two cookies.
base::FilePath socket_target_path =
socket_dir_.path().Append(chrome::kSingletonSocketFilename);
« no previous file with comments | « chrome/browser/process_singleton_mac_unittest.cc ('k') | chrome/browser/process_singleton_posix_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698