1 // Copyright 2015 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_RETURN_VALUE_H_
6 #define CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_RETURN_VALUE_H_
7 
8 #include "content/browser/indexed_db/indexed_db_value.h"
9 #include "content/common/content_export.h"
10 #include "third_party/blink/public/common/indexeddb/indexeddb_key.h"
11 #include "third_party/blink/public/common/indexeddb/indexeddb_key_path.h"
12 
13 namespace content {
14 
15 // Values returned to the IDB client may contain a primary key value generated
16 // by IDB. This is optional and only done when using a key generator. This key
17 // value cannot (at least easily) be amended to the object being written to the
18 // database, so they are kept separately, and sent back with the original data
19 // so that the render process can amend the returned object.
20 struct CONTENT_EXPORT IndexedDBReturnValue : public IndexedDBValue {
21   // Destructively converts an IndexedDBReturnValue to a Mojo ReturnValue.
22   static blink::mojom::IDBReturnValuePtr ConvertReturnValue(
23       IndexedDBReturnValue* value);
24 
25   blink::IndexedDBKey
26       primary_key;  // primary key (only when using key generator)
27   blink::IndexedDBKeyPath key_path;
28 };
29 
30 }  // namespace content
31 
32 #endif  // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_RETURN_VALUE_H_
33