summaryrefslogtreecommitdiffstats
path: root/chrome/browser/importer/firefox_profile_lock.cc
diff options
context:
space:
mode:
authoragl@chromium.org <agl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2008-12-01 19:10:18 +0000
committeragl@chromium.org <agl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2008-12-01 19:10:18 +0000
commit2011cae921b2d88be4b8e4f31197dd8bdd2c56b3 (patch)
tree8fa84ba0161024c9c23116144f353541184f0ce5 /chrome/browser/importer/firefox_profile_lock.cc
parent9866440c2a379bab6fa7e1947405df00958ca3b9 (diff)
downloadchromium_src-2011cae921b2d88be4b8e4f31197dd8bdd2c56b3.zip
chromium_src-2011cae921b2d88be4b8e4f31197dd8bdd2c56b3.tar.gz
chromium_src-2011cae921b2d88be4b8e4f31197dd8bdd2c56b3.tar.bz2
browser porting, part 2 - importer
Review URL: http://codereview.chromium.org/12688 Patch from Pawel Hajdan jr. git-svn-id: svn://svn.chromium.org/chrome/trunk/src@6149 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/importer/firefox_profile_lock.cc')
-rw-r--r--chrome/browser/importer/firefox_profile_lock.cc34
1 files changed, 7 insertions, 27 deletions
diff --git a/chrome/browser/importer/firefox_profile_lock.cc b/chrome/browser/importer/firefox_profile_lock.cc
index aaab891..777723c 100644
--- a/chrome/browser/importer/firefox_profile_lock.cc
+++ b/chrome/browser/importer/firefox_profile_lock.cc
@@ -4,7 +4,7 @@
#include "chrome/browser/importer/firefox_profile_lock.h"
-#include "base/file_util.h"
+#include "base/file_path.h"
// This class is based on Firefox code in:
// profile/dirserviceprovider/src/nsProfileLock.cpp
@@ -52,36 +52,16 @@
* ***** END LICENSE BLOCK ***** */
// static
-wchar_t FirefoxProfileLock::kLockFileName[] = L"parent.lock";
+const FilePath::CharType* FirefoxProfileLock::kLockFileName =
+ FILE_PATH_LITERAL("parent.local");
-FirefoxProfileLock::FirefoxProfileLock(const std::wstring& path)
- : lock_handle_(INVALID_HANDLE_VALUE) {
- lock_file_ = path;
- file_util::AppendToPath(&lock_file_, kLockFileName);
+FirefoxProfileLock::FirefoxProfileLock(const std::wstring& path) {
+ Init();
+ lock_file_ = FilePath::FromWStringHack(path);
+ lock_file_.Append(kLockFileName);
Lock();
}
FirefoxProfileLock::~FirefoxProfileLock() {
Unlock();
}
-
-void FirefoxProfileLock::Lock() {
- if (HasAcquired())
- return;
- lock_handle_ = CreateFile(lock_file_.c_str(), GENERIC_READ | GENERIC_WRITE,
- 0, NULL, OPEN_ALWAYS, FILE_FLAG_DELETE_ON_CLOSE,
- NULL);
-}
-
-void FirefoxProfileLock::Unlock() {
- if (!HasAcquired())
- return;
- CloseHandle(lock_handle_);
- lock_handle_ = INVALID_HANDLE_VALUE;
-}
-
-bool FirefoxProfileLock::HasAcquired() {
- return (lock_handle_ != INVALID_HANDLE_VALUE);
-}
-
-