• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_METADATA_H_
6 #define CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_METADATA_H_
7 
8 #include <map>
9 
10 #include "base/basictypes.h"
11 #include "base/strings/string16.h"
12 #include "content/common/indexed_db/indexed_db_key_path.h"
13 
14 namespace content {
15 
16 struct IndexedDBIndexMetadata {
17   static const int64 kInvalidId = -1;
18 
IndexedDBIndexMetadataIndexedDBIndexMetadata19   IndexedDBIndexMetadata() {}
IndexedDBIndexMetadataIndexedDBIndexMetadata20   IndexedDBIndexMetadata(const base::string16& name,
21                          int64 id,
22                          const IndexedDBKeyPath& key_path,
23                          bool unique,
24                          bool multi_entry)
25       : name(name),
26         id(id),
27         key_path(key_path),
28         unique(unique),
29         multi_entry(multi_entry) {}
30   base::string16 name;
31   int64 id;
32   IndexedDBKeyPath key_path;
33   bool unique;
34   bool multi_entry;
35 };
36 
37 struct CONTENT_EXPORT IndexedDBObjectStoreMetadata {
38   typedef std::map<int64, IndexedDBIndexMetadata> IndexMap;
39 
40   static const int64 kInvalidId = -1;
41 
42   IndexedDBObjectStoreMetadata();
43   IndexedDBObjectStoreMetadata(const base::string16& name,
44                                int64 id,
45                                const IndexedDBKeyPath& key_path,
46                                bool auto_increment,
47                                int64 max_index_id);
48   ~IndexedDBObjectStoreMetadata();
49   base::string16 name;
50   int64 id;
51   IndexedDBKeyPath key_path;
52   bool auto_increment;
53   int64 max_index_id;
54 
55   IndexMap indexes;
56 };
57 
58 struct CONTENT_EXPORT IndexedDBDatabaseMetadata {
59   // TODO(jsbell): These can probably be collapsed into 0.
60   enum {
61     NO_INT_VERSION = -1,
62     DEFAULT_INT_VERSION = 0
63   };
64 
65   typedef std::map<int64, IndexedDBObjectStoreMetadata> ObjectStoreMap;
66 
67   IndexedDBDatabaseMetadata();
68   IndexedDBDatabaseMetadata(const base::string16& name,
69                             int64 id,
70                             const base::string16& version,
71                             int64 int_version,
72                             int64 max_object_store_id);
73   ~IndexedDBDatabaseMetadata();
74 
75   base::string16 name;
76   int64 id;
77   base::string16 version;
78   int64 int_version;
79   int64 max_object_store_id;
80 
81   ObjectStoreMap object_stores;
82 };
83 }  // namespace content
84 
85 #endif  // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_METADATA_H_
86