1868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)// Copyright (c) 2013 The Chromium Authors. All rights reserved. 2868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be 3868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)// found in the LICENSE file. 4868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) 5868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)#ifndef CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_METADATA_H_ 6868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)#define CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_METADATA_H_ 7868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) 8868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)#include <map> 9868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) 10868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)#include "base/basictypes.h" 11868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)#include "base/strings/string16.h" 12868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)#include "content/common/indexed_db/indexed_db_key_path.h" 13868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) 14868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)namespace content { 15868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) 16868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)struct IndexedDBIndexMetadata { 17868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) IndexedDBIndexMetadata() {} 18a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) IndexedDBIndexMetadata(const base::string16& name, 19868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) int64 id, 20868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) const IndexedDBKeyPath& key_path, 21868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) bool unique, 22868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) bool multi_entry) 23868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) : name(name), 24868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) id(id), 25868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) key_path(key_path), 26868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) unique(unique), 27868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) multi_entry(multi_entry) {} 28a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) base::string16 name; 29868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) int64 id; 30868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) IndexedDBKeyPath key_path; 31868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) bool unique; 32868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) bool multi_entry; 33868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) 34868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) static const int64 kInvalidId = -1; 35868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)}; 36868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) 37868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)struct CONTENT_EXPORT IndexedDBObjectStoreMetadata { 38868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) IndexedDBObjectStoreMetadata(); 39a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) IndexedDBObjectStoreMetadata(const base::string16& name, 40868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) int64 id, 41868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) const IndexedDBKeyPath& key_path, 42868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) bool auto_increment, 43868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) int64 max_index_id); 44868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) ~IndexedDBObjectStoreMetadata(); 45a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) base::string16 name; 46868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) int64 id; 47868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) IndexedDBKeyPath key_path; 48868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) bool auto_increment; 49868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) int64 max_index_id; 50868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) 51868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) static const int64 kInvalidId = -1; 52868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) 53868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) typedef std::map<int64, IndexedDBIndexMetadata> IndexMap; 54868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) IndexMap indexes; 55868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)}; 56868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) 57868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)struct CONTENT_EXPORT IndexedDBDatabaseMetadata { 58868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) // TODO(jsbell): These can probably be collapsed into 0. 59868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) enum { 60868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) NO_INT_VERSION = -1, 61868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) DEFAULT_INT_VERSION = 0 62868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) }; 63868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) 64868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) typedef std::map<int64, IndexedDBObjectStoreMetadata> ObjectStoreMap; 65868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) 66868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) IndexedDBDatabaseMetadata(); 67a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) IndexedDBDatabaseMetadata(const base::string16& name, 68868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) int64 id, 69a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) const base::string16& version, 70868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) int64 int_version, 71868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) int64 max_object_store_id); 72868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) ~IndexedDBDatabaseMetadata(); 73868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) 74a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) base::string16 name; 75868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) int64 id; 76a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) base::string16 version; 77868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) int64 int_version; 78868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) int64 max_object_store_id; 79868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) 80868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) ObjectStoreMap object_stores; 81868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)}; 82868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)} 83868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) 84868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)#endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_METADATA_H_ 85