OLD | NEW |
1 // Copyright (c) 2011 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 #include "chrome/browser/extensions/app_notification_storage.h" | 5 #include "chrome/browser/extensions/app_notification_storage.h" |
6 | 6 |
7 #include "base/file_path.h" | 7 #include "base/file_path.h" |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/json/json_reader.h" | 9 #include "base/json/json_reader.h" |
10 #include "base/json/json_writer.h" | 10 #include "base/json/json_writer.h" |
11 #include "base/location.h" | 11 #include "base/location.h" |
12 #include "base/sys_string_conversions.h" | 12 #include "base/sys_string_conversions.h" |
13 #include "base/values.h" | 13 #include "base/values.h" |
14 #include "base/version.h" | 14 #include "base/version.h" |
15 #include "chrome/common/extensions/extension.h" | 15 #include "chrome/common/extensions/extension.h" |
16 #include "content/public/browser/browser_thread.h" | 16 #include "content/public/browser/browser_thread.h" |
17 #include "third_party/leveldatabase/src/include/leveldb/db.h" | 17 #include "third_party/leveldatabase/src/include/leveldb/db.h" |
18 | 18 |
19 using base::JSONReader; | 19 using base::JSONReader; |
20 using base::JSONWriter; | 20 using base::JSONWriter; |
| 21 using content::BrowserThread; |
21 | 22 |
22 // A concrete implementation of the AppNotificationStorage interface, using | 23 // A concrete implementation of the AppNotificationStorage interface, using |
23 // LevelDb for backing storage. | 24 // LevelDb for backing storage. |
24 class LevelDbAppNotificationStorage : public AppNotificationStorage { | 25 class LevelDbAppNotificationStorage : public AppNotificationStorage { |
25 public: | 26 public: |
26 explicit LevelDbAppNotificationStorage(const FilePath& path); | 27 explicit LevelDbAppNotificationStorage(const FilePath& path); |
27 virtual ~LevelDbAppNotificationStorage(); | 28 virtual ~LevelDbAppNotificationStorage(); |
28 | 29 |
29 // Implementing the AppNotificationStorage interface. | 30 // Implementing the AppNotificationStorage interface. |
30 virtual bool GetExtensionIds(std::set<std::string>* result) OVERRIDE; | 31 virtual bool GetExtensionIds(std::set<std::string>* result) OVERRIDE; |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 options.create_if_missing = true; | 220 options.create_if_missing = true; |
220 leveldb::DB* db = NULL; | 221 leveldb::DB* db = NULL; |
221 leveldb::Status status = leveldb::DB::Open(options, os_path, &db); | 222 leveldb::Status status = leveldb::DB::Open(options, os_path, &db); |
222 if (!status.ok()) { | 223 if (!status.ok()) { |
223 LogLevelDbError(FROM_HERE, status); | 224 LogLevelDbError(FROM_HERE, status); |
224 return false; | 225 return false; |
225 } | 226 } |
226 db_.reset(db); | 227 db_.reset(db); |
227 return true; | 228 return true; |
228 } | 229 } |
OLD | NEW |