2
* Copyright (C) 2010 Apple Inc. All rights reserved.
4
* Redistribution and use in source and binary forms, with or without
5
* modification, are permitted provided that the following conditions
7
* 1. Redistributions of source code must retain the above copyright
8
* notice, this list of conditions and the following disclaimer.
9
* 2. Redistributions in binary form must reproduce the above copyright
10
* notice, this list of conditions and the following disclaimer in the
11
* documentation and/or other materials provided with the distribution.
13
* THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
14
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
15
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
17
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
23
* THE POSSIBILITY OF SUCH DAMAGE.
26
#ifndef NPVariantData_h
27
#define NPVariantData_h
29
#if ENABLE(PLUGIN_PROCESS)
31
#include <wtf/text/CString.h>
34
class ArgumentDecoder;
35
class ArgumentEncoder;
40
// The CoreIPC representation of an NPVariant.
56
static NPVariantData makeVoid();
57
static NPVariantData makeNull();
58
static NPVariantData makeBool(bool value);
59
static NPVariantData makeInt32(int32_t value);
60
static NPVariantData makeDouble(double value);
61
static NPVariantData makeString(const char* string, unsigned length);
62
static NPVariantData makeLocalNPObjectID(uint64_t value);
63
static NPVariantData makeRemoteNPObjectID(uint64_t value);
65
Type type() const { return static_cast<Type>(m_type); }
67
bool boolValue() const
69
ASSERT(type() == NPVariantData::Bool);
73
int32_t int32Value() const
75
ASSERT(type() == NPVariantData::Int32);
79
double doubleValue() const
81
ASSERT(type() == NPVariantData::Double);
85
const CString& stringValue() const
87
ASSERT(type() == NPVariantData::String);
91
uint64_t localNPObjectIDValue() const
93
ASSERT(type() == NPVariantData::LocalNPObjectID);
94
return m_localNPObjectIDValue;
97
uint64_t remoteNPObjectIDValue() const
99
ASSERT(type() == NPVariantData::RemoteNPObjectID);
100
return m_remoteNPObjectIDValue;
103
void encode(CoreIPC::ArgumentEncoder&) const;
104
static bool decode(CoreIPC::ArgumentDecoder*, NPVariantData&);
109
int32_t m_int32Value;
110
double m_doubleValue;
111
CString m_stringValue;
112
uint64_t m_localNPObjectIDValue;
113
uint64_t m_remoteNPObjectIDValue;
116
} // namespace WebKit
118
#endif // ENABLE(PLUGIN_PROCESS)
120
#endif // NPVariantData_h