diff options
author | jaepark <jaepark@google.com> | 2016-08-31 06:49:27 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-08-31 06:49:27 -0700 |
commit | 956553e715787cfc4dd8423d5e9a04a0131878c3 (patch) | |
tree | 08622d504322d5dae37b5bb5025a90c81ebdee6b /fpdfsdk/cpdfsdk_annothandlermgr.cpp | |
parent | 87dffc0315477150c9c1964913b65bc97bdf654f (diff) | |
download | pdfium-956553e715787cfc4dd8423d5e9a04a0131878c3.tar.xz |
Use enum class for subtypes of CPDF_Annot.
Comparing CFX_ByteString for annotation subtypes is inefficient and
error-prone. This CL uses enum class to compare annotation subtypes.
Also, remove unused IPDFSDK_AnnotHandler::GetType() and
FSDK_XFAWIDGET_TYPENAME.
Review-Url: https://codereview.chromium.org/2295953002
Diffstat (limited to 'fpdfsdk/cpdfsdk_annothandlermgr.cpp')
-rw-r--r-- | fpdfsdk/cpdfsdk_annothandlermgr.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/fpdfsdk/cpdfsdk_annothandlermgr.cpp b/fpdfsdk/cpdfsdk_annothandlermgr.cpp index 9f5a545d65..d909f5bc0d 100644 --- a/fpdfsdk/cpdfsdk_annothandlermgr.cpp +++ b/fpdfsdk/cpdfsdk_annothandlermgr.cpp @@ -46,7 +46,8 @@ CPDFSDK_Annot* CPDFSDK_AnnotHandlerMgr::NewAnnot(CXFA_FFWidget* pAnnot, ASSERT(pAnnot); ASSERT(pPageView); - return GetAnnotHandler(FSDK_XFAWIDGET_TYPENAME)->NewAnnot(pAnnot, pPageView); + return GetAnnotHandler(CPDF_Annot::Subtype::XFAWIDGET) + ->NewAnnot(pAnnot, pPageView); } #endif // PDF_ENABLE_XFA @@ -77,12 +78,12 @@ IPDFSDK_AnnotHandler* CPDFSDK_AnnotHandlerMgr::GetAnnotHandler( } IPDFSDK_AnnotHandler* CPDFSDK_AnnotHandlerMgr::GetAnnotHandler( - const CFX_ByteString& sType) const { - if (sType == "Widget") + CPDF_Annot::Subtype nAnnotSubtype) const { + if (nAnnotSubtype == CPDF_Annot::Subtype::WIDGET) return m_pWidgetHandler.get(); #ifdef PDF_ENABLE_XFA - if (sType == FSDK_XFAWIDGET_TYPENAME) + if (nAnnotSubtype == CPDF_Annot::Subtype::XFAWIDGET) return m_pXFAWidgetHandler.get(); #endif // PDF_ENABLE_XFA @@ -242,7 +243,7 @@ FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnChangeFocus( if (bXFA) { if (IPDFSDK_AnnotHandler* pXFAAnnotHandler = - GetAnnotHandler(FSDK_XFAWIDGET_TYPENAME)) + GetAnnotHandler(CPDF_Annot::Subtype::XFAWIDGET)) return pXFAAnnotHandler->OnXFAChangedFocus(pKillAnnot, pSetAnnot); } @@ -299,7 +300,7 @@ CPDFSDK_Annot* CPDFSDK_AnnotHandlerMgr::GetNextAnnot(CPDFSDK_Annot* pSDKAnnot, return pPageView->GetAnnotByXFAWidget(hNextFocus); #else // PDF_ENABLE_XFA - CBA_AnnotIterator ai(pSDKAnnot->GetPageView(), "Widget"); + CBA_AnnotIterator ai(pSDKAnnot->GetPageView(), CPDF_Annot::Subtype::WIDGET); return bNext ? ai.GetNextAnnot(pSDKAnnot) : ai.GetPrevAnnot(pSDKAnnot); #endif // PDF_ENABLE_XFA } |