OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_util.h" | 7 #include "base/file_util.h" |
8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.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" |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 return true; | 207 return true; |
208 | 208 |
209 // If the file doesn't exist and the caller doesn't want it created, just | 209 // If the file doesn't exist and the caller doesn't want it created, just |
210 // return early. | 210 // return early. |
211 if (!create_if_missing && !file_util::PathExists(path_)) | 211 if (!create_if_missing && !file_util::PathExists(path_)) |
212 return true; | 212 return true; |
213 | 213 |
214 #if defined(OS_POSIX) | 214 #if defined(OS_POSIX) |
215 std::string os_path = path_.value(); | 215 std::string os_path = path_.value(); |
216 #elif defined(OS_WIN) | 216 #elif defined(OS_WIN) |
217 std::string os_path = base::SysWideToUTF8(path_.value()); | 217 std::string os_path = base::Sysbase::WideToUTF8(path_.value()); |
218 #endif | 218 #endif |
219 | 219 |
220 leveldb::Options options; | 220 leveldb::Options options; |
221 options.create_if_missing = true; | 221 options.create_if_missing = true; |
222 leveldb::DB* db = NULL; | 222 leveldb::DB* db = NULL; |
223 leveldb::Status status = leveldb::DB::Open(options, os_path, &db); | 223 leveldb::Status status = leveldb::DB::Open(options, os_path, &db); |
224 if (!status.ok()) { | 224 if (!status.ok()) { |
225 LogLevelDbError(FROM_HERE, status); | 225 LogLevelDbError(FROM_HERE, status); |
226 return false; | 226 return false; |
227 } | 227 } |
228 db_.reset(db); | 228 db_.reset(db); |
229 return true; | 229 return true; |
230 } | 230 } |
231 | 231 |
232 } // namespace extensions | 232 } // namespace extensions |
OLD | NEW |