diff options
author | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-16 21:32:10 +0000 |
---|---|---|
committer | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-16 21:32:10 +0000 |
commit | 127dd58a7dae9f8492bb2426ce190d7d2c9ca1d7 (patch) | |
tree | deaa6d755e460f647d14d49cf963eb3b1cb509bf /content/common/indexed_db_key.cc | |
parent | 25f8a30ee91813f9216c6e9b23eaf760a3bd02a8 (diff) | |
download | chromium_src-127dd58a7dae9f8492bb2426ce190d7d2c9ca1d7.zip chromium_src-127dd58a7dae9f8492bb2426ce190d7d2c9ca1d7.tar.gz chromium_src-127dd58a7dae9f8492bb2426ce190d7d2c9ca1d7.tar.bz2 |
Move all the message files in chrome that belong in content.
TBR=avi
Review URL: http://codereview.chromium.org/6672057
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@78435 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/common/indexed_db_key.cc')
-rw-r--r-- | content/common/indexed_db_key.cc | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/content/common/indexed_db_key.cc b/content/common/indexed_db_key.cc new file mode 100644 index 0000000..ee02fa1 --- /dev/null +++ b/content/common/indexed_db_key.cc @@ -0,0 +1,71 @@ +// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "content/common/indexed_db_key.h" + +#include "base/logging.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h" + +using WebKit::WebIDBKey; + +IndexedDBKey::IndexedDBKey() + : type_(WebIDBKey::InvalidType), + date_(0), + number_(0) { +} + +IndexedDBKey::IndexedDBKey(const WebIDBKey& key) { + Set(key); +} + +IndexedDBKey::~IndexedDBKey() { +} + +void IndexedDBKey::SetNull() { + type_ = WebIDBKey::NullType; +} + +void IndexedDBKey::SetInvalid() { + type_ = WebIDBKey::InvalidType; +} + +void IndexedDBKey::SetString(const string16& string) { + type_ = WebIDBKey::StringType; + string_ = string; +} + +void IndexedDBKey::SetDate(double date) { + type_ = WebIDBKey::DateType; + date_ = date; +} + +void IndexedDBKey::SetNumber(double number) { + type_ = WebIDBKey::NumberType; + number_ = number; +} + +void IndexedDBKey::Set(const WebIDBKey& key) { + type_ = key.type(); + string_ = key.type() == WebIDBKey::StringType ? + static_cast<string16>(key.string()) : string16(); + number_ = key.type() == WebIDBKey::NumberType ? key.number() : 0; + date_ = key.type() == WebIDBKey::DateType ? key.date() : 0; +} + +IndexedDBKey::operator WebIDBKey() const { + switch (type_) { + case WebIDBKey::NullType: + return WebIDBKey::createNull(); + case WebIDBKey::StringType: + return WebIDBKey::createString(string_); + case WebIDBKey::DateType: + return WebIDBKey::createDate(date_); + case WebIDBKey::NumberType: + return WebIDBKey::createNumber(number_); + case WebIDBKey::InvalidType: + return WebIDBKey::createInvalid(); + } + NOTREACHED(); + return WebIDBKey::createInvalid(); +} |