| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #ifndef CONTENT_BROWSER_DOM_STORAGE_DOM_STORAGE_DATABASE_H_ | 5 #ifndef CONTENT_BROWSER_DOM_STORAGE_DOM_STORAGE_DATABASE_H_ |
| 6 #define CONTENT_BROWSER_DOM_STORAGE_DOM_STORAGE_DATABASE_H_ | 6 #define CONTENT_BROWSER_DOM_STORAGE_DOM_STORAGE_DATABASE_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <memory> |
| 9 | 10 |
| 10 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" |
| 11 #include "base/gtest_prod_util.h" | 12 #include "base/gtest_prod_util.h" |
| 12 #include "base/memory/scoped_ptr.h" | |
| 13 #include "base/strings/nullable_string16.h" | 13 #include "base/strings/nullable_string16.h" |
| 14 #include "base/strings/string16.h" | 14 #include "base/strings/string16.h" |
| 15 #include "content/common/content_export.h" | 15 #include "content/common/content_export.h" |
| 16 #include "content/common/dom_storage/dom_storage_types.h" | 16 #include "content/common/dom_storage/dom_storage_types.h" |
| 17 #include "sql/connection.h" | 17 #include "sql/connection.h" |
| 18 | 18 |
| 19 namespace content { | 19 namespace content { |
| 20 | 20 |
| 21 // Represents a SQLite based backing for DOM storage data. This | 21 // Represents a SQLite based backing for DOM storage data. This |
| 22 // class is designed to be used on a single thread. | 22 // class is designed to be used on a single thread. |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 bool UpgradeVersion1To2(); | 101 bool UpgradeVersion1To2(); |
| 102 | 102 |
| 103 void Close(); | 103 void Close(); |
| 104 bool IsOpen() const { return db_.get() ? db_->is_open() : false; } | 104 bool IsOpen() const { return db_.get() ? db_->is_open() : false; } |
| 105 | 105 |
| 106 // Initialization code shared between the two constructors of this class. | 106 // Initialization code shared between the two constructors of this class. |
| 107 void Init(); | 107 void Init(); |
| 108 | 108 |
| 109 // Path to the database on disk. | 109 // Path to the database on disk. |
| 110 const base::FilePath file_path_; | 110 const base::FilePath file_path_; |
| 111 scoped_ptr<sql::Connection> db_; | 111 std::unique_ptr<sql::Connection> db_; |
| 112 bool failed_to_open_; | 112 bool failed_to_open_; |
| 113 bool tried_to_recreate_; | 113 bool tried_to_recreate_; |
| 114 bool known_to_be_empty_; | 114 bool known_to_be_empty_; |
| 115 }; | 115 }; |
| 116 | 116 |
| 117 } // namespace content | 117 } // namespace content |
| 118 | 118 |
| 119 #endif // CONTENT_BROWSER_DOM_STORAGE_DOM_STORAGE_DATABASE_H_ | 119 #endif // CONTENT_BROWSER_DOM_STORAGE_DOM_STORAGE_DATABASE_H_ |
| OLD | NEW |