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

Side by Side Diff: fpdfsdk/javascript/Document.cpp

Issue 2202283002: Introduce ::getPropertyInternal method to avoid duplication (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Add support to Document::URL property getter. 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 unified diff | Download patch
« no previous file with comments | « fpdfsdk/javascript/Document.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "fpdfsdk/javascript/Document.h" 7 #include "fpdfsdk/javascript/Document.h"
8 8
9 #include <vector> 9 #include <vector>
10 10
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 JS_STATIC_PROP_ENTRY(mouseX) 84 JS_STATIC_PROP_ENTRY(mouseX)
85 JS_STATIC_PROP_ENTRY(mouseY) 85 JS_STATIC_PROP_ENTRY(mouseY)
86 JS_STATIC_PROP_ENTRY(numFields) 86 JS_STATIC_PROP_ENTRY(numFields)
87 JS_STATIC_PROP_ENTRY(numPages) 87 JS_STATIC_PROP_ENTRY(numPages)
88 JS_STATIC_PROP_ENTRY(pageNum) 88 JS_STATIC_PROP_ENTRY(pageNum)
89 JS_STATIC_PROP_ENTRY(pageWindowRect) 89 JS_STATIC_PROP_ENTRY(pageWindowRect)
90 JS_STATIC_PROP_ENTRY(path) 90 JS_STATIC_PROP_ENTRY(path)
91 JS_STATIC_PROP_ENTRY(producer) 91 JS_STATIC_PROP_ENTRY(producer)
92 JS_STATIC_PROP_ENTRY(subject) 92 JS_STATIC_PROP_ENTRY(subject)
93 JS_STATIC_PROP_ENTRY(title) 93 JS_STATIC_PROP_ENTRY(title)
94 JS_STATIC_PROP_ENTRY(URL)
94 JS_STATIC_PROP_ENTRY(zoom) 95 JS_STATIC_PROP_ENTRY(zoom)
95 JS_STATIC_PROP_ENTRY(zoomType) 96 JS_STATIC_PROP_ENTRY(zoomType)
96 END_JS_STATIC_PROP() 97 END_JS_STATIC_PROP()
97 98
98 BEGIN_JS_STATIC_METHOD(CJS_Document) 99 BEGIN_JS_STATIC_METHOD(CJS_Document)
99 JS_STATIC_METHOD_ENTRY(addAnnot) 100 JS_STATIC_METHOD_ENTRY(addAnnot)
100 JS_STATIC_METHOD_ENTRY(addField) 101 JS_STATIC_METHOD_ENTRY(addField)
101 JS_STATIC_METHOD_ENTRY(addLink) 102 JS_STATIC_METHOD_ENTRY(addLink)
102 JS_STATIC_METHOD_ENTRY(addIcon) 103 JS_STATIC_METHOD_ENTRY(addIcon)
103 JS_STATIC_METHOD_ENTRY(calculateNow) 104 JS_STATIC_METHOD_ENTRY(calculateNow)
(...skipping 793 matching lines...) Expand 10 before | Expand all | Expand 10 after
897 CFX_WideString& sError) { 898 CFX_WideString& sError) {
898 return TRUE; 899 return TRUE;
899 } 900 }
900 901
901 FX_BOOL Document::mouseY(IJS_Context* cc, 902 FX_BOOL Document::mouseY(IJS_Context* cc,
902 CJS_PropValue& vp, 903 CJS_PropValue& vp,
903 CFX_WideString& sError) { 904 CFX_WideString& sError) {
904 return TRUE; 905 return TRUE;
905 } 906 }
906 907
908 FX_BOOL Document::URL(IJS_Context* cc,
909 CJS_PropValue& vp,
910 CFX_WideString& sError) {
911 if (vp.IsSetting()) {
912 CJS_Context* pContext = static_cast<CJS_Context*>(cc);
913 sError = JSGetStringFromID(pContext, IDS_STRING_JSREADONLY);
914 return FALSE;
915 }
916 CFX_WideString wsFilePath = m_pDocument->GetPath();
917 vp << wsFilePath;
918 return TRUE;
919 }
920
907 FX_BOOL Document::baseURL(IJS_Context* cc, 921 FX_BOOL Document::baseURL(IJS_Context* cc,
908 CJS_PropValue& vp, 922 CJS_PropValue& vp,
909 CFX_WideString& sError) { 923 CFX_WideString& sError) {
910 if (vp.IsGetting()) { 924 if (vp.IsGetting()) {
911 vp << m_cwBaseURL; 925 vp << m_cwBaseURL;
912 } else { 926 } else {
913 vp >> m_cwBaseURL; 927 vp >> m_cwBaseURL;
914 } 928 }
915 return TRUE; 929 return TRUE;
916 } 930 }
(...skipping 552 matching lines...) Expand 10 before | Expand all | Expand 10 after
1469 } 1483 }
1470 } 1484 }
1471 1485
1472 for (const auto& pData : DelayDataForFieldAndControlIndex) 1486 for (const auto& pData : DelayDataForFieldAndControlIndex)
1473 Field::DoDelay(m_pDocument, pData.get()); 1487 Field::DoDelay(m_pDocument, pData.get());
1474 } 1488 }
1475 1489
1476 CJS_Document* Document::GetCJSDoc() const { 1490 CJS_Document* Document::GetCJSDoc() const {
1477 return static_cast<CJS_Document*>(m_pJSObject); 1491 return static_cast<CJS_Document*>(m_pJSObject);
1478 } 1492 }
OLDNEW
« no previous file with comments | « fpdfsdk/javascript/Document.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698