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

Side by Side Diff: chrome/common/serialized_script_value.cc

Issue 6672057: Move all the message files in chrome that belong in content. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 9 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
(Empty)
1 // Copyright (c) 2010 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 #include "chrome/common/serialized_script_value.h"
6
7 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSerializedScriptVa lue.h"
8 #include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h"
9
10 using WebKit::WebSerializedScriptValue;
11
12 SerializedScriptValue::SerializedScriptValue()
13 : is_null_(true),
14 is_invalid_(false) {
15 }
16
17 SerializedScriptValue::SerializedScriptValue(
18 bool is_null, bool is_invalid, const string16& data)
19 : is_null_(is_null),
20 is_invalid_(is_invalid),
21 data_(data) {
22 }
23
24 SerializedScriptValue::SerializedScriptValue(
25 const WebSerializedScriptValue& value) {
26 set_web_serialized_script_value(value);
27 }
28
29 SerializedScriptValue::operator WebSerializedScriptValue() const {
30 if (is_null_)
31 return WebSerializedScriptValue();
32 if (is_invalid_)
33 return WebSerializedScriptValue::createInvalid();
34 return WebSerializedScriptValue::fromString(data_);
35 }
36
37 void SerializedScriptValue::set_web_serialized_script_value(
38 const WebSerializedScriptValue& value) {
39 is_null_ = value.isNull();
40 is_invalid_ = value.isNull() ? false : value.toString().isNull();
41 data_ = value.isNull() ? string16() : static_cast<string16>(value.toString());
42 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698