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

Side by Side Diff: src/JsEngine.cpp

Issue 5797488346791936: Issue 1107 - Support notifications (Closed)
Patch Set: move MarkAsShown into Notification class and get rid of locale arg in Notification::GetTexts Created Jan. 22, 2015, 10:02 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
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 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 const JsContext context(shared_from_this()); 137 const JsContext context(shared_from_this());
138 return JsValuePtr(new JsValue(shared_from_this(), v8::Boolean::New(val))); 138 return JsValuePtr(new JsValue(shared_from_this(), v8::Boolean::New(val)));
139 } 139 }
140 140
141 AdblockPlus::JsValuePtr AdblockPlus::JsEngine::NewObject() 141 AdblockPlus::JsValuePtr AdblockPlus::JsEngine::NewObject()
142 { 142 {
143 const JsContext context(shared_from_this()); 143 const JsContext context(shared_from_this());
144 return JsValuePtr(new JsValue(shared_from_this(), v8::Object::New())); 144 return JsValuePtr(new JsValue(shared_from_this(), v8::Object::New()));
145 } 145 }
146 146
147 AdblockPlus::JsValuePtr AdblockPlus::JsEngine::NewArray()
148 {
149 const JsContext context(shared_from_this());
150 return JsValuePtr(new JsValue(shared_from_this(), v8::Array::New()));
151 }
152
147 AdblockPlus::JsValuePtr AdblockPlus::JsEngine::NewCallback( 153 AdblockPlus::JsValuePtr AdblockPlus::JsEngine::NewCallback(
148 v8::InvocationCallback callback) 154 v8::InvocationCallback callback)
149 { 155 {
150 const JsContext context(shared_from_this()); 156 const JsContext context(shared_from_this());
151 157
152 // Note: we are leaking this weak pointer, no obvious way to destroy it when 158 // Note: we are leaking this weak pointer, no obvious way to destroy it when
153 // it's no longer used 159 // it's no longer used
154 std::tr1::weak_ptr<JsEngine>* data = 160 std::tr1::weak_ptr<JsEngine>* data =
155 new std::tr1::weak_ptr<JsEngine>(shared_from_this()); 161 new std::tr1::weak_ptr<JsEngine>(shared_from_this());
156 v8::Local<v8::FunctionTemplate> templ = v8::FunctionTemplate::New(callback, 162 v8::Local<v8::FunctionTemplate> templ = v8::FunctionTemplate::New(callback,
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 return logSystem; 222 return logSystem;
217 } 223 }
218 224
219 void AdblockPlus::JsEngine::SetLogSystem(AdblockPlus::LogSystemPtr val) 225 void AdblockPlus::JsEngine::SetLogSystem(AdblockPlus::LogSystemPtr val)
220 { 226 {
221 if (!val) 227 if (!val)
222 throw std::runtime_error("LogSystem cannot be null"); 228 throw std::runtime_error("LogSystem cannot be null");
223 229
224 logSystem = val; 230 logSystem = val;
225 } 231 }
OLDNEW

Powered by Google App Engine
This is Rietveld