| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 #include "chrome/browser/importer/firefox_profile_lock.h" | 5 #include "chrome/browser/importer/firefox_profile_lock.h" |
| 6 | 6 |
| 7 #include "base/file_path.h" | 7 #include "base/file_path.h" |
| 8 | 8 |
| 9 // This class is based on Firefox code in: | 9 // This class is based on Firefox code in: |
| 10 // profile/dirserviceprovider/src/nsProfileLock.cpp | 10 // profile/dirserviceprovider/src/nsProfileLock.cpp |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 * under the terms of either the GPL or the LGPL, and not to allow others to | 45 * under the terms of either the GPL or the LGPL, and not to allow others to |
| 46 * use your version of this file under the terms of the MPL, indicate your | 46 * use your version of this file under the terms of the MPL, indicate your |
| 47 * decision by deleting the provisions above and replace them with the notice | 47 * decision by deleting the provisions above and replace them with the notice |
| 48 * and other provisions required by the GPL or the LGPL. If you do not delete | 48 * and other provisions required by the GPL or the LGPL. If you do not delete |
| 49 * the provisions above, a recipient may use your version of this file under | 49 * the provisions above, a recipient may use your version of this file under |
| 50 * the terms of any one of the MPL, the GPL or the LGPL. | 50 * the terms of any one of the MPL, the GPL or the LGPL. |
| 51 * | 51 * |
| 52 * ***** END LICENSE BLOCK ***** */ | 52 * ***** END LICENSE BLOCK ***** */ |
| 53 | 53 |
| 54 // static | 54 // static |
| 55 #if defined(OS_LINUX) | 55 #if defined(OS_LINUX) || defined(OS_FREEBSD) |
| 56 // http://www.google.com/codesearch/p?hl=en#e_ObwTAVPyo/profile/dirserviceprovid
er/src/nsProfileLock.cpp&l=433 | 56 // http://www.google.com/codesearch/p?hl=en#e_ObwTAVPyo/profile/dirserviceprovid
er/src/nsProfileLock.cpp&l=433 |
| 57 const FilePath::CharType* FirefoxProfileLock::kLockFileName = | 57 const FilePath::CharType* FirefoxProfileLock::kLockFileName = |
| 58 FILE_PATH_LITERAL(".parentlock"); | 58 FILE_PATH_LITERAL(".parentlock"); |
| 59 const FilePath::CharType* FirefoxProfileLock::kOldLockFileName = | 59 const FilePath::CharType* FirefoxProfileLock::kOldLockFileName = |
| 60 FILE_PATH_LITERAL("lock"); | 60 FILE_PATH_LITERAL("lock"); |
| 61 #elif defined(OS_MACOSX) | 61 #elif defined(OS_MACOSX) |
| 62 const FilePath::CharType* FirefoxProfileLock::kLockFileName = | 62 const FilePath::CharType* FirefoxProfileLock::kLockFileName = |
| 63 FILE_PATH_LITERAL(".parentlock"); | 63 FILE_PATH_LITERAL(".parentlock"); |
| 64 const FilePath::CharType* FirefoxProfileLock::kOldLockFileName = | 64 const FilePath::CharType* FirefoxProfileLock::kOldLockFileName = |
| 65 FILE_PATH_LITERAL("parent.lock"); | 65 FILE_PATH_LITERAL("parent.lock"); |
| 66 #else | 66 #else |
| 67 const FilePath::CharType* FirefoxProfileLock::kLockFileName = | 67 const FilePath::CharType* FirefoxProfileLock::kLockFileName = |
| 68 FILE_PATH_LITERAL("parent.lock"); | 68 FILE_PATH_LITERAL("parent.lock"); |
| 69 #endif | 69 #endif |
| 70 | 70 |
| 71 FirefoxProfileLock::FirefoxProfileLock(const std::wstring& path) { | 71 FirefoxProfileLock::FirefoxProfileLock(const std::wstring& path) { |
| 72 Init(); | 72 Init(); |
| 73 lock_file_ = FilePath::FromWStringHack(path).Append(kLockFileName); | 73 lock_file_ = FilePath::FromWStringHack(path).Append(kLockFileName); |
| 74 Lock(); | 74 Lock(); |
| 75 } | 75 } |
| 76 | 76 |
| 77 FirefoxProfileLock::~FirefoxProfileLock() { | 77 FirefoxProfileLock::~FirefoxProfileLock() { |
| 78 Unlock(); | 78 Unlock(); |
| 79 } | 79 } |
| OLD | NEW |