Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: include/AdblockPlus/JsValue.h

Issue 5797488346791936: Issue 1107 - Support notifications (Closed)
Patch Set: move GetNotificationTexts into Notification class Created Jan. 21, 2015, 3:54 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « include/AdblockPlus/JsEngine.h ('k') | include/AdblockPlus/Notification.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * This file is part of Adblock Plus <https://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-2015 Eyeo GmbH 3 * Copyright (C) 2006-2015 Eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 { 99 {
100 SetProperty(name, std::string(val)); 100 SetProperty(name, std::string(val));
101 } 101 }
102 inline void SetProperty(const std::string& name, int val) 102 inline void SetProperty(const std::string& name, int val)
103 { 103 {
104 SetProperty(name, static_cast<int64_t>(val)); 104 SetProperty(name, static_cast<int64_t>(val));
105 } 105 }
106 //@} 106 //@}
107 107
108 /** 108 /**
109 * Adds value if this is an array (see `IsArray()`).
110 * @param value Value.
111 */
112 void Push(const JsValuePtr& value);
113
114 /**
109 * Returns the value's class name, e.g.\ _Array_ for arrays 115 * Returns the value's class name, e.g.\ _Array_ for arrays
110 * (see `IsArray()`). 116 * (see `IsArray()`).
111 * Technically, this is the name of the function that was used as a 117 * Technically, this is the name of the function that was used as a
112 * constructor. 118 * constructor.
113 * @return Class name of the value. 119 * @return Class name of the value.
114 */ 120 */
115 std::string GetClass() const; 121 std::string GetClass() const;
116 122
117 /** 123 /**
118 * Invokes the value as a function (see `IsFunction()`). 124 * Invokes the value as a function (see `IsFunction()`).
119 * @param params Optional list of parameters. 125 * @param params Optional list of parameters.
120 * @param thisPtr Optional `this` value. 126 * @param thisPtr Optional `this` value.
121 * @return Value returned by the function. 127 * @return Value returned by the function.
122 */ 128 */
123 JsValuePtr Call(const JsValueList& params = JsValueList(), 129 JsValuePtr Call(const JsValueList& params = JsValueList(),
124 AdblockPlus::JsValuePtr thisPtr = AdblockPlus::JsValuePtr()) const; 130 AdblockPlus::JsValuePtr thisPtr = AdblockPlus::JsValuePtr()) const;
125 131
126 v8::Local<v8::Value> UnwrapValue() const; 132 v8::Local<v8::Value> UnwrapValue() const;
127 protected: 133 protected:
128 JsValue(JsValuePtr value); 134 JsValue(JsValuePtr value);
129 JsEnginePtr jsEngine; 135 JsEnginePtr jsEngine;
130 private: 136 private:
131 JsValue(JsEnginePtr jsEngine, v8::Handle<v8::Value> value); 137 JsValue(JsEnginePtr jsEngine, v8::Handle<v8::Value> value);
132 void SetProperty(const std::string& name, v8::Handle<v8::Value> val); 138 void SetProperty(const std::string& name, v8::Handle<v8::Value> val);
133 V8ValueHolder<v8::Value> value; 139 V8ValueHolder<v8::Value> value;
134 }; 140 };
135 } 141 }
136 142
137 #endif 143 #endif
OLDNEW
« no previous file with comments | « include/AdblockPlus/JsEngine.h ('k') | include/AdblockPlus/Notification.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld