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

Unified Diff: core/fpdfdoc/cpdf_docjsactions.cpp

Issue 2192823002: Splitting fpdfdoc/doc_* part I (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@fpdf_doc_II
Patch Set: Stddef not stdint Created 4 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « core/fpdfdoc/cpdf_bookmarktree.cpp ('k') | core/fpdfdoc/cpdf_link.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/fpdfdoc/cpdf_docjsactions.cpp
diff --git a/core/fpdfdoc/cpdf_docjsactions.cpp b/core/fpdfdoc/cpdf_docjsactions.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..897cdac6104dd38b469b0adcef3f758c6c7ee3af
--- /dev/null
+++ b/core/fpdfdoc/cpdf_docjsactions.cpp
@@ -0,0 +1,40 @@
+// Copyright 2016 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#include "core/fpdfdoc/include/cpdf_docjsactions.h"
+
+#include "core/fpdfdoc/include/cpdf_nametree.h"
+
+CPDF_DocJSActions::CPDF_DocJSActions(CPDF_Document* pDoc) : m_pDocument(pDoc) {}
+
+int CPDF_DocJSActions::CountJSActions() const {
+ ASSERT(m_pDocument);
+ CPDF_NameTree name_tree(m_pDocument, "JavaScript");
+ return name_tree.GetCount();
+}
+
+CPDF_Action CPDF_DocJSActions::GetJSAction(int index,
+ CFX_ByteString& csName) const {
+ ASSERT(m_pDocument);
+ CPDF_NameTree name_tree(m_pDocument, "JavaScript");
+ CPDF_Object* pAction = name_tree.LookupValue(index, csName);
+ return ToDictionary(pAction) ? CPDF_Action(pAction->GetDict())
+ : CPDF_Action();
+}
+
+CPDF_Action CPDF_DocJSActions::GetJSAction(const CFX_ByteString& csName) const {
+ ASSERT(m_pDocument);
+ CPDF_NameTree name_tree(m_pDocument, "JavaScript");
+ CPDF_Object* pAction = name_tree.LookupValue(csName);
+ return ToDictionary(pAction) ? CPDF_Action(pAction->GetDict())
+ : CPDF_Action();
+}
+
+int CPDF_DocJSActions::FindJSAction(const CFX_ByteString& csName) const {
+ ASSERT(m_pDocument);
+ CPDF_NameTree name_tree(m_pDocument, "JavaScript");
+ return name_tree.GetIndex(csName);
+}
« no previous file with comments | « core/fpdfdoc/cpdf_bookmarktree.cpp ('k') | core/fpdfdoc/cpdf_link.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698