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

Side by Side Diff: content/renderer/v8_value_converter_impl.h

Issue 10387055: Support optional arguments in SendRequestNatives::StartRequest (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed John's comments Created 8 years, 7 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
« no previous file with comments | « content/renderer/render_view_impl.cc ('k') | content/renderer/v8_value_converter_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CONTENT_RENDERER_V8_VALUE_CONVERTER_IMPL_H_ 5 #ifndef CONTENT_RENDERER_V8_VALUE_CONVERTER_IMPL_H_
6 #define CONTENT_RENDERER_V8_VALUE_CONVERTER_IMPL_H_ 6 #define CONTENT_RENDERER_V8_VALUE_CONVERTER_IMPL_H_
7 7
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "content/common/content_export.h" 9 #include "content/common/content_export.h"
10 #include "content/public/renderer/v8_value_converter.h" 10 #include "content/public/renderer/v8_value_converter.h"
11 11
12 namespace base { 12 namespace base {
13 class BinaryValue; 13 class BinaryValue;
14 class DictionaryValue; 14 class DictionaryValue;
15 class ListValue; 15 class ListValue;
16 class Value; 16 class Value;
17 } 17 }
18 18
19 class CONTENT_EXPORT V8ValueConverterImpl : public content::V8ValueConverter { 19 class CONTENT_EXPORT V8ValueConverterImpl : public content::V8ValueConverter {
20 public: 20 public:
21 V8ValueConverterImpl(); 21 V8ValueConverterImpl();
22 22
23 // Use the following setters to support additional types other than the
24 // default ones.
25 bool allow_undefined() const { return allow_undefined_; }
26 void set_allow_undefined(bool val) { allow_undefined_ = val; }
27
28 bool allow_date() const { return allow_date_; }
29 void set_allow_date(bool val) { allow_date_ = val; }
30
31 bool allow_regexp() const { return allow_regexp_; }
32 void set_allow_regexp(bool val) { allow_regexp_ = val; }
33
34 // V8ValueConverter implementation. 23 // V8ValueConverter implementation.
24 virtual bool GetUndefinedAllowed() const OVERRIDE;
25 virtual void SetUndefinedAllowed(bool val) OVERRIDE;
26 virtual bool GetDateAllowed() const OVERRIDE;
27 virtual void SetDateAllowed(bool val) OVERRIDE;
28 virtual bool GetRegexpAllowed() const OVERRIDE;
29 virtual void SetRegexpAllowed(bool val) OVERRIDE;
35 virtual v8::Handle<v8::Value> ToV8Value( 30 virtual v8::Handle<v8::Value> ToV8Value(
36 const base::Value* value, 31 const base::Value* value,
37 v8::Handle<v8::Context> context) const OVERRIDE; 32 v8::Handle<v8::Context> context) const OVERRIDE;
38 virtual base::Value* FromV8Value( 33 virtual base::Value* FromV8Value(
39 v8::Handle<v8::Value> value, 34 v8::Handle<v8::Value> value,
40 v8::Handle<v8::Context> context) const OVERRIDE; 35 v8::Handle<v8::Context> context) const OVERRIDE;
41 36
42 private: 37 private:
43 v8::Handle<v8::Value> ToV8ValueImpl(const base::Value* value) const; 38 v8::Handle<v8::Value> ToV8ValueImpl(const base::Value* value) const;
44 v8::Handle<v8::Value> ToV8Array(const base::ListValue* list) const; 39 v8::Handle<v8::Value> ToV8Array(const base::ListValue* list) const;
45 v8::Handle<v8::Value> ToV8Object( 40 v8::Handle<v8::Value> ToV8Object(
46 const base::DictionaryValue* dictionary) const; 41 const base::DictionaryValue* dictionary) const;
47 v8::Handle<v8::Value> ToArrayBuffer(const base::BinaryValue* value) const; 42 v8::Handle<v8::Value> ToArrayBuffer(const base::BinaryValue* value) const;
48 43
49 base::Value* FromV8ValueImpl(v8::Handle<v8::Value> value) const; 44 base::Value* FromV8ValueImpl(v8::Handle<v8::Value> value) const;
50 base::ListValue* FromV8Array(v8::Handle<v8::Array> array) const; 45 base::ListValue* FromV8Array(v8::Handle<v8::Array> array) const;
51 46
52 // This will convert objects of type ArrayBuffer or any of the 47 // This will convert objects of type ArrayBuffer or any of the
53 // ArrayBufferView subclasses. The return value will be NULL if |value| is 48 // ArrayBufferView subclasses. The return value will be NULL if |value| is
54 // not one of these types. 49 // not one of these types.
55 base::BinaryValue* FromV8Buffer(v8::Handle<v8::Value> value) const; 50 base::BinaryValue* FromV8Buffer(v8::Handle<v8::Value> value) const;
56 51
57 base::DictionaryValue* FromV8Object(v8::Handle<v8::Object> object) const; 52 base::DictionaryValue* FromV8Object(v8::Handle<v8::Object> object) const;
58 53
59 // If true, we will convert undefined JavaScript values to null. 54 // If true, we will convert undefined JavaScript values to null.
60 bool allow_undefined_; 55 bool undefined_allowed_;
61 56
62 // If true, we will convert Date JavaScript objects to doubles. 57 // If true, we will convert Date JavaScript objects to doubles.
63 bool allow_date_; 58 bool date_allowed_;
64 59
65 // If true, we will convet RegExp JavaScript objects to string. 60 // If true, we will convet RegExp JavaScript objects to string.
66 bool allow_regexp_; 61 bool regexp_allowed_;
67 }; 62 };
68 63
69 #endif // CONTENT_RENDERER_V8_VALUE_CONVERTER_IMPL_H_ 64 #endif // CONTENT_RENDERER_V8_VALUE_CONVERTER_IMPL_H_
OLDNEW
« no previous file with comments | « content/renderer/render_view_impl.cc ('k') | content/renderer/v8_value_converter_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698