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/sync/syncable/directory_manager.h" | 5 #include "chrome/browser/sync/syncable/directory_manager.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <set> | 8 #include <set> |
9 #include <iterator> | 9 #include <iterator> |
10 | 10 |
11 #include "base/logging.h" | 11 #include "base/logging.h" |
12 #include "base/port.h" | 12 #include "base/port.h" |
13 #include "base/scoped_ptr.h" | 13 #include "base/scoped_ptr.h" |
14 #include "chrome/browser/sync/syncable/syncable.h" | 14 #include "chrome/browser/sync/syncable/syncable.h" |
15 #include "chrome/common/deprecated/event_sys-inl.h" | 15 #include "chrome/common/deprecated/event_sys-inl.h" |
16 | 16 |
| 17 using browser_sync::Cryptographer; |
| 18 |
17 namespace syncable { | 19 namespace syncable { |
18 | 20 |
19 static const FilePath::CharType kSyncDataDatabaseFilename[] = | 21 static const FilePath::CharType kSyncDataDatabaseFilename[] = |
20 FILE_PATH_LITERAL("SyncData.sqlite3"); | 22 FILE_PATH_LITERAL("SyncData.sqlite3"); |
21 | 23 |
22 DirectoryManagerEvent DirectoryManagerShutdownEvent() { | 24 DirectoryManagerEvent DirectoryManagerShutdownEvent() { |
23 DirectoryManagerEvent event; | 25 DirectoryManagerEvent event; |
24 event.what_happened = DirectoryManagerEvent::SHUTDOWN; | 26 event.what_happened = DirectoryManagerEvent::SHUTDOWN; |
25 return event; | 27 return event; |
26 } | 28 } |
27 | 29 |
28 // static | 30 // static |
29 const FilePath DirectoryManager::GetSyncDataDatabaseFilename() { | 31 const FilePath DirectoryManager::GetSyncDataDatabaseFilename() { |
30 return FilePath(kSyncDataDatabaseFilename); | 32 return FilePath(kSyncDataDatabaseFilename); |
31 } | 33 } |
32 | 34 |
33 const FilePath DirectoryManager::GetSyncDataDatabasePath() const { | 35 const FilePath DirectoryManager::GetSyncDataDatabasePath() const { |
34 return root_path_.Append(GetSyncDataDatabaseFilename()); | 36 return root_path_.Append(GetSyncDataDatabaseFilename()); |
35 } | 37 } |
36 | 38 |
37 DirectoryManager::DirectoryManager(const FilePath& path) | 39 DirectoryManager::DirectoryManager(const FilePath& path) |
38 : root_path_(path), | 40 : root_path_(path), |
39 managed_directory_(NULL), | 41 managed_directory_(NULL), |
40 channel_(new Channel(DirectoryManagerShutdownEvent())) { | 42 channel_(new Channel(DirectoryManagerShutdownEvent())), |
| 43 cryptographer_(new Cryptographer) { |
41 } | 44 } |
42 | 45 |
43 DirectoryManager::~DirectoryManager() { | 46 DirectoryManager::~DirectoryManager() { |
44 AutoLock lock(lock_); | 47 AutoLock lock(lock_); |
45 DCHECK_EQ(managed_directory_, static_cast<Directory*>(NULL)) | 48 DCHECK_EQ(managed_directory_, static_cast<Directory*>(NULL)) |
46 << "Dir " << managed_directory_->name() << " not closed!"; | 49 << "Dir " << managed_directory_->name() << " not closed!"; |
47 delete channel_; | 50 delete channel_; |
48 } | 51 } |
49 | 52 |
50 bool DirectoryManager::Open(const std::string& name) { | 53 bool DirectoryManager::Open(const std::string& name) { |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 return dir_; | 149 return dir_; |
147 } | 150 } |
148 | 151 |
149 ScopedDirLookup::operator Directory* () const { | 152 ScopedDirLookup::operator Directory* () const { |
150 CHECK(good_checked_); | 153 CHECK(good_checked_); |
151 DCHECK(good_); | 154 DCHECK(good_); |
152 return dir_; | 155 return dir_; |
153 } | 156 } |
154 | 157 |
155 } // namespace syncable | 158 } // namespace syncable |
OLD | NEW |