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 3// found in the LICENSE file. 4 5#ifndef CONTENT_BROWSER_RENDERER_HOST_JAVA_JAVA_TYPE_H_ 6#define CONTENT_BROWSER_RENDERER_HOST_JAVA_JAVA_TYPE_H_ 7 8#include <string> 9 10#include "base/memory/scoped_ptr.h" 11 12namespace content { 13 14// The type of a Java value. A light-weight enum-like structure intended for 15// use by value and in STL containers. 16struct JavaType { 17 JavaType(); 18 JavaType(const JavaType& other); 19 ~JavaType(); 20 JavaType& operator=(const JavaType& other); 21 22 // Java's reflection API represents types as a string using an extended 23 // 'binary name'. 24 static JavaType CreateFromBinaryName(const std::string& binary_name); 25 26 enum Type { 27 TypeBoolean, 28 TypeByte, 29 TypeChar, 30 TypeShort, 31 TypeInt, 32 TypeLong, 33 TypeFloat, 34 TypeDouble, 35 // This is only used as a return type, so we should never convert from 36 // JavaScript with this type. 37 TypeVoid, 38 TypeArray, 39 // We special-case strings, as they get special handling when coercing. 40 TypeString, 41 TypeObject, 42 }; 43 44 Type type; 45 scoped_ptr<JavaType> inner_type; // Used for TypeArray only. 46}; 47 48} // namespace content 49 50#endif // CONTENT_BROWSER_RENDERER_HOST_JAVA_JAVA_TYPE_H_ 51