OLD | NEW |
1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium 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 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
6 | 6 |
7 #include "JS_Runtime.h" | 7 #include "JS_Runtime.h" |
8 | 8 |
9 #include "Consts.h" | 9 #include "Consts.h" |
10 #include "Document.h" | 10 #include "Document.h" |
11 #include "Field.h" | 11 #include "Field.h" |
12 #include "Icon.h" | 12 #include "Icon.h" |
13 #include "JS_Context.h" | 13 #include "JS_Context.h" |
14 #include "JS_Define.h" | 14 #include "JS_Define.h" |
15 #include "JS_EventHandler.h" | 15 #include "JS_EventHandler.h" |
16 #include "JS_GlobalData.h" | 16 #include "JS_GlobalData.h" |
17 #include "JS_Object.h" | 17 #include "JS_Object.h" |
18 #include "JS_Value.h" | 18 #include "JS_Value.h" |
19 #include "PublicMethods.h" | 19 #include "PublicMethods.h" |
20 #include "app.h" | 20 #include "app.h" |
21 #include "color.h" | 21 #include "color.h" |
22 #include "console.h" | 22 #include "console.h" |
23 #include "event.h" | 23 #include "event.h" |
24 #include "fpdfsdk/include/fsdk_mgr.h" // For CPDFDoc_Environment. | 24 #include "fpdfsdk/include/fsdk_mgr.h" // For CPDFDoc_Environment. |
25 #include "fpdfsdk/include/javascript/IJavaScript.h" | 25 #include "fpdfsdk/include/javascript/IJavaScript.h" |
26 #include "global.h" | 26 #include "global.h" |
27 #include "report.h" | 27 #include "report.h" |
28 #include "util.h" | 28 #include "util.h" |
| 29 #include "third_party/base/stl_util.h" |
29 | 30 |
30 #ifdef PDF_ENABLE_XFA | 31 #ifdef PDF_ENABLE_XFA |
31 #include "../../../xfa/src/fxjse/src/value.h" | 32 #include "../../../xfa/src/fxjse/src/value.h" |
32 #include "../../include/fpdfxfa/fpdfxfa_app.h" | 33 #include "../../include/fpdfxfa/fpdfxfa_app.h" |
33 #endif // PDF_ENABLE_XFA | 34 #endif // PDF_ENABLE_XFA |
34 | 35 |
35 // static | 36 // static |
36 void IJS_Runtime::Initialize(unsigned int slot, void* isolate) { | 37 void IJS_Runtime::Initialize(unsigned int slot, void* isolate) { |
37 FXJS_Initialize(slot, reinterpret_cast<v8::Isolate*>(isolate)); | 38 FXJS_Initialize(slot, reinterpret_cast<v8::Isolate*>(isolate)); |
38 } | 39 } |
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
319 context->Global()->Set( | 320 context->Global()->Set( |
320 v8::String::NewFromUtf8(pIsolate, name, v8::String::kNormalString, | 321 v8::String::NewFromUtf8(pIsolate, name, v8::String::kNormalString, |
321 utf8Name.GetLength()), | 322 utf8Name.GetLength()), |
322 propvalue); | 323 propvalue); |
323 #endif | 324 #endif |
324 return TRUE; | 325 return TRUE; |
325 } | 326 } |
326 | 327 |
327 #endif | 328 #endif |
328 void CJS_Runtime::AddObserver(Observer* observer) { | 329 void CJS_Runtime::AddObserver(Observer* observer) { |
329 ASSERT(m_observers.find(observer) == m_observers.end()); | 330 ASSERT(!pdfium::ContainsKey(m_observers, observer)); |
330 m_observers.insert(observer); | 331 m_observers.insert(observer); |
331 } | 332 } |
332 | 333 |
333 void CJS_Runtime::RemoveObserver(Observer* observer) { | 334 void CJS_Runtime::RemoveObserver(Observer* observer) { |
334 ASSERT(m_observers.find(observer) != m_observers.end()); | 335 ASSERT(pdfium::ContainsKey(m_observers, observer)); |
335 m_observers.erase(observer); | 336 m_observers.erase(observer); |
336 } | 337 } |
OLD | NEW |