From ce04a458828b45035dab46c13e14a1f0ae67a2b7 Mon Sep 17 00:00:00 2001 From: dsinclair Date: Wed, 7 Sep 2016 05:46:55 -0700 Subject: Add observer for BAAnnots from Javascript This Cl moves the observer code from the CPDFSDK_Widget up into the CPDFSDK_Annot base class and then adds a second observer for CPDFSDK_BAAnnot objects. This allows us to attach an observer to the Annot javascript class which will update its internal pointer to the BAAnnot if the BAAnnot is destroyed by the CPDFSDK_PageView being destroyed. BUG=chromium:642307 Review-Url: https://codereview.chromium.org/2306663002 --- fpdfsdk/javascript/Annot.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'fpdfsdk/javascript/Annot.h') diff --git a/fpdfsdk/javascript/Annot.h b/fpdfsdk/javascript/Annot.h index b3ea292aed..be850350ae 100644 --- a/fpdfsdk/javascript/Annot.h +++ b/fpdfsdk/javascript/Annot.h @@ -7,6 +7,8 @@ #ifndef FPDFSDK_JAVASCRIPT_ANNOT_H_ #define FPDFSDK_JAVASCRIPT_ANNOT_H_ +#include + #include "fpdfsdk/include/cpdfsdk_baannot.h" #include "fpdfsdk/javascript/JS_Define.h" @@ -22,7 +24,8 @@ class Annot : public CJS_EmbedObj { void SetSDKAnnot(CPDFSDK_BAAnnot* annot); private: - CPDFSDK_BAAnnot* m_BAAnnot = nullptr; + CPDFSDK_Annot* m_pAnnot = nullptr; + std::unique_ptr m_pObserver; }; class CJS_Annot : public CJS_Object { -- cgit v1.2.3