summaryrefslogtreecommitdiff
path: root/fpdfsdk/include/ipdfsdk_annothandler.h
diff options
context:
space:
mode:
authortsepez <tsepez@chromium.org>2016-09-27 14:29:57 -0700
committerCommit bot <commit-bot@chromium.org>2016-09-27 14:29:57 -0700
commitf8074cefb2f8d947fa83d151bcbe080b485d6e6b (patch)
treefe97655234318181a58827666576010abb745b18 /fpdfsdk/include/ipdfsdk_annothandler.h
parentec7a9455c15b2cebb75a6036c8636beb601e543a (diff)
downloadpdfium-f8074cefb2f8d947fa83d151bcbe080b485d6e6b.tar.xz
Watch destruction of widgets around OnAAction() method.
We implemented the CFX_Observable mechanism for detecting stale objects some time ago; now just use it in more places. Change method signatures to required an ObservedPtr to indicate that the callers are aware that the value may be destroyed out from underneath them. BUG=649659 Review-Url: https://codereview.chromium.org/2368403002
Diffstat (limited to 'fpdfsdk/include/ipdfsdk_annothandler.h')
-rw-r--r--fpdfsdk/include/ipdfsdk_annothandler.h33
1 files changed, 18 insertions, 15 deletions
diff --git a/fpdfsdk/include/ipdfsdk_annothandler.h b/fpdfsdk/include/ipdfsdk_annothandler.h
index d2f9010b76..f1db6983c0 100644
--- a/fpdfsdk/include/ipdfsdk_annothandler.h
+++ b/fpdfsdk/include/ipdfsdk_annothandler.h
@@ -9,11 +9,11 @@
#include "core/fxcrt/include/fx_basic.h"
#include "core/fxcrt/include/fx_coordinates.h"
+#include "fpdfsdk/include/cpdfsdk_annot.h"
class CFX_Matrix;
class CFX_RenderDevice;
class CPDF_Annot;
-class CPDFSDK_Annot;
class CPDFSDK_PageView;
#ifdef PDF_ENABLE_XFA
@@ -49,43 +49,44 @@ class IPDFSDK_AnnotHandler {
virtual void OnLoad(CPDFSDK_Annot* pAnnot) = 0;
virtual void OnDelete(CPDFSDK_Annot* pAnnot) = 0;
virtual void OnRelease(CPDFSDK_Annot* pAnnot) = 0;
+
virtual void OnMouseEnter(CPDFSDK_PageView* pPageView,
- CPDFSDK_Annot* pAnnot,
+ CPDFSDK_Annot::ObservedPtr* pAnnot,
uint32_t nFlag) = 0;
virtual void OnMouseExit(CPDFSDK_PageView* pPageView,
- CPDFSDK_Annot* pAnnot,
+ CPDFSDK_Annot::ObservedPtr* pAnnot,
uint32_t nFlag) = 0;
virtual FX_BOOL OnLButtonDown(CPDFSDK_PageView* pPageView,
- CPDFSDK_Annot* pAnnot,
+ CPDFSDK_Annot::ObservedPtr* pAnnot,
uint32_t nFlags,
const CFX_FloatPoint& point) = 0;
virtual FX_BOOL OnLButtonUp(CPDFSDK_PageView* pPageView,
- CPDFSDK_Annot* pAnnot,
+ CPDFSDK_Annot::ObservedPtr* pAnnot,
uint32_t nFlags,
const CFX_FloatPoint& point) = 0;
virtual FX_BOOL OnLButtonDblClk(CPDFSDK_PageView* pPageView,
- CPDFSDK_Annot* pAnnot,
+ CPDFSDK_Annot::ObservedPtr* pAnnot,
uint32_t nFlags,
const CFX_FloatPoint& point) = 0;
virtual FX_BOOL OnMouseMove(CPDFSDK_PageView* pPageView,
- CPDFSDK_Annot* pAnnot,
+ CPDFSDK_Annot::ObservedPtr* pAnnot,
uint32_t nFlags,
const CFX_FloatPoint& point) = 0;
virtual FX_BOOL OnMouseWheel(CPDFSDK_PageView* pPageView,
- CPDFSDK_Annot* pAnnot,
+ CPDFSDK_Annot::ObservedPtr* pAnnot,
uint32_t nFlags,
short zDelta,
const CFX_FloatPoint& point) = 0;
virtual FX_BOOL OnRButtonDown(CPDFSDK_PageView* pPageView,
- CPDFSDK_Annot* pAnnot,
+ CPDFSDK_Annot::ObservedPtr* pAnnot,
uint32_t nFlags,
const CFX_FloatPoint& point) = 0;
virtual FX_BOOL OnRButtonUp(CPDFSDK_PageView* pPageView,
- CPDFSDK_Annot* pAnnot,
+ CPDFSDK_Annot::ObservedPtr* pAnnot,
uint32_t nFlags,
const CFX_FloatPoint& point) = 0;
virtual FX_BOOL OnRButtonDblClk(CPDFSDK_PageView* pPageView,
- CPDFSDK_Annot* pAnnot,
+ CPDFSDK_Annot::ObservedPtr* pAnnot,
uint32_t nFlags,
const CFX_FloatPoint& point) = 0;
virtual FX_BOOL OnChar(CPDFSDK_Annot* pAnnot,
@@ -95,11 +96,13 @@ class IPDFSDK_AnnotHandler {
virtual FX_BOOL OnKeyUp(CPDFSDK_Annot* pAnnot, int nKeyCode, int nFlag) = 0;
virtual void OnDeSelected(CPDFSDK_Annot* pAnnot) = 0;
virtual void OnSelected(CPDFSDK_Annot* pAnnot) = 0;
- virtual FX_BOOL OnSetFocus(CPDFSDK_Annot* pAnnot, uint32_t nFlag) = 0;
- virtual FX_BOOL OnKillFocus(CPDFSDK_Annot* pAnnot, uint32_t nFlag) = 0;
+ virtual FX_BOOL OnSetFocus(CPDFSDK_Annot::ObservedPtr* pAnnot,
+ uint32_t nFlag) = 0;
+ virtual FX_BOOL OnKillFocus(CPDFSDK_Annot::ObservedPtr* pAnnot,
+ uint32_t nFlag) = 0;
#ifdef PDF_ENABLE_XFA
- virtual FX_BOOL OnXFAChangedFocus(CPDFSDK_Annot* pOldAnnot,
- CPDFSDK_Annot* pNewAnnot) = 0;
+ virtual FX_BOOL OnXFAChangedFocus(CPDFSDK_Annot::ObservedPtr* pOldAnnot,
+ CPDFSDK_Annot::ObservedPtr* pNewAnnot) = 0;
#endif // PDF_ENABLE_XFA
};