Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(73)

Side by Side Diff: content/common/indexed_db/indexed_db_key_range.cc

Issue 19752007: Use builders to convert between WebKit and content IDB types (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "content/common/indexed_db/indexed_db_key_range.h" 5 #include "content/common/indexed_db/indexed_db_key_range.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "third_party/WebKit/public/platform/WebIDBKey.h" 8 #include "third_party/WebKit/public/platform/WebIDBTypes.h"
9 9
10 namespace content { 10 namespace content {
11 11
12 using WebKit::WebIDBKeyRange;
13
14 IndexedDBKeyRange::IndexedDBKeyRange() 12 IndexedDBKeyRange::IndexedDBKeyRange()
15 : lower_(WebKit::WebIDBKeyTypeNull), 13 : lower_(WebKit::WebIDBKeyTypeNull),
16 upper_(WebKit::WebIDBKeyTypeNull), 14 upper_(WebKit::WebIDBKeyTypeNull),
17 lower_open_(false), 15 lower_open_(false),
18 upper_open_(false) {} 16 upper_open_(false) {}
19 17
20 IndexedDBKeyRange::IndexedDBKeyRange(const WebIDBKeyRange& key_range)
21 : lower_(key_range.lower()),
22 upper_(key_range.upper()),
23 lower_open_(key_range.lowerOpen()),
24 upper_open_(key_range.upperOpen()) {}
25
26 IndexedDBKeyRange::IndexedDBKeyRange(const IndexedDBKey& lower, 18 IndexedDBKeyRange::IndexedDBKeyRange(const IndexedDBKey& lower,
27 const IndexedDBKey& upper, 19 const IndexedDBKey& upper,
28 bool lower_open, 20 bool lower_open,
29 bool upper_open) 21 bool upper_open)
30 : lower_(lower), 22 : lower_(lower),
31 upper_(upper), 23 upper_(upper),
32 lower_open_(lower_open), 24 lower_open_(lower_open),
33 upper_open_(upper_open) {} 25 upper_open_(upper_open) {}
34 26
35 IndexedDBKeyRange::IndexedDBKeyRange(const IndexedDBKey& key) 27 IndexedDBKeyRange::IndexedDBKeyRange(const IndexedDBKey& key)
36 : lower_(key), upper_(key), lower_open_(false), upper_open_(false) {} 28 : lower_(key), upper_(key), lower_open_(false), upper_open_(false) {}
37 29
38 IndexedDBKeyRange::~IndexedDBKeyRange() {} 30 IndexedDBKeyRange::~IndexedDBKeyRange() {}
39 31
40 bool IndexedDBKeyRange::IsOnlyKey() const { 32 bool IndexedDBKeyRange::IsOnlyKey() const {
41 if (lower_open_ || upper_open_) 33 if (lower_open_ || upper_open_)
42 return false; 34 return false;
43 35
44 return lower_.IsEqual(upper_); 36 return lower_.IsEqual(upper_);
45 } 37 }
46 38
47 IndexedDBKeyRange::operator WebIDBKeyRange() const {
48 return WebIDBKeyRange(lower_, upper_, lower_open_, upper_open_);
49 }
50
51 } // namespace content 39 } // namespace content
OLDNEW
« no previous file with comments | « content/common/indexed_db/indexed_db_key_range.h ('k') | content/common/indexed_db/indexed_db_key_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698