diff options
author | jorlow@chromium.org <jorlow@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-14 14:29:40 +0000 |
---|---|---|
committer | jorlow@chromium.org <jorlow@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-14 14:29:40 +0000 |
commit | 5c71640cdf15c2782b8331e9e2623da50ec5d102 (patch) | |
tree | da7cf7505bb23c3e206bdcaab66f064d3edc5936 /chrome/common/serialized_script_value.cc | |
parent | 699f2246bf56e1aadf31e1edd6c5aef9b4b39638 (diff) | |
download | chromium_src-5c71640cdf15c2782b8331e9e2623da50ec5d102.zip chromium_src-5c71640cdf15c2782b8331e9e2623da50ec5d102.tar.gz chromium_src-5c71640cdf15c2782b8331e9e2623da50ec5d102.tar.bz2 |
The Chrome half of implementing get/put/remove for object stores (https://bugs.webkit.org/show_bug.cgi?id=41250).
TEST=none
BUG=none
Review URL: http://codereview.chromium.org/2830030
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@52313 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common/serialized_script_value.cc')
-rw-r--r-- | chrome/common/serialized_script_value.cc | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/chrome/common/serialized_script_value.cc b/chrome/common/serialized_script_value.cc new file mode 100644 index 0000000..095f4e6 --- /dev/null +++ b/chrome/common/serialized_script_value.cc @@ -0,0 +1,37 @@ +// 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 "chrome/common/serialized_script_value.h" + +#include "third_party/WebKit/WebKit/chromium/public/WebString.h" + +using WebKit::WebSerializedScriptValue; + +SerializedScriptValue::SerializedScriptValue() + : is_null_(true), + is_invalid_(false) { +} + +SerializedScriptValue::SerializedScriptValue( + bool is_null, bool is_invalid, const string16& data) + : is_null_(is_null), + is_invalid_(is_invalid), + data_(data) { +} + +SerializedScriptValue::SerializedScriptValue( + const WebSerializedScriptValue& value) + : is_null_(value.isNull()), + is_invalid_(value.isNull() ? false : value.toString().isNull()), + data_(value.isNull() ? string16() + : static_cast<string16>(value.toString())) { +} + +SerializedScriptValue::operator WebSerializedScriptValue() const { + if (is_null_) + return WebSerializedScriptValue(); + if (is_invalid_) + return WebSerializedScriptValue::createInvalid(); + return WebSerializedScriptValue::fromString(data_); +} |