Stop nesting ObservedPtr inside Observable.

Now, only the ObservedPtr<> is templated, and a templated
Observable isn't required. Templated Observable<> lead to
templated Obeservable<>::ObserverIface, which made usage of
ObservedPtr<> to subclasses awkward, since the ObserverIfaces
weren't subclasses of each other even if the dependent types
were.

The majority of the change is to fix syntax now that
we no longer have a typename in the classes derived from
Observable.

- Rename Observable::Observer to ObserverIface for clarity.

Change-Id: I59f70915f0a87fa2269d051acff5a7206a3e79e8
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/55951
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
diff --git a/core/fpdfapi/page/cpdf_colorspace.h b/core/fpdfapi/page/cpdf_colorspace.h
index 4be7ae4..2757c53 100644
--- a/core/fpdfapi/page/cpdf_colorspace.h
+++ b/core/fpdfapi/page/cpdf_colorspace.h
@@ -43,7 +43,7 @@
   float m_Comps[kMaxPatternColorComps];
 };
 
-class CPDF_ColorSpace : public Retainable, public Observable<CPDF_ColorSpace> {
+class CPDF_ColorSpace : public Retainable, public Observable {
  public:
   static RetainPtr<CPDF_ColorSpace> GetStockCS(int Family);
   static RetainPtr<CPDF_ColorSpace> ColorspaceFromName(const ByteString& name);
diff --git a/core/fpdfapi/page/cpdf_docpagedata.h b/core/fpdfapi/page/cpdf_docpagedata.h
index 84d11dd..08758d0 100644
--- a/core/fpdfapi/page/cpdf_docpagedata.h
+++ b/core/fpdfapi/page/cpdf_docpagedata.h
@@ -107,7 +107,7 @@
 
   bool m_bForceClear = false;
   std::map<ByteString, const CPDF_Stream*> m_HashProfileMap;
-  std::map<const CPDF_Object*, CPDF_ColorSpace::ObservedPtr> m_ColorSpaceMap;
+  std::map<const CPDF_Object*, ObservedPtr<CPDF_ColorSpace>> m_ColorSpaceMap;
   std::map<const CPDF_Stream*, RetainPtr<CPDF_StreamAcc>> m_FontFileMap;
   std::map<const CPDF_Dictionary*, CPDF_CountedFont*> m_FontMap;
   std::map<const CPDF_Stream*, RetainPtr<CPDF_IccProfile>> m_IccProfileMap;
diff --git a/core/fpdfapi/parser/cpdf_data_avail.h b/core/fpdfapi/parser/cpdf_data_avail.h
index 60919c7..6bcea07 100644
--- a/core/fpdfapi/parser/cpdf_data_avail.h
+++ b/core/fpdfapi/parser/cpdf_data_avail.h
@@ -49,7 +49,7 @@
   PDF_PAGENODE_ARRAY,
 };
 
-class CPDF_DataAvail final : public CPDF_Document::Observer {
+class CPDF_DataAvail final : public Observable::ObserverIface {
  public:
   // Must match PDF_DATA_* definitions in public/fpdf_dataavail.h, but cannot
   // #include that header. fpdfsdk/fpdf_dataavail.cpp has static_asserts
diff --git a/core/fpdfapi/parser/cpdf_document.h b/core/fpdfapi/parser/cpdf_document.h
index d8dbcf9..7bd94f5 100644
--- a/core/fpdfapi/parser/cpdf_document.h
+++ b/core/fpdfapi/parser/cpdf_document.h
@@ -34,7 +34,7 @@
 #define FPDFPERM_FILL_FORM 0x0100
 #define FPDFPERM_EXTRACT_ACCESS 0x0200
 
-class CPDF_Document : public Observable<CPDF_Document>,
+class CPDF_Document : public Observable,
                       public CPDF_Parser::ParsedObjectsHolder {
  public:
   // Type from which the XFA extension can subclass itself.
diff --git a/core/fxcrt/BUILD.gn b/core/fxcrt/BUILD.gn
index f8529e4..d4a986d 100644
--- a/core/fxcrt/BUILD.gn
+++ b/core/fxcrt/BUILD.gn
@@ -53,6 +53,7 @@
     "fx_unicode.cpp",
     "fx_unicode.h",
     "maybe_owned.h",
+    "observed_ptr.cpp",
     "observed_ptr.h",
     "pauseindicator_iface.h",
     "retain_ptr.h",
diff --git a/core/fxcrt/observed_ptr.cpp b/core/fxcrt/observed_ptr.cpp
new file mode 100644
index 0000000..f192e69
--- /dev/null
+++ b/core/fxcrt/observed_ptr.cpp
@@ -0,0 +1,15 @@
+// Copyright 2019 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.
+
+#include "core/fxcrt/observed_ptr.h"
+
+namespace fxcrt {
+
+Observable::Observable() = default;
+
+Observable::~Observable() {
+  NotifyObservers();
+}
+
+}  // namespace fxcrt
diff --git a/core/fxcrt/observed_ptr.h b/core/fxcrt/observed_ptr.h
index d674c22..d938168 100644
--- a/core/fxcrt/observed_ptr.h
+++ b/core/fxcrt/observed_ptr.h
@@ -12,66 +12,23 @@
 
 namespace fxcrt {
 
-template <class T>
 class Observable {
  public:
   // General-purpose interface for more complicated cleanup.
-  class Observer {
+  class ObserverIface {
    public:
-    virtual ~Observer() = default;
+    virtual ~ObserverIface() = default;
     virtual void OnObservableDestroyed() = 0;
   };
 
-  // Simple case of a self-nulling pointer.
-  class ObservedPtr final : public Observer {
-   public:
-    ObservedPtr() = default;
-    explicit ObservedPtr(T* pObservable) : m_pObservable(pObservable) {
-      if (m_pObservable)
-        m_pObservable->AddObserver(this);
-    }
-    ObservedPtr(const ObservedPtr& that) : ObservedPtr(that.Get()) {}
-    ~ObservedPtr() override {
-      if (m_pObservable)
-        m_pObservable->RemoveObserver(this);
-    }
-    void Reset(T* pObservable = nullptr) {
-      if (m_pObservable)
-        m_pObservable->RemoveObserver(this);
-      m_pObservable = pObservable;
-      if (m_pObservable)
-        m_pObservable->AddObserver(this);
-    }
-    void OnObservableDestroyed() override {
-      ASSERT(m_pObservable);
-      m_pObservable = nullptr;
-    }
-    bool HasObservable() const { return !!m_pObservable; }
-    ObservedPtr& operator=(const ObservedPtr& that) {
-      Reset(that.Get());
-      return *this;
-    }
-    bool operator==(const ObservedPtr& that) const {
-      return m_pObservable == that.m_pObservable;
-    }
-    bool operator!=(const ObservedPtr& that) const { return !(*this == that); }
-    explicit operator bool() const { return HasObservable(); }
-    T* Get() const { return m_pObservable; }
-    T& operator*() const { return *m_pObservable; }
-    T* operator->() const { return m_pObservable; }
-
-   private:
-    T* m_pObservable = nullptr;
-  };
-
-  Observable() = default;
+  Observable();
   Observable(const Observable& that) = delete;
-  ~Observable() { NotifyObservers(); }
-  void AddObserver(Observer* pObserver) {
+  ~Observable();
+  void AddObserver(ObserverIface* pObserver) {
     ASSERT(!pdfium::ContainsKey(m_Observers, pObserver));
     m_Observers.insert(pObserver);
   }
-  void RemoveObserver(Observer* pObserver) {
+  void RemoveObserver(ObserverIface* pObserver) {
     ASSERT(pdfium::ContainsKey(m_Observers, pObserver));
     m_Observers.erase(pObserver);
   }
@@ -86,11 +43,55 @@
   size_t ActiveObserversForTesting() const { return m_Observers.size(); }
 
  private:
-  std::set<Observer*> m_Observers;
+  std::set<ObserverIface*> m_Observers;
+};
+
+// Simple case of a self-nulling pointer.
+template <typename T>
+class ObservedPtr final : public Observable::ObserverIface {
+ public:
+  ObservedPtr() = default;
+  explicit ObservedPtr(T* pObservable) : m_pObservable(pObservable) {
+    if (m_pObservable)
+      m_pObservable->AddObserver(this);
+  }
+  ObservedPtr(const ObservedPtr& that) : ObservedPtr(that.Get()) {}
+  ~ObservedPtr() override {
+    if (m_pObservable)
+      m_pObservable->RemoveObserver(this);
+  }
+  void Reset(T* pObservable = nullptr) {
+    if (m_pObservable)
+      m_pObservable->RemoveObserver(this);
+    m_pObservable = pObservable;
+    if (m_pObservable)
+      m_pObservable->AddObserver(this);
+  }
+  void OnObservableDestroyed() override {
+    ASSERT(m_pObservable);
+    m_pObservable = nullptr;
+  }
+  bool HasObservable() const { return !!m_pObservable; }
+  ObservedPtr& operator=(const ObservedPtr& that) {
+    Reset(that.Get());
+    return *this;
+  }
+  bool operator==(const ObservedPtr& that) const {
+    return m_pObservable == that.m_pObservable;
+  }
+  bool operator!=(const ObservedPtr& that) const { return !(*this == that); }
+  explicit operator bool() const { return HasObservable(); }
+  T* Get() const { return m_pObservable; }
+  T& operator*() const { return *m_pObservable; }
+  T* operator->() const { return m_pObservable; }
+
+ private:
+  T* m_pObservable = nullptr;
 };
 
 }  // namespace fxcrt
 
 using fxcrt::Observable;
+using fxcrt::ObservedPtr;
 
 #endif  // CORE_FXCRT_OBSERVED_PTR_H_
diff --git a/core/fxcrt/observed_ptr_unittest.cpp b/core/fxcrt/observed_ptr_unittest.cpp
index 34c09fe..4f6535d 100644
--- a/core/fxcrt/observed_ptr_unittest.cpp
+++ b/core/fxcrt/observed_ptr_unittest.cpp
@@ -13,26 +13,26 @@
 namespace fxcrt {
 namespace {
 
-class PseudoObservable final : public Observable<PseudoObservable> {
+class PseudoObservable final : public Observable {
  public:
   int SomeMethod() { return 42; }
   size_t ActiveObservedPtrs() const { return ActiveObserversForTesting(); }
 };
 
-class SelfObservable final : public Observable<SelfObservable> {
+class SelfObservable final : public Observable {
  public:
-  ObservedPtr m_pOther;
+  ObservedPtr<SelfObservable> m_pOther;
 };
 
 }  // namespace
 
 TEST(ObservePtr, Null) {
-  PseudoObservable::ObservedPtr ptr;
+  ObservedPtr<PseudoObservable> ptr;
   EXPECT_EQ(nullptr, ptr.Get());
 }
 
 TEST(ObservePtr, LivesLonger) {
-  PseudoObservable::ObservedPtr ptr;
+  ObservedPtr<PseudoObservable> ptr;
   {
     auto pObs = pdfium::MakeUnique<PseudoObservable>();
     ptr.Reset(pObs.get());
@@ -45,7 +45,7 @@
 TEST(ObservePtr, LivesShorter) {
   PseudoObservable obs;
   {
-    PseudoObservable::ObservedPtr ptr(&obs);
+    ObservedPtr<PseudoObservable> ptr(&obs);
     EXPECT_NE(nullptr, ptr.Get());
     EXPECT_EQ(1u, obs.ActiveObservedPtrs());
   }
@@ -55,11 +55,11 @@
 TEST(ObservePtr, CopyConstruct) {
   PseudoObservable obs;
   {
-    PseudoObservable::ObservedPtr ptr(&obs);
+    ObservedPtr<PseudoObservable> ptr(&obs);
     EXPECT_NE(nullptr, ptr.Get());
     EXPECT_EQ(1u, obs.ActiveObservedPtrs());
     {
-      PseudoObservable::ObservedPtr ptr2(ptr);
+      ObservedPtr<PseudoObservable> ptr2(ptr);
       EXPECT_NE(nullptr, ptr2.Get());
       EXPECT_EQ(2u, obs.ActiveObservedPtrs());
     }
@@ -71,11 +71,11 @@
 TEST(ObservePtr, CopyAssign) {
   PseudoObservable obs;
   {
-    PseudoObservable::ObservedPtr ptr(&obs);
+    ObservedPtr<PseudoObservable> ptr(&obs);
     EXPECT_NE(nullptr, ptr.Get());
     EXPECT_EQ(1u, obs.ActiveObservedPtrs());
     {
-      PseudoObservable::ObservedPtr ptr2;
+      ObservedPtr<PseudoObservable> ptr2;
       ptr2 = ptr;
       EXPECT_NE(nullptr, ptr2.Get());
       EXPECT_EQ(2u, obs.ActiveObservedPtrs());
@@ -88,8 +88,8 @@
 TEST(ObservePtr, Vector) {
   PseudoObservable obs;
   {
-    std::vector<PseudoObservable::ObservedPtr> vec1;
-    std::vector<PseudoObservable::ObservedPtr> vec2;
+    std::vector<ObservedPtr<PseudoObservable>> vec1;
+    std::vector<ObservedPtr<PseudoObservable>> vec2;
     vec1.emplace_back(&obs);
     vec1.emplace_back(&obs);
     EXPECT_NE(nullptr, vec1[0].Get());
@@ -110,7 +110,7 @@
 }
 
 TEST(ObservePtr, VectorAutoClear) {
-  std::vector<PseudoObservable::ObservedPtr> vec1;
+  std::vector<ObservedPtr<PseudoObservable>> vec1;
   {
     PseudoObservable obs;
     vec1.emplace_back(&obs);
@@ -125,7 +125,7 @@
 
 TEST(ObservePtr, ResetNull) {
   PseudoObservable obs;
-  PseudoObservable::ObservedPtr ptr(&obs);
+  ObservedPtr<PseudoObservable> ptr(&obs);
   EXPECT_EQ(1u, obs.ActiveObservedPtrs());
   ptr.Reset();
   EXPECT_EQ(0u, obs.ActiveObservedPtrs());
@@ -134,7 +134,7 @@
 TEST(ObservePtr, Reset) {
   PseudoObservable obs1;
   PseudoObservable obs2;
-  PseudoObservable::ObservedPtr ptr(&obs1);
+  ObservedPtr<PseudoObservable> ptr(&obs1);
   EXPECT_EQ(1u, obs1.ActiveObservedPtrs());
   EXPECT_EQ(0u, obs2.ActiveObservedPtrs());
   ptr.Reset(&obs2);
@@ -145,17 +145,17 @@
 TEST(ObservePtr, Equals) {
   PseudoObservable obj1;
   PseudoObservable obj2;
-  PseudoObservable::ObservedPtr null_ptr1;
-  PseudoObservable::ObservedPtr obj1_ptr1(&obj1);
-  PseudoObservable::ObservedPtr obj2_ptr1(&obj2);
+  ObservedPtr<PseudoObservable> null_ptr1;
+  ObservedPtr<PseudoObservable> obj1_ptr1(&obj1);
+  ObservedPtr<PseudoObservable> obj2_ptr1(&obj2);
   {
-    PseudoObservable::ObservedPtr null_ptr2;
+    ObservedPtr<PseudoObservable> null_ptr2;
     EXPECT_TRUE(null_ptr1 == null_ptr2);
 
-    PseudoObservable::ObservedPtr obj1_ptr2(&obj1);
+    ObservedPtr<PseudoObservable> obj1_ptr2(&obj1);
     EXPECT_TRUE(obj1_ptr1 == obj1_ptr2);
 
-    PseudoObservable::ObservedPtr obj2_ptr2(&obj2);
+    ObservedPtr<PseudoObservable> obj2_ptr2(&obj2);
     EXPECT_TRUE(obj2_ptr1 == obj2_ptr2);
   }
   EXPECT_FALSE(null_ptr1 == obj1_ptr1);
@@ -166,13 +166,13 @@
 TEST(ObservePtr, NotEquals) {
   PseudoObservable obj1;
   PseudoObservable obj2;
-  PseudoObservable::ObservedPtr null_ptr1;
-  PseudoObservable::ObservedPtr obj1_ptr1(&obj1);
-  PseudoObservable::ObservedPtr obj2_ptr1(&obj2);
+  ObservedPtr<PseudoObservable> null_ptr1;
+  ObservedPtr<PseudoObservable> obj1_ptr1(&obj1);
+  ObservedPtr<PseudoObservable> obj2_ptr1(&obj2);
   {
-    PseudoObservable::ObservedPtr null_ptr2;
-    PseudoObservable::ObservedPtr obj1_ptr2(&obj1);
-    PseudoObservable::ObservedPtr obj2_ptr2(&obj2);
+    ObservedPtr<PseudoObservable> null_ptr2;
+    ObservedPtr<PseudoObservable> obj1_ptr2(&obj1);
+    ObservedPtr<PseudoObservable> obj2_ptr2(&obj2);
     EXPECT_FALSE(null_ptr1 != null_ptr2);
     EXPECT_FALSE(obj1_ptr1 != obj1_ptr2);
     EXPECT_FALSE(obj2_ptr1 != obj2_ptr2);
@@ -184,8 +184,8 @@
 
 TEST(ObservePtr, Bool) {
   PseudoObservable obj1;
-  PseudoObservable::ObservedPtr null_ptr;
-  PseudoObservable::ObservedPtr obj1_ptr(&obj1);
+  ObservedPtr<PseudoObservable> null_ptr;
+  ObservedPtr<PseudoObservable> obj1_ptr(&obj1);
   bool null_bool = !!null_ptr;
   bool obj1_bool = !!obj1_ptr;
   EXPECT_FALSE(null_bool);
diff --git a/core/fxcrt/retained_tree_node_unittest.cpp b/core/fxcrt/retained_tree_node_unittest.cpp
index 02ba61a..d469ab3 100644
--- a/core/fxcrt/retained_tree_node_unittest.cpp
+++ b/core/fxcrt/retained_tree_node_unittest.cpp
@@ -13,7 +13,7 @@
 
 class ObservableRetainedTreeNodeForTest
     : public RetainedTreeNode<ObservableRetainedTreeNodeForTest>,
-      public Observable<ObservableRetainedTreeNodeForTest> {
+      public Observable {
  public:
   template <typename T, typename... Args>
   friend RetainPtr<T> pdfium::MakeRetain(Args&&... args);
@@ -41,25 +41,25 @@
 }  // namespace
 
 TEST(RetainedTreeNode, NoParent) {
-  ObservableRetainedTreeNodeForTest::ObservedPtr watcher;
+  ObservedPtr<ObservableRetainedTreeNodeForTest> watcher;
   {
     RetainPtr<ObservableRetainedTreeNodeForTest> ptr =
         pdfium::MakeRetain<ObservableRetainedTreeNodeForTest>();
     EXPECT_FALSE(ptr->HasChild(ptr.Get()));
-    watcher = ObservableRetainedTreeNodeForTest::ObservedPtr(ptr.Get());
+    watcher = ObservedPtr<ObservableRetainedTreeNodeForTest>(ptr.Get());
     EXPECT_TRUE(watcher.Get());
   }
   EXPECT_FALSE(watcher.Get());
 }
 
 TEST(RetainedTreeNode, FirstHasParent) {
-  ObservableRetainedTreeNodeForTest::ObservedPtr watcher;
+  ObservedPtr<ObservableRetainedTreeNodeForTest> watcher;
   RetainPtr<ObservableRetainedTreeNodeForTest> parent =
       pdfium::MakeRetain<ObservableRetainedTreeNodeForTest>();
   {
     RetainPtr<ObservableRetainedTreeNodeForTest> ptr =
         pdfium::MakeRetain<ObservableRetainedTreeNodeForTest>();
-    watcher = ObservableRetainedTreeNodeForTest::ObservedPtr(ptr.Get());
+    watcher = ObservedPtr<ObservableRetainedTreeNodeForTest>(ptr.Get());
     parent->AppendFirstChild(ptr);
     EXPECT_FALSE(parent->HasChild(parent.Get()));
     EXPECT_TRUE(parent->HasChild(ptr.Get()));
@@ -72,7 +72,7 @@
   {
     RetainPtr<ObservableRetainedTreeNodeForTest> ptr =
         pdfium::MakeRetain<ObservableRetainedTreeNodeForTest>();
-    watcher = ObservableRetainedTreeNodeForTest::ObservedPtr(ptr.Get());
+    watcher = ObservedPtr<ObservableRetainedTreeNodeForTest>(ptr.Get());
     parent->AppendFirstChild(ptr);
     AddClutterToFront(parent);
     AddClutterToBack(parent);
@@ -84,13 +84,13 @@
 }
 
 TEST(RetainedTreeNode, LastHasParent) {
-  ObservableRetainedTreeNodeForTest::ObservedPtr watcher;
+  ObservedPtr<ObservableRetainedTreeNodeForTest> watcher;
   RetainPtr<ObservableRetainedTreeNodeForTest> parent =
       pdfium::MakeRetain<ObservableRetainedTreeNodeForTest>();
   {
     RetainPtr<ObservableRetainedTreeNodeForTest> ptr =
         pdfium::MakeRetain<ObservableRetainedTreeNodeForTest>();
-    watcher = ObservableRetainedTreeNodeForTest::ObservedPtr(ptr.Get());
+    watcher = ObservedPtr<ObservableRetainedTreeNodeForTest>(ptr.Get());
     parent->AppendLastChild(ptr);
     EXPECT_FALSE(parent->HasChild(parent.Get()));
     EXPECT_TRUE(parent->HasChild(ptr.Get()));
@@ -100,7 +100,7 @@
     // Now add some clutter.
     RetainPtr<ObservableRetainedTreeNodeForTest> ptr =
         pdfium::MakeRetain<ObservableRetainedTreeNodeForTest>();
-    watcher = ObservableRetainedTreeNodeForTest::ObservedPtr(ptr.Get());
+    watcher = ObservedPtr<ObservableRetainedTreeNodeForTest>(ptr.Get());
     parent->AppendLastChild(ptr);
     AddClutterToFront(parent);
     AddClutterToBack(parent);
@@ -112,7 +112,7 @@
 }
 
 TEST(RetainedTreeNode, GrandChildCleanedUp) {
-  ObservableRetainedTreeNodeForTest::ObservedPtr watcher;
+  ObservedPtr<ObservableRetainedTreeNodeForTest> watcher;
   RetainPtr<ObservableRetainedTreeNodeForTest> grandparent =
       pdfium::MakeRetain<ObservableRetainedTreeNodeForTest>();
   {
@@ -122,7 +122,7 @@
     {
       RetainPtr<ObservableRetainedTreeNodeForTest> ptr =
           pdfium::MakeRetain<ObservableRetainedTreeNodeForTest>();
-      watcher = ObservableRetainedTreeNodeForTest::ObservedPtr(ptr.Get());
+      watcher = ObservedPtr<ObservableRetainedTreeNodeForTest>(ptr.Get());
       parent->AppendFirstChild(ptr);
       EXPECT_TRUE(watcher.Get());
     }
@@ -133,11 +133,11 @@
 }
 
 TEST(RetainedTreeNode, RemoveSelf) {
-  ObservableRetainedTreeNodeForTest::ObservedPtr watcher;
+  ObservedPtr<ObservableRetainedTreeNodeForTest> watcher;
   auto parent = pdfium::MakeRetain<ObservableRetainedTreeNodeForTest>();
   {
     auto child = pdfium::MakeRetain<ObservableRetainedTreeNodeForTest>();
-    watcher = ObservableRetainedTreeNodeForTest::ObservedPtr(child.Get());
+    watcher = ObservedPtr<ObservableRetainedTreeNodeForTest>(child.Get());
     parent->AppendFirstChild(child);
   }
   EXPECT_TRUE(watcher.Get());
@@ -146,7 +146,7 @@
 }
 
 TEST(RetainedTreeNode, InsertBeforeAfter) {
-  ObservableRetainedTreeNodeForTest::ObservedPtr watcher;
+  ObservedPtr<ObservableRetainedTreeNodeForTest> watcher;
   RetainPtr<ObservableRetainedTreeNodeForTest> parent =
       pdfium::MakeRetain<ObservableRetainedTreeNodeForTest>();
 
@@ -154,7 +154,7 @@
   {
     RetainPtr<ObservableRetainedTreeNodeForTest> ptr =
         pdfium::MakeRetain<ObservableRetainedTreeNodeForTest>();
-    watcher = ObservableRetainedTreeNodeForTest::ObservedPtr(ptr.Get());
+    watcher = ObservedPtr<ObservableRetainedTreeNodeForTest>(ptr.Get());
     parent->AppendFirstChild(ptr);
     parent->InsertBefore(pdfium::WrapRetain(parent->GetFirstChild()),
                          parent->GetLastChild());
diff --git a/core/fxge/cfx_face.h b/core/fxge/cfx_face.h
index 11925f3..fd7abdf 100644
--- a/core/fxge/cfx_face.h
+++ b/core/fxge/cfx_face.h
@@ -10,7 +10,7 @@
 #include "core/fxge/fx_freetype.h"
 #include "third_party/base/span.h"
 
-class CFX_Face : public Retainable, public Observable<CFX_Face> {
+class CFX_Face : public Retainable, public Observable {
  public:
   static RetainPtr<CFX_Face> New(FT_Library library,
                                  pdfium::span<const FT_Byte> file_span,
diff --git a/core/fxge/cfx_fontcache.h b/core/fxge/cfx_fontcache.h
index 7036852..515811b 100644
--- a/core/fxge/cfx_fontcache.h
+++ b/core/fxge/cfx_fontcache.h
@@ -27,8 +27,8 @@
 #endif
 
  private:
-  std::map<CFX_Face*, CFX_GlyphCache::ObservedPtr> m_GlyphCacheMap;
-  std::map<CFX_Face*, CFX_GlyphCache::ObservedPtr> m_ExtGlyphCacheMap;
+  std::map<CFX_Face*, ObservedPtr<CFX_GlyphCache>> m_GlyphCacheMap;
+  std::map<CFX_Face*, ObservedPtr<CFX_GlyphCache>> m_ExtGlyphCacheMap;
 };
 
 #endif  // CORE_FXGE_CFX_FONTCACHE_H_
diff --git a/core/fxge/cfx_glyphcache.h b/core/fxge/cfx_glyphcache.h
index 165359c..5a24424 100644
--- a/core/fxge/cfx_glyphcache.h
+++ b/core/fxge/cfx_glyphcache.h
@@ -26,7 +26,7 @@
 class CFX_Matrix;
 class CFX_PathData;
 
-class CFX_GlyphCache : public Retainable, public Observable<CFX_GlyphCache> {
+class CFX_GlyphCache : public Retainable, public Observable {
  public:
   template <typename T, typename... Args>
   friend RetainPtr<T> pdfium::MakeRetain(Args&&... args);
diff --git a/core/fxge/cttfontdesc.h b/core/fxge/cttfontdesc.h
index e79d89a..c6b79f3 100644
--- a/core/fxge/cttfontdesc.h
+++ b/core/fxge/cttfontdesc.h
@@ -24,7 +24,7 @@
 
  private:
   std::unique_ptr<uint8_t, FxFreeDeleter> const m_pFontData;
-  CFX_Face::ObservedPtr m_TTCFaces[16];
+  ObservedPtr<CFX_Face> m_TTCFaces[16];
 };
 
 #endif  // CORE_FXGE_CTTFONTDESC_H_
diff --git a/fpdfsdk/cpdfsdk_annot.h b/fpdfsdk/cpdfsdk_annot.h
index 2a4b713..3247248 100644
--- a/fpdfsdk/cpdfsdk_annot.h
+++ b/fpdfsdk/cpdfsdk_annot.h
@@ -27,7 +27,7 @@
 class CXFA_FFWidget;
 #endif  // PDF_ENABLE_XFA
 
-class CPDFSDK_Annot : public Observable<CPDFSDK_Annot> {
+class CPDFSDK_Annot : public Observable {
  public:
   explicit CPDFSDK_Annot(CPDFSDK_PageView* pPageView);
   virtual ~CPDFSDK_Annot();
diff --git a/fpdfsdk/cpdfsdk_annothandlermgr.cpp b/fpdfsdk/cpdfsdk_annothandlermgr.cpp
index b40014d..a16aeba 100644
--- a/fpdfsdk/cpdfsdk_annothandlermgr.cpp
+++ b/fpdfsdk/cpdfsdk_annothandlermgr.cpp
@@ -131,7 +131,7 @@
 
 bool CPDFSDK_AnnotHandlerMgr::Annot_OnLButtonDown(
     CPDFSDK_PageView* pPageView,
-    CPDFSDK_Annot::ObservedPtr* pAnnot,
+    ObservedPtr<CPDFSDK_Annot>* pAnnot,
     uint32_t nFlags,
     const CFX_PointF& point) {
   ASSERT(pAnnot->HasObservable());
@@ -141,7 +141,7 @@
 
 bool CPDFSDK_AnnotHandlerMgr::Annot_OnLButtonUp(
     CPDFSDK_PageView* pPageView,
-    CPDFSDK_Annot::ObservedPtr* pAnnot,
+    ObservedPtr<CPDFSDK_Annot>* pAnnot,
     uint32_t nFlags,
     const CFX_PointF& point) {
   ASSERT(pAnnot->HasObservable());
@@ -151,7 +151,7 @@
 
 bool CPDFSDK_AnnotHandlerMgr::Annot_OnLButtonDblClk(
     CPDFSDK_PageView* pPageView,
-    CPDFSDK_Annot::ObservedPtr* pAnnot,
+    ObservedPtr<CPDFSDK_Annot>* pAnnot,
     uint32_t nFlags,
     const CFX_PointF& point) {
   ASSERT(pAnnot->HasObservable());
@@ -161,7 +161,7 @@
 
 bool CPDFSDK_AnnotHandlerMgr::Annot_OnMouseMove(
     CPDFSDK_PageView* pPageView,
-    CPDFSDK_Annot::ObservedPtr* pAnnot,
+    ObservedPtr<CPDFSDK_Annot>* pAnnot,
     uint32_t nFlags,
     const CFX_PointF& point) {
   ASSERT(pAnnot->HasObservable());
@@ -171,7 +171,7 @@
 
 bool CPDFSDK_AnnotHandlerMgr::Annot_OnMouseWheel(
     CPDFSDK_PageView* pPageView,
-    CPDFSDK_Annot::ObservedPtr* pAnnot,
+    ObservedPtr<CPDFSDK_Annot>* pAnnot,
     uint32_t nFlags,
     short zDelta,
     const CFX_PointF& point) {
@@ -182,7 +182,7 @@
 
 bool CPDFSDK_AnnotHandlerMgr::Annot_OnRButtonDown(
     CPDFSDK_PageView* pPageView,
-    CPDFSDK_Annot::ObservedPtr* pAnnot,
+    ObservedPtr<CPDFSDK_Annot>* pAnnot,
     uint32_t nFlags,
     const CFX_PointF& point) {
   ASSERT(pAnnot->HasObservable());
@@ -192,7 +192,7 @@
 
 bool CPDFSDK_AnnotHandlerMgr::Annot_OnRButtonUp(
     CPDFSDK_PageView* pPageView,
-    CPDFSDK_Annot::ObservedPtr* pAnnot,
+    ObservedPtr<CPDFSDK_Annot>* pAnnot,
     uint32_t nFlags,
     const CFX_PointF& point) {
   ASSERT(pAnnot->HasObservable());
@@ -202,7 +202,7 @@
 
 void CPDFSDK_AnnotHandlerMgr::Annot_OnMouseEnter(
     CPDFSDK_PageView* pPageView,
-    CPDFSDK_Annot::ObservedPtr* pAnnot,
+    ObservedPtr<CPDFSDK_Annot>* pAnnot,
     uint32_t nFlag) {
   ASSERT(pAnnot->HasObservable());
   GetAnnotHandler(pAnnot->Get())->OnMouseEnter(pPageView, pAnnot, nFlag);
@@ -210,7 +210,7 @@
 
 void CPDFSDK_AnnotHandlerMgr::Annot_OnMouseExit(
     CPDFSDK_PageView* pPageView,
-    CPDFSDK_Annot::ObservedPtr* pAnnot,
+    ObservedPtr<CPDFSDK_Annot>* pAnnot,
     uint32_t nFlag) {
   ASSERT(pAnnot->HasObservable());
   GetAnnotHandler(pAnnot->Get())->OnMouseExit(pPageView, pAnnot, nFlag);
@@ -233,7 +233,7 @@
   CPDFSDK_PageView* pPage = pAnnot->GetPageView();
   CPDFSDK_Annot* pFocusAnnot = pPage->GetFocusAnnot();
   if (pFocusAnnot && (nKeyCode == FWL_VKEY_Tab)) {
-    CPDFSDK_Annot::ObservedPtr pNext(GetNextAnnot(
+    ObservedPtr<CPDFSDK_Annot> pNext(GetNextAnnot(
         pFocusAnnot, !CPDFSDK_FormFillEnvironment::IsSHIFTKeyDown(nFlag)));
     if (pNext && pNext.Get() != pFocusAnnot) {
       pPage->GetFormFillEnv()->SetFocusAnnot(&pNext);
@@ -245,21 +245,21 @@
 }
 
 bool CPDFSDK_AnnotHandlerMgr::Annot_OnSetFocus(
-    CPDFSDK_Annot::ObservedPtr* pAnnot,
+    ObservedPtr<CPDFSDK_Annot>* pAnnot,
     uint32_t nFlag) {
   ASSERT(pAnnot->HasObservable());
   return GetAnnotHandler(pAnnot->Get())->OnSetFocus(pAnnot, nFlag);
 }
 
 bool CPDFSDK_AnnotHandlerMgr::Annot_OnKillFocus(
-    CPDFSDK_Annot::ObservedPtr* pAnnot,
+    ObservedPtr<CPDFSDK_Annot>* pAnnot,
     uint32_t nFlag) {
   ASSERT(pAnnot->HasObservable());
   return GetAnnotHandler(pAnnot->Get())->OnKillFocus(pAnnot, nFlag);
 }
 
 bool CPDFSDK_AnnotHandlerMgr::Annot_SetIndexSelected(
-    CPDFSDK_Annot::ObservedPtr* pAnnot,
+    ObservedPtr<CPDFSDK_Annot>* pAnnot,
     int index,
     bool selected) {
   return GetAnnotHandler(pAnnot->Get())
@@ -267,15 +267,15 @@
 }
 
 bool CPDFSDK_AnnotHandlerMgr::Annot_IsIndexSelected(
-    CPDFSDK_Annot::ObservedPtr* pAnnot,
+    ObservedPtr<CPDFSDK_Annot>* pAnnot,
     int index) {
   return GetAnnotHandler(pAnnot->Get())->IsIndexSelected(pAnnot, index);
 }
 
 #ifdef PDF_ENABLE_XFA
 bool CPDFSDK_AnnotHandlerMgr::Annot_OnChangeFocus(
-    CPDFSDK_Annot::ObservedPtr* pSetAnnot,
-    CPDFSDK_Annot::ObservedPtr* pKillAnnot) {
+    ObservedPtr<CPDFSDK_Annot>* pSetAnnot,
+    ObservedPtr<CPDFSDK_Annot>* pKillAnnot) {
   bool bXFA = (*pSetAnnot && (*pSetAnnot)->GetXFAWidget()) ||
               (*pKillAnnot && (*pKillAnnot)->GetXFAWidget());
 
diff --git a/fpdfsdk/cpdfsdk_annothandlermgr.h b/fpdfsdk/cpdfsdk_annothandlermgr.h
index 7a79577..86dc9f8 100644
--- a/fpdfsdk/cpdfsdk_annothandlermgr.h
+++ b/fpdfsdk/cpdfsdk_annothandlermgr.h
@@ -56,52 +56,52 @@
                     bool bDrawAnnots);
 
   void Annot_OnMouseEnter(CPDFSDK_PageView* pPageView,
-                          CPDFSDK_Annot::ObservedPtr* pAnnot,
+                          ObservedPtr<CPDFSDK_Annot>* pAnnot,
                           uint32_t nFlags);
   void Annot_OnMouseExit(CPDFSDK_PageView* pPageView,
-                         CPDFSDK_Annot::ObservedPtr* pAnnot,
+                         ObservedPtr<CPDFSDK_Annot>* pAnnot,
                          uint32_t nFlags);
   bool Annot_OnLButtonDown(CPDFSDK_PageView* pPageView,
-                           CPDFSDK_Annot::ObservedPtr* pAnnot,
+                           ObservedPtr<CPDFSDK_Annot>* pAnnot,
                            uint32_t nFlags,
                            const CFX_PointF& point);
   bool Annot_OnLButtonUp(CPDFSDK_PageView* pPageView,
-                         CPDFSDK_Annot::ObservedPtr* pAnnot,
+                         ObservedPtr<CPDFSDK_Annot>* pAnnot,
                          uint32_t nFlags,
                          const CFX_PointF& point);
   bool Annot_OnLButtonDblClk(CPDFSDK_PageView* pPageView,
-                             CPDFSDK_Annot::ObservedPtr* pAnnot,
+                             ObservedPtr<CPDFSDK_Annot>* pAnnot,
                              uint32_t nFlags,
                              const CFX_PointF& point);
   bool Annot_OnMouseMove(CPDFSDK_PageView* pPageView,
-                         CPDFSDK_Annot::ObservedPtr* pAnnot,
+                         ObservedPtr<CPDFSDK_Annot>* pAnnot,
                          uint32_t nFlags,
                          const CFX_PointF& point);
   bool Annot_OnMouseWheel(CPDFSDK_PageView* pPageView,
-                          CPDFSDK_Annot::ObservedPtr* pAnnot,
+                          ObservedPtr<CPDFSDK_Annot>* pAnnot,
                           uint32_t nFlags,
                           short zDelta,
                           const CFX_PointF& point);
   bool Annot_OnRButtonDown(CPDFSDK_PageView* pPageView,
-                           CPDFSDK_Annot::ObservedPtr* pAnnot,
+                           ObservedPtr<CPDFSDK_Annot>* pAnnot,
                            uint32_t nFlags,
                            const CFX_PointF& point);
   bool Annot_OnRButtonUp(CPDFSDK_PageView* pPageView,
-                         CPDFSDK_Annot::ObservedPtr* pAnnot,
+                         ObservedPtr<CPDFSDK_Annot>* pAnnot,
                          uint32_t nFlags,
                          const CFX_PointF& point);
   bool Annot_OnChar(CPDFSDK_Annot* pAnnot, uint32_t nChar, uint32_t nFlags);
   bool Annot_OnKeyDown(CPDFSDK_Annot* pAnnot, int nKeyCode, int nFlag);
-  bool Annot_OnSetFocus(CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlag);
-  bool Annot_OnKillFocus(CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlag);
-  bool Annot_SetIndexSelected(CPDFSDK_Annot::ObservedPtr* pAnnot,
+  bool Annot_OnSetFocus(ObservedPtr<CPDFSDK_Annot>* pAnnot, uint32_t nFlag);
+  bool Annot_OnKillFocus(ObservedPtr<CPDFSDK_Annot>* pAnnot, uint32_t nFlag);
+  bool Annot_SetIndexSelected(ObservedPtr<CPDFSDK_Annot>* pAnnot,
                               int index,
                               bool selected);
-  bool Annot_IsIndexSelected(CPDFSDK_Annot::ObservedPtr* pAnnot, int index);
+  bool Annot_IsIndexSelected(ObservedPtr<CPDFSDK_Annot>* pAnnot, int index);
 
 #ifdef PDF_ENABLE_XFA
-  bool Annot_OnChangeFocus(CPDFSDK_Annot::ObservedPtr* pSetAnnot,
-                           CPDFSDK_Annot::ObservedPtr* pKillAnnot);
+  bool Annot_OnChangeFocus(ObservedPtr<CPDFSDK_Annot>* pSetAnnot,
+                           ObservedPtr<CPDFSDK_Annot>* pKillAnnot);
 #endif  // PDF_ENABLE_XFA
 
   CFX_FloatRect Annot_OnGetViewBBox(CPDFSDK_PageView* pPageView,
diff --git a/fpdfsdk/cpdfsdk_annotiteration.h b/fpdfsdk/cpdfsdk_annotiteration.h
index 70edfd1..d3a0f39 100644
--- a/fpdfsdk/cpdfsdk_annotiteration.h
+++ b/fpdfsdk/cpdfsdk_annotiteration.h
@@ -16,7 +16,7 @@
 class CPDFSDK_AnnotIteration {
  public:
   using const_iterator =
-      std::vector<CPDFSDK_Annot::ObservedPtr>::const_iterator;
+      std::vector<ObservedPtr<CPDFSDK_Annot>>::const_iterator;
 
   CPDFSDK_AnnotIteration(CPDFSDK_PageView* pPageView, bool bReverse);
   ~CPDFSDK_AnnotIteration();
@@ -25,7 +25,7 @@
   const_iterator end() const { return m_List.end(); }
 
  private:
-  std::vector<CPDFSDK_Annot::ObservedPtr> m_List;
+  std::vector<ObservedPtr<CPDFSDK_Annot>> m_List;
 };
 
 #endif  // FPDFSDK_CPDFSDK_ANNOTITERATION_H_
diff --git a/fpdfsdk/cpdfsdk_baannothandler.cpp b/fpdfsdk/cpdfsdk_baannothandler.cpp
index 8c0135f..03856ec 100644
--- a/fpdfsdk/cpdfsdk_baannothandler.cpp
+++ b/fpdfsdk/cpdfsdk_baannothandler.cpp
@@ -79,7 +79,7 @@
 }
 
 void CPDFSDK_BAAnnotHandler::OnMouseEnter(CPDFSDK_PageView* pPageView,
-                                          CPDFSDK_Annot::ObservedPtr* pAnnot,
+                                          ObservedPtr<CPDFSDK_Annot>* pAnnot,
                                           uint32_t nFlag) {
   CPDFSDK_BAAnnot* pBAAnnot = (*pAnnot)->AsBAAnnot();
   pBAAnnot->SetOpenState(true);
@@ -87,7 +87,7 @@
 }
 
 void CPDFSDK_BAAnnotHandler::OnMouseExit(CPDFSDK_PageView* pPageView,
-                                         CPDFSDK_Annot::ObservedPtr* pAnnot,
+                                         ObservedPtr<CPDFSDK_Annot>* pAnnot,
                                          uint32_t nFlag) {
   CPDFSDK_BAAnnot* pBAAnnot = (*pAnnot)->AsBAAnnot();
   pBAAnnot->SetOpenState(false);
@@ -95,35 +95,35 @@
 }
 
 bool CPDFSDK_BAAnnotHandler::OnLButtonDown(CPDFSDK_PageView* pPageView,
-                                           CPDFSDK_Annot::ObservedPtr* pAnnot,
+                                           ObservedPtr<CPDFSDK_Annot>* pAnnot,
                                            uint32_t nFlags,
                                            const CFX_PointF& point) {
   return false;
 }
 
 bool CPDFSDK_BAAnnotHandler::OnLButtonUp(CPDFSDK_PageView* pPageView,
-                                         CPDFSDK_Annot::ObservedPtr* pAnnot,
+                                         ObservedPtr<CPDFSDK_Annot>* pAnnot,
                                          uint32_t nFlags,
                                          const CFX_PointF& point) {
   return false;
 }
 
 bool CPDFSDK_BAAnnotHandler::OnLButtonDblClk(CPDFSDK_PageView* pPageView,
-                                             CPDFSDK_Annot::ObservedPtr* pAnnot,
+                                             ObservedPtr<CPDFSDK_Annot>* pAnnot,
                                              uint32_t nFlags,
                                              const CFX_PointF& point) {
   return false;
 }
 
 bool CPDFSDK_BAAnnotHandler::OnMouseMove(CPDFSDK_PageView* pPageView,
-                                         CPDFSDK_Annot::ObservedPtr* pAnnot,
+                                         ObservedPtr<CPDFSDK_Annot>* pAnnot,
                                          uint32_t nFlags,
                                          const CFX_PointF& point) {
   return false;
 }
 
 bool CPDFSDK_BAAnnotHandler::OnMouseWheel(CPDFSDK_PageView* pPageView,
-                                          CPDFSDK_Annot::ObservedPtr* pAnnot,
+                                          ObservedPtr<CPDFSDK_Annot>* pAnnot,
                                           uint32_t nFlags,
                                           short zDelta,
                                           const CFX_PointF& point) {
@@ -131,21 +131,21 @@
 }
 
 bool CPDFSDK_BAAnnotHandler::OnRButtonDown(CPDFSDK_PageView* pPageView,
-                                           CPDFSDK_Annot::ObservedPtr* pAnnot,
+                                           ObservedPtr<CPDFSDK_Annot>* pAnnot,
                                            uint32_t nFlags,
                                            const CFX_PointF& point) {
   return false;
 }
 
 bool CPDFSDK_BAAnnotHandler::OnRButtonUp(CPDFSDK_PageView* pPageView,
-                                         CPDFSDK_Annot::ObservedPtr* pAnnot,
+                                         ObservedPtr<CPDFSDK_Annot>* pAnnot,
                                          uint32_t nFlags,
                                          const CFX_PointF& point) {
   return false;
 }
 
 bool CPDFSDK_BAAnnotHandler::OnRButtonDblClk(CPDFSDK_PageView* pPageView,
-                                             CPDFSDK_Annot::ObservedPtr* pAnnot,
+                                             ObservedPtr<CPDFSDK_Annot>* pAnnot,
                                              uint32_t nFlags,
                                              const CFX_PointF& point) {
   return false;
@@ -171,32 +171,32 @@
 
 void CPDFSDK_BAAnnotHandler::OnLoad(CPDFSDK_Annot* pAnnot) {}
 
-bool CPDFSDK_BAAnnotHandler::OnSetFocus(CPDFSDK_Annot::ObservedPtr* pAnnot,
+bool CPDFSDK_BAAnnotHandler::OnSetFocus(ObservedPtr<CPDFSDK_Annot>* pAnnot,
                                         uint32_t nFlag) {
   return false;
 }
 
-bool CPDFSDK_BAAnnotHandler::OnKillFocus(CPDFSDK_Annot::ObservedPtr* pAnnot,
+bool CPDFSDK_BAAnnotHandler::OnKillFocus(ObservedPtr<CPDFSDK_Annot>* pAnnot,
                                          uint32_t nFlag) {
   return false;
 }
 
 bool CPDFSDK_BAAnnotHandler::SetIndexSelected(
-    CPDFSDK_Annot::ObservedPtr* pAnnot,
+    ObservedPtr<CPDFSDK_Annot>* pAnnot,
     int index,
     bool selected) {
   return false;
 }
 
-bool CPDFSDK_BAAnnotHandler::IsIndexSelected(CPDFSDK_Annot::ObservedPtr* pAnnot,
+bool CPDFSDK_BAAnnotHandler::IsIndexSelected(ObservedPtr<CPDFSDK_Annot>* pAnnot,
                                              int index) {
   return false;
 }
 
 #ifdef PDF_ENABLE_XFA
 bool CPDFSDK_BAAnnotHandler::OnXFAChangedFocus(
-    CPDFSDK_Annot::ObservedPtr* pOldAnnot,
-    CPDFSDK_Annot::ObservedPtr* pNewAnnot) {
+    ObservedPtr<CPDFSDK_Annot>* pOldAnnot,
+    ObservedPtr<CPDFSDK_Annot>* pNewAnnot) {
   return true;
 }
 #endif  // PDF_ENABLE_XFA
diff --git a/fpdfsdk/cpdfsdk_baannothandler.h b/fpdfsdk/cpdfsdk_baannothandler.h
index 1c5cb49..b8a2826 100644
--- a/fpdfsdk/cpdfsdk_baannothandler.h
+++ b/fpdfsdk/cpdfsdk_baannothandler.h
@@ -56,56 +56,56 @@
   void OnLoad(CPDFSDK_Annot* pAnnot) override;
 
   void OnMouseEnter(CPDFSDK_PageView* pPageView,
-                    CPDFSDK_Annot::ObservedPtr* pAnnot,
+                    ObservedPtr<CPDFSDK_Annot>* pAnnot,
                     uint32_t nFlag) override;
   void OnMouseExit(CPDFSDK_PageView* pPageView,
-                   CPDFSDK_Annot::ObservedPtr* pAnnot,
+                   ObservedPtr<CPDFSDK_Annot>* pAnnot,
                    uint32_t nFlag) override;
   bool OnLButtonDown(CPDFSDK_PageView* pPageView,
-                     CPDFSDK_Annot::ObservedPtr* pAnnot,
+                     ObservedPtr<CPDFSDK_Annot>* pAnnot,
                      uint32_t nFlags,
                      const CFX_PointF& point) override;
   bool OnLButtonUp(CPDFSDK_PageView* pPageView,
-                   CPDFSDK_Annot::ObservedPtr* pAnnot,
+                   ObservedPtr<CPDFSDK_Annot>* pAnnot,
                    uint32_t nFlags,
                    const CFX_PointF& point) override;
   bool OnLButtonDblClk(CPDFSDK_PageView* pPageView,
-                       CPDFSDK_Annot::ObservedPtr* pAnnot,
+                       ObservedPtr<CPDFSDK_Annot>* pAnnot,
                        uint32_t nFlags,
                        const CFX_PointF& point) override;
   bool OnMouseMove(CPDFSDK_PageView* pPageView,
-                   CPDFSDK_Annot::ObservedPtr* pAnnot,
+                   ObservedPtr<CPDFSDK_Annot>* pAnnot,
                    uint32_t nFlags,
                    const CFX_PointF& point) override;
   bool OnMouseWheel(CPDFSDK_PageView* pPageView,
-                    CPDFSDK_Annot::ObservedPtr* pAnnot,
+                    ObservedPtr<CPDFSDK_Annot>* pAnnot,
                     uint32_t nFlags,
                     short zDelta,
                     const CFX_PointF& point) override;
   bool OnRButtonDown(CPDFSDK_PageView* pPageView,
-                     CPDFSDK_Annot::ObservedPtr* pAnnot,
+                     ObservedPtr<CPDFSDK_Annot>* pAnnot,
                      uint32_t nFlags,
                      const CFX_PointF& point) override;
   bool OnRButtonUp(CPDFSDK_PageView* pPageView,
-                   CPDFSDK_Annot::ObservedPtr* pAnnot,
+                   ObservedPtr<CPDFSDK_Annot>* pAnnot,
                    uint32_t nFlags,
                    const CFX_PointF& point) override;
   bool OnRButtonDblClk(CPDFSDK_PageView* pPageView,
-                       CPDFSDK_Annot::ObservedPtr* pAnnot,
+                       ObservedPtr<CPDFSDK_Annot>* pAnnot,
                        uint32_t nFlags,
                        const CFX_PointF& point) override;
   bool OnChar(CPDFSDK_Annot* pAnnot, uint32_t nChar, uint32_t nFlags) override;
   bool OnKeyDown(CPDFSDK_Annot* pAnnot, int nKeyCode, int nFlag) override;
   bool OnKeyUp(CPDFSDK_Annot* pAnnot, int nKeyCode, int nFlag) override;
-  bool OnSetFocus(CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlag) override;
-  bool OnKillFocus(CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlag) override;
-  bool SetIndexSelected(CPDFSDK_Annot::ObservedPtr* pAnnot,
+  bool OnSetFocus(ObservedPtr<CPDFSDK_Annot>* pAnnot, uint32_t nFlag) override;
+  bool OnKillFocus(ObservedPtr<CPDFSDK_Annot>* pAnnot, uint32_t nFlag) override;
+  bool SetIndexSelected(ObservedPtr<CPDFSDK_Annot>* pAnnot,
                         int index,
                         bool selected) override;
-  bool IsIndexSelected(CPDFSDK_Annot::ObservedPtr* pAnnot, int index) override;
+  bool IsIndexSelected(ObservedPtr<CPDFSDK_Annot>* pAnnot, int index) override;
 #ifdef PDF_ENABLE_XFA
-  bool OnXFAChangedFocus(CPDFSDK_Annot::ObservedPtr* pOldAnnot,
-                         CPDFSDK_Annot::ObservedPtr* pNewAnnot) override;
+  bool OnXFAChangedFocus(ObservedPtr<CPDFSDK_Annot>* pOldAnnot,
+                         ObservedPtr<CPDFSDK_Annot>* pNewAnnot) override;
 #endif  // PDF_ENABLE_XFA
 };
 
diff --git a/fpdfsdk/cpdfsdk_formfillenvironment.cpp b/fpdfsdk/cpdfsdk_formfillenvironment.cpp
index 0cb8f64..e6221ac 100644
--- a/fpdfsdk/cpdfsdk_formfillenvironment.cpp
+++ b/fpdfsdk/cpdfsdk_formfillenvironment.cpp
@@ -647,7 +647,7 @@
 }
 
 bool CPDFSDK_FormFillEnvironment::SetFocusAnnot(
-    CPDFSDK_Annot::ObservedPtr* pAnnot) {
+    ObservedPtr<CPDFSDK_Annot>* pAnnot) {
   if (m_bBeingDestroyed)
     return false;
   if (m_pFocusAnnot == *pAnnot)
@@ -666,7 +666,7 @@
     return false;
 
 #ifdef PDF_ENABLE_XFA
-  CPDFSDK_Annot::ObservedPtr pLastFocusAnnot(m_pFocusAnnot.Get());
+  ObservedPtr<CPDFSDK_Annot> pLastFocusAnnot(m_pFocusAnnot.Get());
   if (!pAnnotHandler->Annot_OnChangeFocus(pAnnot, &pLastFocusAnnot))
     return false;
 #endif  // PDF_ENABLE_XFA
@@ -684,11 +684,11 @@
     return false;
 
   CPDFSDK_AnnotHandlerMgr* pAnnotHandler = GetAnnotHandlerMgr();
-  CPDFSDK_Annot::ObservedPtr pFocusAnnot(m_pFocusAnnot.Get());
+  ObservedPtr<CPDFSDK_Annot> pFocusAnnot(m_pFocusAnnot.Get());
   m_pFocusAnnot.Reset();
 
 #ifdef PDF_ENABLE_XFA
-  CPDFSDK_Annot::ObservedPtr pNull;
+  ObservedPtr<CPDFSDK_Annot> pNull;
   if (!pAnnotHandler->Annot_OnChangeFocus(&pNull, &pFocusAnnot))
     return false;
 #endif  // PDF_ENABLE_XFA
diff --git a/fpdfsdk/cpdfsdk_formfillenvironment.h b/fpdfsdk/cpdfsdk_formfillenvironment.h
index a82e3a4..9e85668 100644
--- a/fpdfsdk/cpdfsdk_formfillenvironment.h
+++ b/fpdfsdk/cpdfsdk_formfillenvironment.h
@@ -45,8 +45,7 @@
 // hierarcy back to the form fill environment itself, so as to flag any
 // lingering lifetime issues via the memory tools.
 
-class CPDFSDK_FormFillEnvironment final
-    : public Observable<CPDFSDK_FormFillEnvironment> {
+class CPDFSDK_FormFillEnvironment final : public Observable {
  public:
   CPDFSDK_FormFillEnvironment(CPDF_Document* pDoc, FPDF_FORMFILLINFO* pFFinfo);
   ~CPDFSDK_FormFillEnvironment();
@@ -64,7 +63,7 @@
   void UpdateAllViews(CPDFSDK_PageView* pSender, CPDFSDK_Annot* pAnnot);
 
   CPDFSDK_Annot* GetFocusAnnot() const { return m_pFocusAnnot.Get(); }
-  bool SetFocusAnnot(CPDFSDK_Annot::ObservedPtr* pAnnot);
+  bool SetFocusAnnot(ObservedPtr<CPDFSDK_Annot>* pAnnot);
   bool KillFocusAnnot(uint32_t nFlag);
   void ClearAllFocusedAnnots();
 
@@ -221,7 +220,7 @@
   std::unique_ptr<IJS_Runtime> m_pIJSRuntime;
   std::map<IPDF_Page*, std::unique_ptr<CPDFSDK_PageView>> m_PageMap;
   std::unique_ptr<CPDFSDK_InteractiveForm> m_pInteractiveForm;
-  CPDFSDK_Annot::ObservedPtr m_pFocusAnnot;
+  ObservedPtr<CPDFSDK_Annot> m_pFocusAnnot;
   UnownedPtr<CPDF_Document> const m_pCPDFDoc;
   std::unique_ptr<CFFL_InteractiveFormFiller> m_pFormFiller;
   std::unique_ptr<CFX_SystemHandler> m_pSysHandler;
diff --git a/fpdfsdk/cpdfsdk_interactiveform.cpp b/fpdfsdk/cpdfsdk_interactiveform.cpp
index 30a7528..2fee643 100644
--- a/fpdfsdk/cpdfsdk_interactiveform.cpp
+++ b/fpdfsdk/cpdfsdk_interactiveform.cpp
@@ -169,7 +169,7 @@
 
 void CPDFSDK_InteractiveForm::GetWidgets(
     const WideString& sFieldName,
-    std::vector<CPDFSDK_Annot::ObservedPtr>* widgets) const {
+    std::vector<ObservedPtr<CPDFSDK_Annot>>* widgets) const {
   for (int i = 0, sz = m_pInteractiveForm->CountFields(sFieldName); i < sz;
        ++i) {
     CPDF_FormField* pFormField = m_pInteractiveForm->GetField(i, sFieldName);
@@ -180,7 +180,7 @@
 
 void CPDFSDK_InteractiveForm::GetWidgets(
     CPDF_FormField* pField,
-    std::vector<CPDFSDK_Annot::ObservedPtr>* widgets) const {
+    std::vector<ObservedPtr<CPDFSDK_Annot>>* widgets) const {
   for (int i = 0, sz = pField->CountControls(); i < sz; ++i) {
     CPDF_FormControl* pFormCtrl = pField->GetControl(i);
     ASSERT(pFormCtrl);
diff --git a/fpdfsdk/cpdfsdk_interactiveform.h b/fpdfsdk/cpdfsdk_interactiveform.h
index 4bffe18..151c57d 100644
--- a/fpdfsdk/cpdfsdk_interactiveform.h
+++ b/fpdfsdk/cpdfsdk_interactiveform.h
@@ -44,9 +44,9 @@
 
   CPDFSDK_Widget* GetWidget(CPDF_FormControl* pControl) const;
   void GetWidgets(const WideString& sFieldName,
-                  std::vector<CPDFSDK_Annot::ObservedPtr>* widgets) const;
+                  std::vector<ObservedPtr<CPDFSDK_Annot>>* widgets) const;
   void GetWidgets(CPDF_FormField* pField,
-                  std::vector<CPDFSDK_Annot::ObservedPtr>* widgets) const;
+                  std::vector<ObservedPtr<CPDFSDK_Annot>>* widgets) const;
 
   void AddMap(CPDF_FormControl* pControl, CPDFSDK_Widget* pWidget);
   void RemoveMap(CPDF_FormControl* pControl);
diff --git a/fpdfsdk/cpdfsdk_pageview.cpp b/fpdfsdk/cpdfsdk_pageview.cpp
index 7d31e7c..f272df6 100644
--- a/fpdfsdk/cpdfsdk_pageview.cpp
+++ b/fpdfsdk/cpdfsdk_pageview.cpp
@@ -172,7 +172,7 @@
   if (!pContext->ContainsXFAForm())
     return false;
 
-  CPDFSDK_Annot::ObservedPtr pObserved(pAnnot);
+  ObservedPtr<CPDFSDK_Annot> pObserved(pAnnot);
   if (GetFocusAnnot() == pAnnot)
     m_pFormFillEnv->KillFocusAnnot(0);  // May invoke JS, invalidating pAnnot.
 
@@ -287,7 +287,7 @@
 }
 
 bool CPDFSDK_PageView::OnFocus(const CFX_PointF& point, uint32_t nFlag) {
-  CPDFSDK_Annot::ObservedPtr pAnnot(GetFXWidgetAtPoint(point));
+  ObservedPtr<CPDFSDK_Annot> pAnnot(GetFXWidgetAtPoint(point));
   if (!pAnnot) {
     m_pFormFillEnv->KillFocusAnnot(nFlag);
     return false;
@@ -298,7 +298,7 @@
 }
 
 bool CPDFSDK_PageView::OnLButtonDown(const CFX_PointF& point, uint32_t nFlag) {
-  CPDFSDK_Annot::ObservedPtr pAnnot(GetFXWidgetAtPoint(point));
+  ObservedPtr<CPDFSDK_Annot> pAnnot(GetFXWidgetAtPoint(point));
   if (!pAnnot) {
     m_pFormFillEnv->KillFocusAnnot(nFlag);
     return false;
@@ -319,8 +319,8 @@
 bool CPDFSDK_PageView::OnLButtonUp(const CFX_PointF& point, uint32_t nFlag) {
   CPDFSDK_AnnotHandlerMgr* pAnnotHandlerMgr =
       m_pFormFillEnv->GetAnnotHandlerMgr();
-  CPDFSDK_Annot::ObservedPtr pFXAnnot(GetFXWidgetAtPoint(point));
-  CPDFSDK_Annot::ObservedPtr pFocusAnnot(GetFocusAnnot());
+  ObservedPtr<CPDFSDK_Annot> pFXAnnot(GetFXWidgetAtPoint(point));
+  ObservedPtr<CPDFSDK_Annot> pFocusAnnot(GetFocusAnnot());
   if (pFocusAnnot && pFocusAnnot != pFXAnnot) {
     // Last focus Annot gets a chance to handle the event.
     if (pAnnotHandlerMgr->Annot_OnLButtonUp(this, &pFocusAnnot, nFlag, point))
@@ -332,7 +332,7 @@
 
 bool CPDFSDK_PageView::OnLButtonDblClk(const CFX_PointF& point,
                                        uint32_t nFlag) {
-  CPDFSDK_Annot::ObservedPtr pAnnot(GetFXWidgetAtPoint(point));
+  ObservedPtr<CPDFSDK_Annot> pAnnot(GetFXWidgetAtPoint(point));
   if (!pAnnot) {
     m_pFormFillEnv->KillFocusAnnot(nFlag);
     return false;
@@ -352,7 +352,7 @@
 
 #ifdef PDF_ENABLE_XFA
 bool CPDFSDK_PageView::OnRButtonDown(const CFX_PointF& point, uint32_t nFlag) {
-  CPDFSDK_Annot::ObservedPtr pAnnot(GetFXWidgetAtPoint(point));
+  ObservedPtr<CPDFSDK_Annot> pAnnot(GetFXWidgetAtPoint(point));
   if (!pAnnot)
     return false;
 
@@ -371,7 +371,7 @@
 bool CPDFSDK_PageView::OnRButtonUp(const CFX_PointF& point, uint32_t nFlag) {
   CPDFSDK_AnnotHandlerMgr* pAnnotHandlerMgr =
       m_pFormFillEnv->GetAnnotHandlerMgr();
-  CPDFSDK_Annot::ObservedPtr pFXAnnot(GetFXWidgetAtPoint(point));
+  ObservedPtr<CPDFSDK_Annot> pFXAnnot(GetFXWidgetAtPoint(point));
   if (!pFXAnnot)
     return false;
 
@@ -385,7 +385,7 @@
 bool CPDFSDK_PageView::OnMouseMove(const CFX_PointF& point, int nFlag) {
   CPDFSDK_AnnotHandlerMgr* pAnnotHandlerMgr =
       m_pFormFillEnv->GetAnnotHandlerMgr();
-  CPDFSDK_Annot::ObservedPtr pFXAnnot(GetFXAnnotAtPoint(point));
+  ObservedPtr<CPDFSDK_Annot> pFXAnnot(GetFXAnnotAtPoint(point));
 
   if (m_bOnWidget && m_pCaptureWidget != pFXAnnot)
     ExitWidget(pAnnotHandlerMgr, true, nFlag);
@@ -409,7 +409,7 @@
 }
 
 void CPDFSDK_PageView::EnterWidget(CPDFSDK_AnnotHandlerMgr* pAnnotHandlerMgr,
-                                   CPDFSDK_Annot::ObservedPtr* pAnnot,
+                                   ObservedPtr<CPDFSDK_Annot>* pAnnot,
                                    uint32_t nFlag) {
   m_bOnWidget = true;
   m_pCaptureWidget.Reset(pAnnot->Get());
@@ -432,7 +432,7 @@
                                     double deltaY,
                                     const CFX_PointF& point,
                                     int nFlag) {
-  CPDFSDK_Annot::ObservedPtr pAnnot(GetFXWidgetAtPoint(point));
+  ObservedPtr<CPDFSDK_Annot> pAnnot(GetFXWidgetAtPoint(point));
   if (!pAnnot)
     return false;
 
@@ -444,7 +444,7 @@
 
 bool CPDFSDK_PageView::SetIndexSelected(int index, bool selected) {
   if (CPDFSDK_Annot* pAnnot = GetFocusAnnot()) {
-    CPDFSDK_Annot::ObservedPtr pAnnotObserved(pAnnot);
+    ObservedPtr<CPDFSDK_Annot> pAnnotObserved(pAnnot);
     CPDFSDK_AnnotHandlerMgr* pAnnotHandlerMgr =
         m_pFormFillEnv->GetAnnotHandlerMgr();
     return pAnnotHandlerMgr->Annot_SetIndexSelected(&pAnnotObserved, index,
@@ -456,7 +456,7 @@
 
 bool CPDFSDK_PageView::IsIndexSelected(int index) {
   if (CPDFSDK_Annot* pAnnot = GetFocusAnnot()) {
-    CPDFSDK_Annot::ObservedPtr pAnnotObserved(pAnnot);
+    ObservedPtr<CPDFSDK_Annot> pAnnotObserved(pAnnot);
     CPDFSDK_AnnotHandlerMgr* pAnnotHandlerMgr =
         m_pFormFillEnv->GetAnnotHandlerMgr();
     return pAnnotHandlerMgr->Annot_IsIndexSelected(&pAnnotObserved, index);
diff --git a/fpdfsdk/cpdfsdk_pageview.h b/fpdfsdk/cpdfsdk_pageview.h
index 2ee15c3..d534902 100644
--- a/fpdfsdk/cpdfsdk_pageview.h
+++ b/fpdfsdk/cpdfsdk_pageview.h
@@ -105,7 +105,7 @@
   int GetPageIndexForStaticPDF() const;
 
   void EnterWidget(CPDFSDK_AnnotHandlerMgr* pAnnotHandlerMgr,
-                   CPDFSDK_Annot::ObservedPtr* pAnnot,
+                   ObservedPtr<CPDFSDK_Annot>* pAnnot,
                    uint32_t nFlag);
   void ExitWidget(CPDFSDK_AnnotHandlerMgr* pAnnotHandlerMgr,
                   bool callExitCallback,
@@ -116,7 +116,7 @@
   std::unique_ptr<CPDF_AnnotList> m_pAnnotList;
   std::vector<CPDFSDK_Annot*> m_SDKAnnotArray;
   UnownedPtr<CPDFSDK_FormFillEnvironment> const m_pFormFillEnv;
-  CPDFSDK_Annot::ObservedPtr m_pCaptureWidget;
+  ObservedPtr<CPDFSDK_Annot> m_pCaptureWidget;
   RetainPtr<CPDF_Page> m_pOwnsPage;
   bool m_bOnWidget = false;
   bool m_bValid = false;
diff --git a/fpdfsdk/cpdfsdk_widgethandler.cpp b/fpdfsdk/cpdfsdk_widgethandler.cpp
index 30137ca..5919ab4 100644
--- a/fpdfsdk/cpdfsdk_widgethandler.cpp
+++ b/fpdfsdk/cpdfsdk_widgethandler.cpp
@@ -102,21 +102,21 @@
 }
 
 void CPDFSDK_WidgetHandler::OnMouseEnter(CPDFSDK_PageView* pPageView,
-                                         CPDFSDK_Annot::ObservedPtr* pAnnot,
+                                         ObservedPtr<CPDFSDK_Annot>* pAnnot,
                                          uint32_t nFlag) {
   if (!(*pAnnot)->IsSignatureWidget())
     m_pFormFiller->OnMouseEnter(pPageView, pAnnot, nFlag);
 }
 
 void CPDFSDK_WidgetHandler::OnMouseExit(CPDFSDK_PageView* pPageView,
-                                        CPDFSDK_Annot::ObservedPtr* pAnnot,
+                                        ObservedPtr<CPDFSDK_Annot>* pAnnot,
                                         uint32_t nFlag) {
   if (!(*pAnnot)->IsSignatureWidget())
     m_pFormFiller->OnMouseExit(pPageView, pAnnot, nFlag);
 }
 
 bool CPDFSDK_WidgetHandler::OnLButtonDown(CPDFSDK_PageView* pPageView,
-                                          CPDFSDK_Annot::ObservedPtr* pAnnot,
+                                          ObservedPtr<CPDFSDK_Annot>* pAnnot,
                                           uint32_t nFlags,
                                           const CFX_PointF& point) {
   return !(*pAnnot)->IsSignatureWidget() &&
@@ -124,7 +124,7 @@
 }
 
 bool CPDFSDK_WidgetHandler::OnLButtonUp(CPDFSDK_PageView* pPageView,
-                                        CPDFSDK_Annot::ObservedPtr* pAnnot,
+                                        ObservedPtr<CPDFSDK_Annot>* pAnnot,
                                         uint32_t nFlags,
                                         const CFX_PointF& point) {
   return !(*pAnnot)->IsSignatureWidget() &&
@@ -132,7 +132,7 @@
 }
 
 bool CPDFSDK_WidgetHandler::OnLButtonDblClk(CPDFSDK_PageView* pPageView,
-                                            CPDFSDK_Annot::ObservedPtr* pAnnot,
+                                            ObservedPtr<CPDFSDK_Annot>* pAnnot,
                                             uint32_t nFlags,
                                             const CFX_PointF& point) {
   return !(*pAnnot)->IsSignatureWidget() &&
@@ -140,7 +140,7 @@
 }
 
 bool CPDFSDK_WidgetHandler::OnMouseMove(CPDFSDK_PageView* pPageView,
-                                        CPDFSDK_Annot::ObservedPtr* pAnnot,
+                                        ObservedPtr<CPDFSDK_Annot>* pAnnot,
                                         uint32_t nFlags,
                                         const CFX_PointF& point) {
   return !(*pAnnot)->IsSignatureWidget() &&
@@ -148,7 +148,7 @@
 }
 
 bool CPDFSDK_WidgetHandler::OnMouseWheel(CPDFSDK_PageView* pPageView,
-                                         CPDFSDK_Annot::ObservedPtr* pAnnot,
+                                         ObservedPtr<CPDFSDK_Annot>* pAnnot,
                                          uint32_t nFlags,
                                          short zDelta,
                                          const CFX_PointF& point) {
@@ -157,7 +157,7 @@
 }
 
 bool CPDFSDK_WidgetHandler::OnRButtonDown(CPDFSDK_PageView* pPageView,
-                                          CPDFSDK_Annot::ObservedPtr* pAnnot,
+                                          ObservedPtr<CPDFSDK_Annot>* pAnnot,
                                           uint32_t nFlags,
                                           const CFX_PointF& point) {
   return !(*pAnnot)->IsSignatureWidget() &&
@@ -165,7 +165,7 @@
 }
 
 bool CPDFSDK_WidgetHandler::OnRButtonUp(CPDFSDK_PageView* pPageView,
-                                        CPDFSDK_Annot::ObservedPtr* pAnnot,
+                                        ObservedPtr<CPDFSDK_Annot>* pAnnot,
                                         uint32_t nFlags,
                                         const CFX_PointF& point) {
   return !(*pAnnot)->IsSignatureWidget() &&
@@ -173,7 +173,7 @@
 }
 
 bool CPDFSDK_WidgetHandler::OnRButtonDblClk(CPDFSDK_PageView* pPageView,
-                                            CPDFSDK_Annot::ObservedPtr* pAnnot,
+                                            ObservedPtr<CPDFSDK_Annot>* pAnnot,
                                             uint32_t nFlags,
                                             const CFX_PointF& point) {
   return false;
@@ -210,7 +210,7 @@
   FormFieldType fieldType = pWidget->GetFieldType();
   if (fieldType == FormFieldType::kTextField ||
       fieldType == FormFieldType::kComboBox) {
-    CPDFSDK_Annot::ObservedPtr pObserved(pWidget);
+    ObservedPtr<CPDFSDK_Annot> pObserved(pWidget);
     Optional<WideString> sValue = pWidget->OnFormat();
     if (!pObserved)
       return;
@@ -229,26 +229,26 @@
 #endif  // PDF_ENABLE_XFA
 }
 
-bool CPDFSDK_WidgetHandler::OnSetFocus(CPDFSDK_Annot::ObservedPtr* pAnnot,
+bool CPDFSDK_WidgetHandler::OnSetFocus(ObservedPtr<CPDFSDK_Annot>* pAnnot,
                                        uint32_t nFlag) {
   return (*pAnnot)->IsSignatureWidget() ||
          m_pFormFiller->OnSetFocus(pAnnot, nFlag);
 }
 
-bool CPDFSDK_WidgetHandler::OnKillFocus(CPDFSDK_Annot::ObservedPtr* pAnnot,
+bool CPDFSDK_WidgetHandler::OnKillFocus(ObservedPtr<CPDFSDK_Annot>* pAnnot,
                                         uint32_t nFlag) {
   return (*pAnnot)->IsSignatureWidget() ||
          m_pFormFiller->OnKillFocus(pAnnot, nFlag);
 }
 
-bool CPDFSDK_WidgetHandler::SetIndexSelected(CPDFSDK_Annot::ObservedPtr* pAnnot,
+bool CPDFSDK_WidgetHandler::SetIndexSelected(ObservedPtr<CPDFSDK_Annot>* pAnnot,
                                              int index,
                                              bool selected) {
   return !(*pAnnot)->IsSignatureWidget() &&
          m_pFormFiller->SetIndexSelected(pAnnot, index, selected);
 }
 
-bool CPDFSDK_WidgetHandler::IsIndexSelected(CPDFSDK_Annot::ObservedPtr* pAnnot,
+bool CPDFSDK_WidgetHandler::IsIndexSelected(ObservedPtr<CPDFSDK_Annot>* pAnnot,
                                             int index) {
   return !(*pAnnot)->IsSignatureWidget() &&
          m_pFormFiller->IsIndexSelected(pAnnot, index);
@@ -256,8 +256,8 @@
 
 #ifdef PDF_ENABLE_XFA
 bool CPDFSDK_WidgetHandler::OnXFAChangedFocus(
-    CPDFSDK_Annot::ObservedPtr* pOldAnnot,
-    CPDFSDK_Annot::ObservedPtr* pNewAnnot) {
+    ObservedPtr<CPDFSDK_Annot>* pOldAnnot,
+    ObservedPtr<CPDFSDK_Annot>* pNewAnnot) {
   return true;
 }
 #endif  // PDF_ENABLE_XFA
diff --git a/fpdfsdk/cpdfsdk_widgethandler.h b/fpdfsdk/cpdfsdk_widgethandler.h
index a3eca7e..ba7649b 100644
--- a/fpdfsdk/cpdfsdk_widgethandler.h
+++ b/fpdfsdk/cpdfsdk_widgethandler.h
@@ -57,56 +57,56 @@
   void OnLoad(CPDFSDK_Annot* pAnnot) override;
 
   void OnMouseEnter(CPDFSDK_PageView* pPageView,
-                    CPDFSDK_Annot::ObservedPtr* pAnnot,
+                    ObservedPtr<CPDFSDK_Annot>* pAnnot,
                     uint32_t nFlag) override;
   void OnMouseExit(CPDFSDK_PageView* pPageView,
-                   CPDFSDK_Annot::ObservedPtr* pAnnot,
+                   ObservedPtr<CPDFSDK_Annot>* pAnnot,
                    uint32_t nFlag) override;
   bool OnLButtonDown(CPDFSDK_PageView* pPageView,
-                     CPDFSDK_Annot::ObservedPtr* pAnnot,
+                     ObservedPtr<CPDFSDK_Annot>* pAnnot,
                      uint32_t nFlags,
                      const CFX_PointF& point) override;
   bool OnLButtonUp(CPDFSDK_PageView* pPageView,
-                   CPDFSDK_Annot::ObservedPtr* pAnnot,
+                   ObservedPtr<CPDFSDK_Annot>* pAnnot,
                    uint32_t nFlags,
                    const CFX_PointF& point) override;
   bool OnLButtonDblClk(CPDFSDK_PageView* pPageView,
-                       CPDFSDK_Annot::ObservedPtr* pAnnot,
+                       ObservedPtr<CPDFSDK_Annot>* pAnnot,
                        uint32_t nFlags,
                        const CFX_PointF& point) override;
   bool OnMouseMove(CPDFSDK_PageView* pPageView,
-                   CPDFSDK_Annot::ObservedPtr* pAnnot,
+                   ObservedPtr<CPDFSDK_Annot>* pAnnot,
                    uint32_t nFlags,
                    const CFX_PointF& point) override;
   bool OnMouseWheel(CPDFSDK_PageView* pPageView,
-                    CPDFSDK_Annot::ObservedPtr* pAnnot,
+                    ObservedPtr<CPDFSDK_Annot>* pAnnot,
                     uint32_t nFlags,
                     short zDelta,
                     const CFX_PointF& point) override;
   bool OnRButtonDown(CPDFSDK_PageView* pPageView,
-                     CPDFSDK_Annot::ObservedPtr* pAnnot,
+                     ObservedPtr<CPDFSDK_Annot>* pAnnot,
                      uint32_t nFlags,
                      const CFX_PointF& point) override;
   bool OnRButtonUp(CPDFSDK_PageView* pPageView,
-                   CPDFSDK_Annot::ObservedPtr* pAnnot,
+                   ObservedPtr<CPDFSDK_Annot>* pAnnot,
                    uint32_t nFlags,
                    const CFX_PointF& point) override;
   bool OnRButtonDblClk(CPDFSDK_PageView* pPageView,
-                       CPDFSDK_Annot::ObservedPtr* pAnnot,
+                       ObservedPtr<CPDFSDK_Annot>* pAnnot,
                        uint32_t nFlags,
                        const CFX_PointF& point) override;
   bool OnChar(CPDFSDK_Annot* pAnnot, uint32_t nChar, uint32_t nFlags) override;
   bool OnKeyDown(CPDFSDK_Annot* pAnnot, int nKeyCode, int nFlag) override;
   bool OnKeyUp(CPDFSDK_Annot* pAnnot, int nKeyCode, int nFlag) override;
-  bool OnSetFocus(CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlag) override;
-  bool OnKillFocus(CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlag) override;
-  bool SetIndexSelected(CPDFSDK_Annot::ObservedPtr* pAnnot,
+  bool OnSetFocus(ObservedPtr<CPDFSDK_Annot>* pAnnot, uint32_t nFlag) override;
+  bool OnKillFocus(ObservedPtr<CPDFSDK_Annot>* pAnnot, uint32_t nFlag) override;
+  bool SetIndexSelected(ObservedPtr<CPDFSDK_Annot>* pAnnot,
                         int index,
                         bool selected) override;
-  bool IsIndexSelected(CPDFSDK_Annot::ObservedPtr* pAnnot, int index) override;
+  bool IsIndexSelected(ObservedPtr<CPDFSDK_Annot>* pAnnot, int index) override;
 #ifdef PDF_ENABLE_XFA
-  bool OnXFAChangedFocus(CPDFSDK_Annot::ObservedPtr* pOldAnnot,
-                         CPDFSDK_Annot::ObservedPtr* pNewAnnot) override;
+  bool OnXFAChangedFocus(ObservedPtr<CPDFSDK_Annot>* pOldAnnot,
+                         ObservedPtr<CPDFSDK_Annot>* pNewAnnot) override;
 #endif  // PDF_ENABLE_XFA
 
  private:
diff --git a/fpdfsdk/cpdfsdk_xfawidgethandler.cpp b/fpdfsdk/cpdfsdk_xfawidgethandler.cpp
index 97b8080..bbecd7c 100644
--- a/fpdfsdk/cpdfsdk_xfawidgethandler.cpp
+++ b/fpdfsdk/cpdfsdk_xfawidgethandler.cpp
@@ -348,7 +348,7 @@
 }
 
 void CPDFSDK_XFAWidgetHandler::OnMouseEnter(CPDFSDK_PageView* pPageView,
-                                            CPDFSDK_Annot::ObservedPtr* pAnnot,
+                                            ObservedPtr<CPDFSDK_Annot>* pAnnot,
                                             uint32_t nFlag) {
   if (!pPageView || !pAnnot->HasObservable())
     return;
@@ -357,7 +357,7 @@
 }
 
 void CPDFSDK_XFAWidgetHandler::OnMouseExit(CPDFSDK_PageView* pPageView,
-                                           CPDFSDK_Annot::ObservedPtr* pAnnot,
+                                           ObservedPtr<CPDFSDK_Annot>* pAnnot,
                                            uint32_t nFlag) {
   if (!pPageView || !pAnnot->HasObservable())
     return;
@@ -367,7 +367,7 @@
 }
 
 bool CPDFSDK_XFAWidgetHandler::OnLButtonDown(CPDFSDK_PageView* pPageView,
-                                             CPDFSDK_Annot::ObservedPtr* pAnnot,
+                                             ObservedPtr<CPDFSDK_Annot>* pAnnot,
                                              uint32_t nFlags,
                                              const CFX_PointF& point) {
   if (!pPageView || !pAnnot->HasObservable())
@@ -379,7 +379,7 @@
 }
 
 bool CPDFSDK_XFAWidgetHandler::OnLButtonUp(CPDFSDK_PageView* pPageView,
-                                           CPDFSDK_Annot::ObservedPtr* pAnnot,
+                                           ObservedPtr<CPDFSDK_Annot>* pAnnot,
                                            uint32_t nFlags,
                                            const CFX_PointF& point) {
   if (!pPageView || !pAnnot->HasObservable())
@@ -392,7 +392,7 @@
 
 bool CPDFSDK_XFAWidgetHandler::OnLButtonDblClk(
     CPDFSDK_PageView* pPageView,
-    CPDFSDK_Annot::ObservedPtr* pAnnot,
+    ObservedPtr<CPDFSDK_Annot>* pAnnot,
     uint32_t nFlags,
     const CFX_PointF& point) {
   if (!pPageView || !pAnnot->HasObservable())
@@ -404,7 +404,7 @@
 }
 
 bool CPDFSDK_XFAWidgetHandler::OnMouseMove(CPDFSDK_PageView* pPageView,
-                                           CPDFSDK_Annot::ObservedPtr* pAnnot,
+                                           ObservedPtr<CPDFSDK_Annot>* pAnnot,
                                            uint32_t nFlags,
                                            const CFX_PointF& point) {
   if (!pPageView || !pAnnot->HasObservable())
@@ -416,7 +416,7 @@
 }
 
 bool CPDFSDK_XFAWidgetHandler::OnMouseWheel(CPDFSDK_PageView* pPageView,
-                                            CPDFSDK_Annot::ObservedPtr* pAnnot,
+                                            ObservedPtr<CPDFSDK_Annot>* pAnnot,
                                             uint32_t nFlags,
                                             short zDelta,
                                             const CFX_PointF& point) {
@@ -429,7 +429,7 @@
 }
 
 bool CPDFSDK_XFAWidgetHandler::OnRButtonDown(CPDFSDK_PageView* pPageView,
-                                             CPDFSDK_Annot::ObservedPtr* pAnnot,
+                                             ObservedPtr<CPDFSDK_Annot>* pAnnot,
                                              uint32_t nFlags,
                                              const CFX_PointF& point) {
   if (!pPageView || !pAnnot->HasObservable())
@@ -441,7 +441,7 @@
 }
 
 bool CPDFSDK_XFAWidgetHandler::OnRButtonUp(CPDFSDK_PageView* pPageView,
-                                           CPDFSDK_Annot::ObservedPtr* pAnnot,
+                                           ObservedPtr<CPDFSDK_Annot>* pAnnot,
                                            uint32_t nFlags,
                                            const CFX_PointF& point) {
   if (!pPageView || !pAnnot->HasObservable())
@@ -454,7 +454,7 @@
 
 bool CPDFSDK_XFAWidgetHandler::OnRButtonDblClk(
     CPDFSDK_PageView* pPageView,
-    CPDFSDK_Annot::ObservedPtr* pAnnot,
+    ObservedPtr<CPDFSDK_Annot>* pAnnot,
     uint32_t nFlags,
     const CFX_PointF& point) {
   if (!pPageView || !pAnnot->HasObservable())
@@ -498,12 +498,12 @@
                                  GetFWLFlags(nFlag));
 }
 
-bool CPDFSDK_XFAWidgetHandler::OnSetFocus(CPDFSDK_Annot::ObservedPtr* pAnnot,
+bool CPDFSDK_XFAWidgetHandler::OnSetFocus(ObservedPtr<CPDFSDK_Annot>* pAnnot,
                                           uint32_t nFlag) {
   return true;
 }
 
-bool CPDFSDK_XFAWidgetHandler::OnKillFocus(CPDFSDK_Annot::ObservedPtr* pAnnot,
+bool CPDFSDK_XFAWidgetHandler::OnKillFocus(ObservedPtr<CPDFSDK_Annot>* pAnnot,
                                            uint32_t nFlag) {
   CXFA_FFWidget* hWidget = *pAnnot ? (*pAnnot)->GetXFAWidget() : nullptr;
   if (!hWidget)
@@ -518,8 +518,8 @@
 }
 
 bool CPDFSDK_XFAWidgetHandler::OnXFAChangedFocus(
-    CPDFSDK_Annot::ObservedPtr* pOldAnnot,
-    CPDFSDK_Annot::ObservedPtr* pNewAnnot) {
+    ObservedPtr<CPDFSDK_Annot>* pOldAnnot,
+    ObservedPtr<CPDFSDK_Annot>* pNewAnnot) {
   CXFA_FFWidgetHandler* pWidgetHandler = nullptr;
   if (pOldAnnot->HasObservable())
     pWidgetHandler = GetXFAWidgetHandler(pOldAnnot->Get());
@@ -545,14 +545,14 @@
 }
 
 bool CPDFSDK_XFAWidgetHandler::SetIndexSelected(
-    CPDFSDK_Annot::ObservedPtr* pAnnot,
+    ObservedPtr<CPDFSDK_Annot>* pAnnot,
     int index,
     bool selected) {
   return false;
 }
 
 bool CPDFSDK_XFAWidgetHandler::IsIndexSelected(
-    CPDFSDK_Annot::ObservedPtr* pAnnot,
+    ObservedPtr<CPDFSDK_Annot>* pAnnot,
     int index) {
   return false;
 }
diff --git a/fpdfsdk/cpdfsdk_xfawidgethandler.h b/fpdfsdk/cpdfsdk_xfawidgethandler.h
index 95f2ac1..4ddc15b 100644
--- a/fpdfsdk/cpdfsdk_xfawidgethandler.h
+++ b/fpdfsdk/cpdfsdk_xfawidgethandler.h
@@ -51,55 +51,55 @@
               bool bDrawAnnots) override;
   void OnLoad(CPDFSDK_Annot* pAnnot) override;
   void OnMouseEnter(CPDFSDK_PageView* pPageView,
-                    CPDFSDK_Annot::ObservedPtr* pAnnot,
+                    ObservedPtr<CPDFSDK_Annot>* pAnnot,
                     uint32_t nFlag) override;
   void OnMouseExit(CPDFSDK_PageView* pPageView,
-                   CPDFSDK_Annot::ObservedPtr* pAnnot,
+                   ObservedPtr<CPDFSDK_Annot>* pAnnot,
                    uint32_t nFlag) override;
   bool OnLButtonDown(CPDFSDK_PageView* pPageView,
-                     CPDFSDK_Annot::ObservedPtr* pAnnot,
+                     ObservedPtr<CPDFSDK_Annot>* pAnnot,
                      uint32_t nFlags,
                      const CFX_PointF& point) override;
   bool OnLButtonUp(CPDFSDK_PageView* pPageView,
-                   CPDFSDK_Annot::ObservedPtr* pAnnot,
+                   ObservedPtr<CPDFSDK_Annot>* pAnnot,
                    uint32_t nFlags,
                    const CFX_PointF& point) override;
   bool OnLButtonDblClk(CPDFSDK_PageView* pPageView,
-                       CPDFSDK_Annot::ObservedPtr* pAnnot,
+                       ObservedPtr<CPDFSDK_Annot>* pAnnot,
                        uint32_t nFlags,
                        const CFX_PointF& point) override;
   bool OnMouseMove(CPDFSDK_PageView* pPageView,
-                   CPDFSDK_Annot::ObservedPtr* pAnnot,
+                   ObservedPtr<CPDFSDK_Annot>* pAnnot,
                    uint32_t nFlags,
                    const CFX_PointF& point) override;
   bool OnMouseWheel(CPDFSDK_PageView* pPageView,
-                    CPDFSDK_Annot::ObservedPtr* pAnnot,
+                    ObservedPtr<CPDFSDK_Annot>* pAnnot,
                     uint32_t nFlags,
                     short zDelta,
                     const CFX_PointF& point) override;
   bool OnRButtonDown(CPDFSDK_PageView* pPageView,
-                     CPDFSDK_Annot::ObservedPtr* pAnnot,
+                     ObservedPtr<CPDFSDK_Annot>* pAnnot,
                      uint32_t nFlags,
                      const CFX_PointF& point) override;
   bool OnRButtonUp(CPDFSDK_PageView* pPageView,
-                   CPDFSDK_Annot::ObservedPtr* pAnnot,
+                   ObservedPtr<CPDFSDK_Annot>* pAnnot,
                    uint32_t nFlags,
                    const CFX_PointF& point) override;
   bool OnRButtonDblClk(CPDFSDK_PageView* pPageView,
-                       CPDFSDK_Annot::ObservedPtr* pAnnot,
+                       ObservedPtr<CPDFSDK_Annot>* pAnnot,
                        uint32_t nFlags,
                        const CFX_PointF& point) override;
   bool OnChar(CPDFSDK_Annot* pAnnot, uint32_t nChar, uint32_t nFlags) override;
   bool OnKeyDown(CPDFSDK_Annot* pAnnot, int nKeyCode, int nFlag) override;
   bool OnKeyUp(CPDFSDK_Annot* pAnnot, int nKeyCode, int nFlag) override;
-  bool OnSetFocus(CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlag) override;
-  bool OnKillFocus(CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlag) override;
-  bool OnXFAChangedFocus(CPDFSDK_Annot::ObservedPtr* pOldAnnot,
-                         CPDFSDK_Annot::ObservedPtr* pNewAnnot) override;
-  bool SetIndexSelected(CPDFSDK_Annot::ObservedPtr* pAnnot,
+  bool OnSetFocus(ObservedPtr<CPDFSDK_Annot>* pAnnot, uint32_t nFlag) override;
+  bool OnKillFocus(ObservedPtr<CPDFSDK_Annot>* pAnnot, uint32_t nFlag) override;
+  bool OnXFAChangedFocus(ObservedPtr<CPDFSDK_Annot>* pOldAnnot,
+                         ObservedPtr<CPDFSDK_Annot>* pNewAnnot) override;
+  bool SetIndexSelected(ObservedPtr<CPDFSDK_Annot>* pAnnot,
                         int index,
                         bool selected) override;
-  bool IsIndexSelected(CPDFSDK_Annot::ObservedPtr* pAnnot, int index) override;
+  bool IsIndexSelected(ObservedPtr<CPDFSDK_Annot>* pAnnot, int index) override;
 
  private:
   CXFA_FFWidgetHandler* GetXFAWidgetHandler(CPDFSDK_Annot* pAnnot);
diff --git a/fpdfsdk/formfiller/cffl_checkbox.cpp b/fpdfsdk/formfiller/cffl_checkbox.cpp
index 553fa34..3fbcd11 100644
--- a/fpdfsdk/formfiller/cffl_checkbox.cpp
+++ b/fpdfsdk/formfiller/cffl_checkbox.cpp
@@ -48,7 +48,7 @@
       CPDFSDK_PageView* pPageView = pAnnot->GetPageView();
       ASSERT(pPageView);
 
-      CPDFSDK_Annot::ObservedPtr pObserved(m_pWidget.Get());
+      ObservedPtr<CPDFSDK_Annot> pObserved(m_pWidget.Get());
       if (m_pFormFillEnv->GetInteractiveFormFiller()->OnButtonUp(
               &pObserved, pPageView, nFlags)) {
         if (!pObserved)
@@ -114,8 +114,8 @@
       }
     }
   }
-  CPDFSDK_Widget::ObservedPtr observed_widget(m_pWidget.Get());
-  CFFL_CheckBox::ObservedPtr observed_this(this);
+  ObservedPtr<CPDFSDK_Widget> observed_widget(m_pWidget.Get());
+  ObservedPtr<CFFL_CheckBox> observed_this(this);
   m_pWidget->SetCheck(bNewChecked, NotificationOption::kDoNotNotify);
   if (!observed_widget)
     return;
diff --git a/fpdfsdk/formfiller/cffl_combobox.cpp b/fpdfsdk/formfiller/cffl_combobox.cpp
index 5d681df..6f47983 100644
--- a/fpdfsdk/formfiller/cffl_combobox.cpp
+++ b/fpdfsdk/formfiller/cffl_combobox.cpp
@@ -110,8 +110,8 @@
     m_pWidget->SetOptionSelection(nCurSel, true,
                                   NotificationOption::kDoNotNotify);
   }
-  CPDFSDK_Widget::ObservedPtr observed_widget(m_pWidget.Get());
-  CFFL_ComboBox::ObservedPtr observed_this(this);
+  ObservedPtr<CPDFSDK_Widget> observed_widget(m_pWidget.Get());
+  ObservedPtr<CFFL_ComboBox> observed_this(this);
   m_pWidget->ResetFieldAppearance(true);
   if (!observed_widget)
     return;
diff --git a/fpdfsdk/formfiller/cffl_formfiller.cpp b/fpdfsdk/formfiller/cffl_formfiller.cpp
index 2ab6afd..11074f9 100644
--- a/fpdfsdk/formfiller/cffl_formfiller.cpp
+++ b/fpdfsdk/formfiller/cffl_formfiller.cpp
@@ -502,7 +502,7 @@
 
   CFFL_InteractiveFormFiller* pFormFiller =
       m_pFormFillEnv->GetInteractiveFormFiller();
-  CPDFSDK_Annot::ObservedPtr pObserved(m_pWidget.Get());
+  ObservedPtr<CPDFSDK_Annot> pObserved(m_pWidget.Get());
 
   if (!pFormFiller->OnKeyStrokeCommit(&pObserved, pPageView, nFlag)) {
     if (!pObserved)
diff --git a/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp b/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp
index 170efcd..4524719 100644
--- a/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp
+++ b/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp
@@ -114,7 +114,7 @@
 
 void CFFL_InteractiveFormFiller::OnMouseEnter(
     CPDFSDK_PageView* pPageView,
-    CPDFSDK_Annot::ObservedPtr* pAnnot,
+    ObservedPtr<CPDFSDK_Annot>* pAnnot,
     uint32_t nFlag) {
   ASSERT((*pAnnot)->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET);
   if (!m_bNotifying) {
@@ -147,7 +147,7 @@
 }
 
 void CFFL_InteractiveFormFiller::OnMouseExit(CPDFSDK_PageView* pPageView,
-                                             CPDFSDK_Annot::ObservedPtr* pAnnot,
+                                             ObservedPtr<CPDFSDK_Annot>* pAnnot,
                                              uint32_t nFlag) {
   ASSERT((*pAnnot)->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET);
   if (!m_bNotifying) {
@@ -181,7 +181,7 @@
 
 bool CFFL_InteractiveFormFiller::OnLButtonDown(
     CPDFSDK_PageView* pPageView,
-    CPDFSDK_Annot::ObservedPtr* pAnnot,
+    ObservedPtr<CPDFSDK_Annot>* pAnnot,
     uint32_t nFlags,
     const CFX_PointF& point) {
   ASSERT((*pAnnot)->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET);
@@ -220,7 +220,7 @@
 }
 
 bool CFFL_InteractiveFormFiller::OnLButtonUp(CPDFSDK_PageView* pPageView,
-                                             CPDFSDK_Annot::ObservedPtr* pAnnot,
+                                             ObservedPtr<CPDFSDK_Annot>* pAnnot,
                                              uint32_t nFlags,
                                              const CFX_PointF& point) {
   ASSERT((*pAnnot)->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET);
@@ -257,7 +257,7 @@
   return bRet;
 }
 
-bool CFFL_InteractiveFormFiller::OnButtonUp(CPDFSDK_Annot::ObservedPtr* pAnnot,
+bool CFFL_InteractiveFormFiller::OnButtonUp(ObservedPtr<CPDFSDK_Annot>* pAnnot,
                                             CPDFSDK_PageView* pPageView,
                                             uint32_t nFlag) {
   if (m_bNotifying)
@@ -290,7 +290,7 @@
 }
 
 bool CFFL_InteractiveFormFiller::SetIndexSelected(
-    CPDFSDK_Annot::ObservedPtr* pAnnot,
+    ObservedPtr<CPDFSDK_Annot>* pAnnot,
     int index,
     bool selected) {
   ASSERT((*pAnnot)->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET);
@@ -300,7 +300,7 @@
 }
 
 bool CFFL_InteractiveFormFiller::IsIndexSelected(
-    CPDFSDK_Annot::ObservedPtr* pAnnot,
+    ObservedPtr<CPDFSDK_Annot>* pAnnot,
     int index) {
   ASSERT((*pAnnot)->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET);
 
@@ -310,7 +310,7 @@
 
 bool CFFL_InteractiveFormFiller::OnLButtonDblClk(
     CPDFSDK_PageView* pPageView,
-    CPDFSDK_Annot::ObservedPtr* pAnnot,
+    ObservedPtr<CPDFSDK_Annot>* pAnnot,
     uint32_t nFlags,
     const CFX_PointF& point) {
   ASSERT((*pAnnot)->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET);
@@ -319,7 +319,7 @@
 }
 
 bool CFFL_InteractiveFormFiller::OnMouseMove(CPDFSDK_PageView* pPageView,
-                                             CPDFSDK_Annot::ObservedPtr* pAnnot,
+                                             ObservedPtr<CPDFSDK_Annot>* pAnnot,
                                              uint32_t nFlags,
                                              const CFX_PointF& point) {
   ASSERT((*pAnnot)->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET);
@@ -329,7 +329,7 @@
 
 bool CFFL_InteractiveFormFiller::OnMouseWheel(
     CPDFSDK_PageView* pPageView,
-    CPDFSDK_Annot::ObservedPtr* pAnnot,
+    ObservedPtr<CPDFSDK_Annot>* pAnnot,
     uint32_t nFlags,
     short zDelta,
     const CFX_PointF& point) {
@@ -341,7 +341,7 @@
 
 bool CFFL_InteractiveFormFiller::OnRButtonDown(
     CPDFSDK_PageView* pPageView,
-    CPDFSDK_Annot::ObservedPtr* pAnnot,
+    ObservedPtr<CPDFSDK_Annot>* pAnnot,
     uint32_t nFlags,
     const CFX_PointF& point) {
   ASSERT((*pAnnot)->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET);
@@ -350,7 +350,7 @@
 }
 
 bool CFFL_InteractiveFormFiller::OnRButtonUp(CPDFSDK_PageView* pPageView,
-                                             CPDFSDK_Annot::ObservedPtr* pAnnot,
+                                             ObservedPtr<CPDFSDK_Annot>* pAnnot,
                                              uint32_t nFlags,
                                              const CFX_PointF& point) {
   ASSERT((*pAnnot)->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET);
@@ -378,7 +378,7 @@
   return pFormFiller && pFormFiller->OnChar(pAnnot, nChar, nFlags);
 }
 
-bool CFFL_InteractiveFormFiller::OnSetFocus(CPDFSDK_Annot::ObservedPtr* pAnnot,
+bool CFFL_InteractiveFormFiller::OnSetFocus(ObservedPtr<CPDFSDK_Annot>* pAnnot,
                                             uint32_t nFlag) {
   if (!pAnnot->HasObservable())
     return false;
@@ -423,7 +423,7 @@
   return true;
 }
 
-bool CFFL_InteractiveFormFiller::OnKillFocus(CPDFSDK_Annot::ObservedPtr* pAnnot,
+bool CFFL_InteractiveFormFiller::OnKillFocus(ObservedPtr<CPDFSDK_Annot>* pAnnot,
                                              uint32_t nFlag) {
   if (!pAnnot->HasObservable())
     return false;
@@ -644,7 +644,7 @@
 }
 
 bool CFFL_InteractiveFormFiller::OnKeyStrokeCommit(
-    CPDFSDK_Annot::ObservedPtr* pAnnot,
+    ObservedPtr<CPDFSDK_Annot>* pAnnot,
     CPDFSDK_PageView* pPageView,
     uint32_t nFlag) {
   if (m_bNotifying)
@@ -676,7 +676,7 @@
   return fa.bRC;
 }
 
-bool CFFL_InteractiveFormFiller::OnValidate(CPDFSDK_Annot::ObservedPtr* pAnnot,
+bool CFFL_InteractiveFormFiller::OnValidate(ObservedPtr<CPDFSDK_Annot>* pAnnot,
                                             CPDFSDK_PageView* pPageView,
                                             uint32_t nFlag) {
   if (m_bNotifying)
@@ -707,7 +707,7 @@
   return fa.bRC;
 }
 
-void CFFL_InteractiveFormFiller::OnCalculate(CPDFSDK_Annot::ObservedPtr* pAnnot,
+void CFFL_InteractiveFormFiller::OnCalculate(ObservedPtr<CPDFSDK_Annot>* pAnnot,
                                              CPDFSDK_PageView* pPageView,
                                              uint32_t nFlag) {
   if (m_bNotifying)
@@ -722,7 +722,7 @@
   m_bNotifying = false;
 }
 
-void CFFL_InteractiveFormFiller::OnFormat(CPDFSDK_Annot::ObservedPtr* pAnnot,
+void CFFL_InteractiveFormFiller::OnFormat(ObservedPtr<CPDFSDK_Annot>* pAnnot,
                                           CPDFSDK_PageView* pPageView,
                                           uint32_t nFlag) {
   if (m_bNotifying)
@@ -746,7 +746,7 @@
 }
 
 #ifdef PDF_ENABLE_XFA
-bool CFFL_InteractiveFormFiller::OnClick(CPDFSDK_Annot::ObservedPtr* pAnnot,
+bool CFFL_InteractiveFormFiller::OnClick(ObservedPtr<CPDFSDK_Annot>* pAnnot,
                                          CPDFSDK_PageView* pPageView,
                                          uint32_t nFlag) {
   if (m_bNotifying)
@@ -776,7 +776,7 @@
   return false;
 }
 
-bool CFFL_InteractiveFormFiller::OnFull(CPDFSDK_Annot::ObservedPtr* pAnnot,
+bool CFFL_InteractiveFormFiller::OnFull(ObservedPtr<CPDFSDK_Annot>* pAnnot,
                                         CPDFSDK_PageView* pPageView,
                                         uint32_t nFlag) {
   if (m_bNotifying)
@@ -813,7 +813,7 @@
   auto* pData = static_cast<const CFFL_PrivateData*>(pAttached);
   ASSERT(pData->pWidget);
 
-  CPDFSDK_Annot::ObservedPtr pObserved(pData->pWidget);
+  ObservedPtr<CPDFSDK_Annot> pObserved(pData->pWidget);
   return OnPreOpen(&pObserved, pData->pPageView, nFlag) || !pObserved;
 }
 
@@ -823,11 +823,11 @@
   auto* pData = static_cast<const CFFL_PrivateData*>(pAttached);
   ASSERT(pData->pWidget);
 
-  CPDFSDK_Annot::ObservedPtr pObserved(pData->pWidget);
+  ObservedPtr<CPDFSDK_Annot> pObserved(pData->pWidget);
   return OnPostOpen(&pObserved, pData->pPageView, nFlag) || !pObserved;
 }
 
-bool CFFL_InteractiveFormFiller::OnPreOpen(CPDFSDK_Annot::ObservedPtr* pAnnot,
+bool CFFL_InteractiveFormFiller::OnPreOpen(ObservedPtr<CPDFSDK_Annot>* pAnnot,
                                            CPDFSDK_PageView* pPageView,
                                            uint32_t nFlag) {
   if (m_bNotifying)
@@ -858,7 +858,7 @@
   return true;
 }
 
-bool CFFL_InteractiveFormFiller::OnPostOpen(CPDFSDK_Annot::ObservedPtr* pAnnot,
+bool CFFL_InteractiveFormFiller::OnPostOpen(ObservedPtr<CPDFSDK_Annot>* pAnnot,
                                             CPDFSDK_PageView* pPageView,
                                             uint32_t nFlag) {
   if (m_bNotifying)
@@ -912,7 +912,7 @@
 
 #ifdef PDF_ENABLE_XFA
   if (pFormFiller->IsFieldFull(privateData.pPageView)) {
-    CPDFSDK_Annot::ObservedPtr pObserved(privateData.pWidget);
+    ObservedPtr<CPDFSDK_Annot> pObserved(privateData.pWidget);
     if (OnFull(&pObserved, privateData.pPageView, nFlag) || !pObserved)
       return {true, true};
   }
@@ -945,7 +945,7 @@
                              fa);
   pFormFiller->SaveState(privateData.pPageView);
 
-  CPDFSDK_Annot::ObservedPtr pObserved(privateData.pWidget);
+  ObservedPtr<CPDFSDK_Annot> pObserved(privateData.pWidget);
   bool action_status = privateData.pWidget->OnAAction(
       CPDF_AAction::kKeyStroke, &fa, privateData.pPageView);
 
diff --git a/fpdfsdk/formfiller/cffl_interactiveformfiller.h b/fpdfsdk/formfiller/cffl_interactiveformfiller.h
index 670ff27..afa12f6 100644
--- a/fpdfsdk/formfiller/cffl_interactiveformfiller.h
+++ b/fpdfsdk/formfiller/cffl_interactiveformfiller.h
@@ -38,46 +38,46 @@
   void OnDelete(CPDFSDK_Annot* pAnnot);
 
   void OnMouseEnter(CPDFSDK_PageView* pPageView,
-                    CPDFSDK_Annot::ObservedPtr* pAnnot,
+                    ObservedPtr<CPDFSDK_Annot>* pAnnot,
                     uint32_t nFlag);
   void OnMouseExit(CPDFSDK_PageView* pPageView,
-                   CPDFSDK_Annot::ObservedPtr* pAnnot,
+                   ObservedPtr<CPDFSDK_Annot>* pAnnot,
                    uint32_t nFlag);
   bool OnLButtonDown(CPDFSDK_PageView* pPageView,
-                     CPDFSDK_Annot::ObservedPtr* pAnnot,
+                     ObservedPtr<CPDFSDK_Annot>* pAnnot,
                      uint32_t nFlags,
                      const CFX_PointF& point);
   bool OnLButtonUp(CPDFSDK_PageView* pPageView,
-                   CPDFSDK_Annot::ObservedPtr* pAnnot,
+                   ObservedPtr<CPDFSDK_Annot>* pAnnot,
                    uint32_t nFlags,
                    const CFX_PointF& point);
   bool OnLButtonDblClk(CPDFSDK_PageView* pPageView,
-                       CPDFSDK_Annot::ObservedPtr* pAnnot,
+                       ObservedPtr<CPDFSDK_Annot>* pAnnot,
                        uint32_t nFlags,
                        const CFX_PointF& point);
   bool OnMouseMove(CPDFSDK_PageView* pPageView,
-                   CPDFSDK_Annot::ObservedPtr* pAnnot,
+                   ObservedPtr<CPDFSDK_Annot>* pAnnot,
                    uint32_t nFlags,
                    const CFX_PointF& point);
   bool OnMouseWheel(CPDFSDK_PageView* pPageView,
-                    CPDFSDK_Annot::ObservedPtr* pAnnot,
+                    ObservedPtr<CPDFSDK_Annot>* pAnnot,
                     uint32_t nFlags,
                     short zDelta,
                     const CFX_PointF& point);
   bool OnRButtonDown(CPDFSDK_PageView* pPageView,
-                     CPDFSDK_Annot::ObservedPtr* pAnnot,
+                     ObservedPtr<CPDFSDK_Annot>* pAnnot,
                      uint32_t nFlags,
                      const CFX_PointF& point);
   bool OnRButtonUp(CPDFSDK_PageView* pPageView,
-                   CPDFSDK_Annot::ObservedPtr* pAnnot,
+                   ObservedPtr<CPDFSDK_Annot>* pAnnot,
                    uint32_t nFlags,
                    const CFX_PointF& point);
 
   bool OnKeyDown(CPDFSDK_Annot* pAnnot, uint32_t nKeyCode, uint32_t nFlags);
   bool OnChar(CPDFSDK_Annot* pAnnot, uint32_t nChar, uint32_t nFlags);
 
-  bool OnSetFocus(CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlag);
-  bool OnKillFocus(CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlag);
+  bool OnSetFocus(ObservedPtr<CPDFSDK_Annot>* pAnnot, uint32_t nFlag);
+  bool OnKillFocus(ObservedPtr<CPDFSDK_Annot>* pAnnot, uint32_t nFlag);
 
   CFFL_FormFiller* GetFormFillerForTesting(CPDFSDK_Annot* pAnnot) {
     return GetFormFiller(pAnnot);
@@ -97,38 +97,38 @@
   static bool IsFillingAllowed(CPDFSDK_Widget* pWidget);
   static bool IsValidAnnot(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot);
 
-  bool OnKeyStrokeCommit(CPDFSDK_Annot::ObservedPtr* pWidget,
+  bool OnKeyStrokeCommit(ObservedPtr<CPDFSDK_Annot>* pWidget,
                          CPDFSDK_PageView* pPageView,
                          uint32_t nFlag);
-  bool OnValidate(CPDFSDK_Annot::ObservedPtr* pAnnot,
+  bool OnValidate(ObservedPtr<CPDFSDK_Annot>* pAnnot,
                   CPDFSDK_PageView* pPageView,
                   uint32_t nFlag);
-  void OnCalculate(CPDFSDK_Annot::ObservedPtr* pAnnot,
+  void OnCalculate(ObservedPtr<CPDFSDK_Annot>* pAnnot,
                    CPDFSDK_PageView* pPageView,
                    uint32_t nFlag);
-  void OnFormat(CPDFSDK_Annot::ObservedPtr* pAnnot,
+  void OnFormat(ObservedPtr<CPDFSDK_Annot>* pAnnot,
                 CPDFSDK_PageView* pPageView,
                 uint32_t nFlag);
-  bool OnButtonUp(CPDFSDK_Annot::ObservedPtr* pAnnot,
+  bool OnButtonUp(ObservedPtr<CPDFSDK_Annot>* pAnnot,
                   CPDFSDK_PageView* pPageView,
                   uint32_t nFlag);
 
-  bool SetIndexSelected(CPDFSDK_Annot::ObservedPtr* pAnnot,
+  bool SetIndexSelected(ObservedPtr<CPDFSDK_Annot>* pAnnot,
                         int index,
                         bool selected);
-  bool IsIndexSelected(CPDFSDK_Annot::ObservedPtr* pAnnot, int index);
+  bool IsIndexSelected(ObservedPtr<CPDFSDK_Annot>* pAnnot, int index);
 
 #ifdef PDF_ENABLE_XFA
-  bool OnClick(CPDFSDK_Annot::ObservedPtr* pAnnot,
+  bool OnClick(ObservedPtr<CPDFSDK_Annot>* pAnnot,
                CPDFSDK_PageView* pPageView,
                uint32_t nFlag);
-  bool OnFull(CPDFSDK_Annot::ObservedPtr* pAnnot,
+  bool OnFull(ObservedPtr<CPDFSDK_Annot>* pAnnot,
               CPDFSDK_PageView* pPageView,
               uint32_t nFlag);
-  bool OnPreOpen(CPDFSDK_Annot::ObservedPtr* pAnnot,
+  bool OnPreOpen(ObservedPtr<CPDFSDK_Annot>* pAnnot,
                  CPDFSDK_PageView* pPageView,
                  uint32_t nFlag);
-  bool OnPostOpen(CPDFSDK_Annot::ObservedPtr* pAnnot,
+  bool OnPostOpen(ObservedPtr<CPDFSDK_Annot>* pAnnot,
                   CPDFSDK_PageView* pPageView,
                   uint32_t nFlag);
 #endif  // PDF_ENABLE_XFA
diff --git a/fpdfsdk/formfiller/cffl_listbox.cpp b/fpdfsdk/formfiller/cffl_listbox.cpp
index f2e5dc5..a90cac6 100644
--- a/fpdfsdk/formfiller/cffl_listbox.cpp
+++ b/fpdfsdk/formfiller/cffl_listbox.cpp
@@ -123,8 +123,8 @@
     m_pWidget->SetOptionSelection(pListBox->GetCurSel(), true,
                                   NotificationOption::kDoNotNotify);
   }
-  CPDFSDK_Widget::ObservedPtr observed_widget(m_pWidget.Get());
-  CFFL_ListBox::ObservedPtr observed_this(this);
+  ObservedPtr<CPDFSDK_Widget> observed_widget(m_pWidget.Get());
+  ObservedPtr<CFFL_ListBox> observed_this(this);
   m_pWidget->SetTopVisibleIndex(nNewTopIndex);
   if (!observed_widget)
     return;
diff --git a/fpdfsdk/formfiller/cffl_radiobutton.cpp b/fpdfsdk/formfiller/cffl_radiobutton.cpp
index 7c45af6..788db49 100644
--- a/fpdfsdk/formfiller/cffl_radiobutton.cpp
+++ b/fpdfsdk/formfiller/cffl_radiobutton.cpp
@@ -49,7 +49,7 @@
       CPDFSDK_PageView* pPageView = pAnnot->GetPageView();
       ASSERT(pPageView);
 
-      CPDFSDK_Annot::ObservedPtr pObserved(m_pWidget.Get());
+      ObservedPtr<CPDFSDK_Annot> pObserved(m_pWidget.Get());
       if (m_pFormFillEnv->GetInteractiveFormFiller()->OnButtonUp(
               &pObserved, pPageView, nFlags) ||
           !pObserved) {
@@ -103,8 +103,8 @@
       }
     }
   }
-  CPDFSDK_Widget::ObservedPtr observed_widget(m_pWidget.Get());
-  CFFL_RadioButton::ObservedPtr observed_this(this);
+  ObservedPtr<CPDFSDK_Widget> observed_widget(m_pWidget.Get());
+  ObservedPtr<CFFL_RadioButton> observed_this(this);
   m_pWidget->SetCheck(bNewChecked, NotificationOption::kDoNotNotify);
   if (!observed_widget)
     return;
diff --git a/fpdfsdk/formfiller/cffl_textfield.cpp b/fpdfsdk/formfiller/cffl_textfield.cpp
index b0ceef7..46a4fc1 100644
--- a/fpdfsdk/formfiller/cffl_textfield.cpp
+++ b/fpdfsdk/formfiller/cffl_textfield.cpp
@@ -141,8 +141,8 @@
 
   WideString sOldValue = m_pWidget->GetValue();
   WideString sNewValue = pWnd->GetText();
-  CPDFSDK_Widget::ObservedPtr observed_widget(m_pWidget.Get());
-  CFFL_TextField::ObservedPtr observed_this(this);
+  ObservedPtr<CPDFSDK_Widget> observed_widget(m_pWidget.Get());
+  ObservedPtr<CFFL_TextField> observed_this(this);
   m_pWidget->SetValue(sNewValue, NotificationOption::kDoNotNotify);
   if (!observed_widget)
     return;
diff --git a/fpdfsdk/formfiller/cffl_textobject.cpp b/fpdfsdk/formfiller/cffl_textobject.cpp
index a6b1308..676d407 100644
--- a/fpdfsdk/formfiller/cffl_textobject.cpp
+++ b/fpdfsdk/formfiller/cffl_textobject.cpp
@@ -16,7 +16,7 @@
   if (bRestoreValue)
     RestoreState(pPageView);
 
-  CPWL_Wnd::ObservedPtr pRet(GetPDFWindow(pPageView, !bRestoreValue));
+  ObservedPtr<CPWL_Wnd> pRet(GetPDFWindow(pPageView, !bRestoreValue));
   m_pWidget->UpdateField();  // May invoke JS, invalidating |pRet|.
   return pRet.Get();
 }
diff --git a/fpdfsdk/fpdfxfa/cpdfxfa_context.h b/fpdfsdk/fpdfxfa/cpdfxfa_context.h
index b52cd52..3f7780b 100644
--- a/fpdfsdk/fpdfxfa/cpdfxfa_context.h
+++ b/fpdfsdk/fpdfxfa/cpdfxfa_context.h
@@ -111,7 +111,7 @@
   FormType m_FormType = FormType::kNone;
   UnownedPtr<CPDF_Document> const m_pPDFDoc;
   std::unique_ptr<CXFA_FFDoc> m_pXFADoc;
-  Observable<CPDFSDK_FormFillEnvironment>::ObservedPtr m_pFormFillEnv;
+  ObservedPtr<CPDFSDK_FormFillEnvironment> m_pFormFillEnv;
   UnownedPtr<CXFA_FFDocView> m_pXFADocView;
   std::unique_ptr<CXFA_FFApp> const m_pXFAApp;
   std::unique_ptr<CJS_Runtime> m_pRuntime;
diff --git a/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp b/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp
index e12061a..dc76841 100644
--- a/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp
+++ b/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp
@@ -550,7 +550,7 @@
     return;
 
   if (!hWidget) {
-    CPDFSDK_Annot::ObservedPtr pNull;
+    ObservedPtr<CPDFSDK_Annot> pNull;
     m_pContext->GetFormFillEnv()->SetFocusAnnot(&pNull);
     return;
   }
@@ -561,7 +561,7 @@
     if (!pPageView)
       continue;
 
-    CPDFSDK_Annot::ObservedPtr pAnnot(pPageView->GetAnnotByXFAWidget(hWidget));
+    ObservedPtr<CPDFSDK_Annot> pAnnot(pPageView->GetAnnotByXFAWidget(hWidget));
     if (pAnnot) {
       m_pContext->GetFormFillEnv()->SetFocusAnnot(&pAnnot);
       break;
diff --git a/fpdfsdk/ipdfsdk_annothandler.h b/fpdfsdk/ipdfsdk_annothandler.h
index 77c7ef3..55920b1 100644
--- a/fpdfsdk/ipdfsdk_annothandler.h
+++ b/fpdfsdk/ipdfsdk_annothandler.h
@@ -56,42 +56,42 @@
   virtual void OnLoad(CPDFSDK_Annot* pAnnot) = 0;
 
   virtual void OnMouseEnter(CPDFSDK_PageView* pPageView,
-                            CPDFSDK_Annot::ObservedPtr* pAnnot,
+                            ObservedPtr<CPDFSDK_Annot>* pAnnot,
                             uint32_t nFlag) = 0;
   virtual void OnMouseExit(CPDFSDK_PageView* pPageView,
-                           CPDFSDK_Annot::ObservedPtr* pAnnot,
+                           ObservedPtr<CPDFSDK_Annot>* pAnnot,
                            uint32_t nFlag) = 0;
   virtual bool OnLButtonDown(CPDFSDK_PageView* pPageView,
-                             CPDFSDK_Annot::ObservedPtr* pAnnot,
+                             ObservedPtr<CPDFSDK_Annot>* pAnnot,
                              uint32_t nFlags,
                              const CFX_PointF& point) = 0;
   virtual bool OnLButtonUp(CPDFSDK_PageView* pPageView,
-                           CPDFSDK_Annot::ObservedPtr* pAnnot,
+                           ObservedPtr<CPDFSDK_Annot>* pAnnot,
                            uint32_t nFlags,
                            const CFX_PointF& point) = 0;
   virtual bool OnLButtonDblClk(CPDFSDK_PageView* pPageView,
-                               CPDFSDK_Annot::ObservedPtr* pAnnot,
+                               ObservedPtr<CPDFSDK_Annot>* pAnnot,
                                uint32_t nFlags,
                                const CFX_PointF& point) = 0;
   virtual bool OnMouseMove(CPDFSDK_PageView* pPageView,
-                           CPDFSDK_Annot::ObservedPtr* pAnnot,
+                           ObservedPtr<CPDFSDK_Annot>* pAnnot,
                            uint32_t nFlags,
                            const CFX_PointF& point) = 0;
   virtual bool OnMouseWheel(CPDFSDK_PageView* pPageView,
-                            CPDFSDK_Annot::ObservedPtr* pAnnot,
+                            ObservedPtr<CPDFSDK_Annot>* pAnnot,
                             uint32_t nFlags,
                             short zDelta,
                             const CFX_PointF& point) = 0;
   virtual bool OnRButtonDown(CPDFSDK_PageView* pPageView,
-                             CPDFSDK_Annot::ObservedPtr* pAnnot,
+                             ObservedPtr<CPDFSDK_Annot>* pAnnot,
                              uint32_t nFlags,
                              const CFX_PointF& point) = 0;
   virtual bool OnRButtonUp(CPDFSDK_PageView* pPageView,
-                           CPDFSDK_Annot::ObservedPtr* pAnnot,
+                           ObservedPtr<CPDFSDK_Annot>* pAnnot,
                            uint32_t nFlags,
                            const CFX_PointF& point) = 0;
   virtual bool OnRButtonDblClk(CPDFSDK_PageView* pPageView,
-                               CPDFSDK_Annot::ObservedPtr* pAnnot,
+                               ObservedPtr<CPDFSDK_Annot>* pAnnot,
                                uint32_t nFlags,
                                const CFX_PointF& point) = 0;
   virtual bool OnChar(CPDFSDK_Annot* pAnnot,
@@ -99,20 +99,20 @@
                       uint32_t nFlags) = 0;
   virtual bool OnKeyDown(CPDFSDK_Annot* pAnnot, int nKeyCode, int nFlag) = 0;
   virtual bool OnKeyUp(CPDFSDK_Annot* pAnnot, int nKeyCode, int nFlag) = 0;
-  virtual bool OnSetFocus(CPDFSDK_Annot::ObservedPtr* pAnnot,
+  virtual bool OnSetFocus(ObservedPtr<CPDFSDK_Annot>* pAnnot,
                           uint32_t nFlag) = 0;
-  virtual bool OnKillFocus(CPDFSDK_Annot::ObservedPtr* pAnnot,
+  virtual bool OnKillFocus(ObservedPtr<CPDFSDK_Annot>* pAnnot,
                            uint32_t nFlag) = 0;
 
-  virtual bool SetIndexSelected(CPDFSDK_Annot::ObservedPtr* pAnnot,
+  virtual bool SetIndexSelected(ObservedPtr<CPDFSDK_Annot>* pAnnot,
                                 int index,
                                 bool selected) = 0;
-  virtual bool IsIndexSelected(CPDFSDK_Annot::ObservedPtr* pAnnot,
+  virtual bool IsIndexSelected(ObservedPtr<CPDFSDK_Annot>* pAnnot,
                                int index) = 0;
 
 #ifdef PDF_ENABLE_XFA
-  virtual bool OnXFAChangedFocus(CPDFSDK_Annot::ObservedPtr* pOldAnnot,
-                                 CPDFSDK_Annot::ObservedPtr* pNewAnnot) = 0;
+  virtual bool OnXFAChangedFocus(ObservedPtr<CPDFSDK_Annot>* pOldAnnot,
+                                 ObservedPtr<CPDFSDK_Annot>* pNewAnnot) = 0;
 #endif  // PDF_ENABLE_XFA
 };
 
diff --git a/fpdfsdk/pwl/cpwl_combo_box.cpp b/fpdfsdk/pwl/cpwl_combo_box.cpp
index eefe017..aa434a7 100644
--- a/fpdfsdk/pwl/cpwl_combo_box.cpp
+++ b/fpdfsdk/pwl/cpwl_combo_box.cpp
@@ -342,8 +342,7 @@
 }
 
 bool CPWL_ComboBox::RePosChildWnd() {
-  ObservedPtr thisObserved(this);
-
+  ObservedPtr<CPWL_ComboBox> thisObserved(this);
   const CFX_FloatRect rcClient = GetClientRect();
   if (m_bPopup) {
     const float fOldWindowHeight = m_rcOldWindow.Height();
@@ -444,7 +443,7 @@
   if (!m_pFillerNotify)
     return true;
 
-  ObservedPtr thisObserved(this);
+  ObservedPtr<CPWL_ComboBox> thisObserved(this);
 
 #ifdef PDF_ENABLE_XFA
   if (m_pFillerNotify->OnPopupPreOpen(GetAttachedData(), 0))
diff --git a/fpdfsdk/pwl/cpwl_combo_box_embeddertest.cpp b/fpdfsdk/pwl/cpwl_combo_box_embeddertest.cpp
index 87715ee..855f894 100644
--- a/fpdfsdk/pwl/cpwl_combo_box_embeddertest.cpp
+++ b/fpdfsdk/pwl/cpwl_combo_box_embeddertest.cpp
@@ -56,7 +56,7 @@
     CFFL_InteractiveFormFiller* pInteractiveFormFiller =
         m_pFormFillEnv->GetInteractiveFormFiller();
     {
-      CPDFSDK_Annot::ObservedPtr pObserved(pAnnotCombobox);
+      ObservedPtr<CPDFSDK_Annot> pObserved(pAnnotCombobox);
       EXPECT_TRUE(pInteractiveFormFiller->OnSetFocus(&pObserved, 0));
     }
 
diff --git a/fpdfsdk/pwl/cpwl_edit.cpp b/fpdfsdk/pwl/cpwl_edit.cpp
index f4ce4e3..d006e55 100644
--- a/fpdfsdk/pwl/cpwl_edit.cpp
+++ b/fpdfsdk/pwl/cpwl_edit.cpp
@@ -46,8 +46,7 @@
         CFX_FloatRect(rcWindow.right, rcWindow.bottom,
                       rcWindow.right + PWL_SCROLLBAR_WIDTH, rcWindow.top);
 
-    ObservedPtr thisObserved(this);
-
+    ObservedPtr<CPWL_Edit> thisObserved(this);
     pVSB->Move(rcVScroll, true, false);
     if (!thisObserved)
       return false;
@@ -290,7 +289,7 @@
 }
 
 void CPWL_Edit::OnSetFocus() {
-  ObservedPtr observed_ptr(this);
+  ObservedPtr<CPWL_Edit> observed_ptr(this);
   SetEditCaret(true);
   if (!observed_ptr)
     return;
@@ -306,8 +305,7 @@
 }
 
 void CPWL_Edit::OnKillFocus() {
-  ObservedPtr observed_ptr(this);
-
+  ObservedPtr<CPWL_Edit> observed_ptr(this);
   CPWL_ScrollBar* pScroll = GetVScrollBar();
   if (pScroll && pScroll->IsVisible()) {
     pScroll->SetVisible(false);
@@ -437,7 +435,7 @@
       if (nSelStart == nSelEnd)
         nSelEnd = nSelStart + 1;
 
-      CPWL_Wnd::ObservedPtr thisObserved(this);
+      ObservedPtr<CPWL_Wnd> thisObserved(this);
 
       bool bRC;
       bool bExit;
@@ -520,7 +518,7 @@
           break;
       }
 
-      CPWL_Wnd::ObservedPtr thisObserved(this);
+      ObservedPtr<CPWL_Wnd> thisObserved(this);
 
       WideString strChangeEx;
       std::tie(bRC, bExit) = m_pFillerNotify->OnBeforeKeyStroke(
diff --git a/fpdfsdk/pwl/cpwl_edit_ctrl.cpp b/fpdfsdk/pwl/cpwl_edit_ctrl.cpp
index abda919..818e476 100644
--- a/fpdfsdk/pwl/cpwl_edit_ctrl.cpp
+++ b/fpdfsdk/pwl/cpwl_edit_ctrl.cpp
@@ -331,7 +331,7 @@
   if (!IsFocused() || m_pEdit->IsSelected())
     bVisible = false;
 
-  ObservedPtr thisObserved(this);
+  ObservedPtr<CPWL_EditCtrl> thisObserved(this);
   m_pEditCaret->SetCaret(bVisible, ptHead, ptFoot);
   if (!thisObserved)
     return false;
diff --git a/fpdfsdk/pwl/cpwl_edit_embeddertest.cpp b/fpdfsdk/pwl/cpwl_edit_embeddertest.cpp
index f470c53..ea8092a 100644
--- a/fpdfsdk/pwl/cpwl_edit_embeddertest.cpp
+++ b/fpdfsdk/pwl/cpwl_edit_embeddertest.cpp
@@ -56,7 +56,7 @@
     CFFL_InteractiveFormFiller* pInteractiveFormFiller =
         m_pFormFillEnv->GetInteractiveFormFiller();
     {
-      CPDFSDK_Annot::ObservedPtr pObserved(pAnnotTextField);
+      ObservedPtr<CPDFSDK_Annot> pObserved(pAnnotTextField);
       EXPECT_TRUE(pInteractiveFormFiller->OnSetFocus(&pObserved, 0));
     }
 
diff --git a/fpdfsdk/pwl/cpwl_list_box.cpp b/fpdfsdk/pwl/cpwl_list_box.cpp
index 2d2c439..6b9f837 100644
--- a/fpdfsdk/pwl/cpwl_list_box.cpp
+++ b/fpdfsdk/pwl/cpwl_list_box.cpp
@@ -254,7 +254,7 @@
   if (!m_pFillerNotify)
     return false;
 
-  CPWL_Wnd::ObservedPtr thisObserved(this);
+  ObservedPtr<CPWL_Wnd> thisObserved(this);
 
   WideString swChange = GetText();
   WideString strChangeEx;
diff --git a/fpdfsdk/pwl/cpwl_scroll_bar.cpp b/fpdfsdk/pwl/cpwl_scroll_bar.cpp
index d3c8e84..14e977b 100644
--- a/fpdfsdk/pwl/cpwl_scroll_bar.cpp
+++ b/fpdfsdk/pwl/cpwl_scroll_bar.cpp
@@ -370,20 +370,17 @@
       break;
   }
 
-  ObservedPtr thisObserved(this);
-
+  ObservedPtr<CPWL_ScrollBar> thisObserved(this);
   if (m_pMinButton) {
     m_pMinButton->Move(rcMinButton, true, false);
     if (!thisObserved)
       return false;
   }
-
   if (m_pMaxButton) {
     m_pMaxButton->Move(rcMaxButton, true, false);
     if (!thisObserved)
       return false;
   }
-
   if (!MovePosButton(false))
     return false;
 
@@ -558,7 +555,7 @@
     auto pButton = pdfium::MakeUnique<CPWL_SBButton>(scp, CloneAttachedData(),
                                                      m_sbType, PSBT_POS);
     m_pPosButton = pButton.get();
-    ObservedPtr thisObserved(this);
+    ObservedPtr<CPWL_ScrollBar> thisObserved(this);
     if (m_pPosButton->SetVisible(false) && thisObserved) {
       AddChild(std::move(pButton));
       m_pPosButton->Realize();
@@ -579,11 +576,10 @@
   if (!m_pPosButton)
     return;
 
+  ObservedPtr<CPWL_ScrollBar> thisObserved(this);
   m_sData.SetScrollRange(fMin, fMax);
   m_sData.SetClientWidth(fClientWidth);
 
-  ObservedPtr thisObserved(this);
-
   if (IsFloatSmaller(m_sData.ScrollRange.GetWidth(), 0.0f)) {
     m_pPosButton->SetVisible(false);
     // Note, |this| may no longer be viable at this point. If more work needs
@@ -662,8 +658,7 @@
         break;
     }
 
-    ObservedPtr thisObserved(this);
-
+    ObservedPtr<CPWL_ScrollBar> thisObserved(this);
     m_pPosButton->Move(rcPosButton, true, bRefresh);
     if (!thisObserved)
       return false;
diff --git a/fpdfsdk/pwl/cpwl_wnd.cpp b/fpdfsdk/pwl/cpwl_wnd.cpp
index f2995c4..4805ff2 100644
--- a/fpdfsdk/pwl/cpwl_wnd.cpp
+++ b/fpdfsdk/pwl/cpwl_wnd.cpp
@@ -28,7 +28,7 @@
 
 CPWL_Wnd::CreateParams::~CreateParams() = default;
 
-class CPWL_MsgControl final : public Observable<CPWL_MsgControl> {
+class CPWL_MsgControl final : public Observable {
  public:
   explicit CPWL_MsgControl(CPWL_Wnd* pWnd) : m_pCreatedWnd(pWnd) {}
   ~CPWL_MsgControl() {}
@@ -65,7 +65,7 @@
   }
 
   void KillFocus() {
-    ObservedPtr observed_ptr(this);
+    ObservedPtr<CPWL_MsgControl> observed_ptr(this);
     if (!m_aKeyboardPath.empty())
       if (CPWL_Wnd* pWnd = m_aKeyboardPath[0])
         pWnd->OnKillFocus();
@@ -239,13 +239,13 @@
     if (!IsValid())
     return true;
 
-  ObservedPtr thisObserved(this);
-  CFX_FloatRect rcRefresh = pRect ? *pRect : GetWindowRect();
-  if (!HasFlag(PWS_NOREFRESHCLIP)) {
-    CFX_FloatRect rcClip = GetClipRect();
-    if (!rcClip.IsEmpty())
-      rcRefresh.Intersect(rcClip);
-  }
+    ObservedPtr<CPWL_Wnd> thisObserved(this);
+    CFX_FloatRect rcRefresh = pRect ? *pRect : GetWindowRect();
+    if (!HasFlag(PWS_NOREFRESHCLIP)) {
+      CFX_FloatRect rcClip = GetClipRect();
+      if (!rcClip.IsEmpty())
+        rcRefresh.Intersect(rcClip);
+    }
 
   CFX_FloatRect rcWin = PWLtoWnd(rcRefresh);
   rcWin.Inflate(1, 1);
@@ -531,7 +531,7 @@
   if (!IsValid())
     return true;
 
-  ObservedPtr thisObserved(this);
+  ObservedPtr<CPWL_Wnd> thisObserved(this);
   for (const auto& pChild : m_Children) {
     pChild->SetVisible(bVisible);
     if (!thisObserved)
@@ -577,8 +577,7 @@
       CFX_FloatRect(rcContent.right - PWL_SCROLLBAR_WIDTH, rcContent.bottom,
                     rcContent.right - 1.0f, rcContent.top);
 
-  ObservedPtr thisObserved(this);
-
+  ObservedPtr<CPWL_Wnd> thisObserved(this);
   pVSB->Move(rcVScroll, true, false);
   if (!thisObserved)
     return false;
diff --git a/fpdfsdk/pwl/cpwl_wnd.h b/fpdfsdk/pwl/cpwl_wnd.h
index 6eea536..c174b90 100644
--- a/fpdfsdk/pwl/cpwl_wnd.h
+++ b/fpdfsdk/pwl/cpwl_wnd.h
@@ -93,7 +93,7 @@
 #define PWL_DEFAULT_BLACKCOLOR CFX_Color(CFX_Color::kGray, 0)
 #define PWL_DEFAULT_WHITECOLOR CFX_Color(CFX_Color::kGray, 1)
 
-class CPWL_Wnd : public CPWL_TimerHandler, public Observable<CPWL_Wnd> {
+class CPWL_Wnd : public CPWL_TimerHandler, public Observable {
  public:
   class PrivateData {
    public:
@@ -101,7 +101,7 @@
     virtual std::unique_ptr<PrivateData> Clone() const = 0;
   };
 
-  class ProviderIface : public Observable<ProviderIface> {
+  class ProviderIface : public Observable {
    public:
     virtual ~ProviderIface() = default;
 
@@ -124,11 +124,11 @@
     CFX_FloatRect rcRectWnd;                          // required
     UnownedPtr<CFX_SystemHandler> pSystemHandler;     // required
     UnownedPtr<IPVT_FontMap> pFontMap;                // required
-    ProviderIface::ObservedPtr pProvider;             // required
+    ObservedPtr<ProviderIface> pProvider;             // required
     UnownedPtr<FocusHandlerIface> pFocusHandler;      // optional
     uint32_t dwFlags = 0;                             // optional
     CFX_Color sBackgroundColor;                       // optional
-    CPDFSDK_Widget::ObservedPtr pAttachedWidget;      // required
+    ObservedPtr<CPDFSDK_Widget> pAttachedWidget;      // required
     BorderStyle nBorderStyle = BorderStyle::SOLID;    // optional
     int32_t dwBorderWidth = 1;                        // optional
     CFX_Color sBorderColor;                           // optional
diff --git a/fxjs/cjs_annot.h b/fxjs/cjs_annot.h
index 2ddc448..ceb2615 100644
--- a/fxjs/cjs_annot.h
+++ b/fxjs/cjs_annot.h
@@ -40,7 +40,7 @@
   CJS_Result get_type(CJS_Runtime* pRuntime);
   CJS_Result set_type(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp);
 
-  CPDFSDK_Annot::ObservedPtr m_pAnnot;
+  ObservedPtr<CPDFSDK_Annot> m_pAnnot;
 };
 
 #endif  // FXJS_CJS_ANNOT_H_
diff --git a/fxjs/cjs_document.cpp b/fxjs/cjs_document.cpp
index 133ec43..4fc8803 100644
--- a/fxjs/cjs_document.cpp
+++ b/fxjs/cjs_document.cpp
@@ -531,7 +531,7 @@
 
   WideString sFieldName = pRuntime->ToWideString(params[0]);
   CPDFSDK_InteractiveForm* pInteractiveForm = GetSDKInteractiveForm();
-  std::vector<CPDFSDK_Annot::ObservedPtr> widgets;
+  std::vector<ObservedPtr<CPDFSDK_Annot>> widgets;
   pInteractiveForm->GetWidgets(sFieldName, &widgets);
   if (widgets.empty())
     return CJS_Result::Success();
diff --git a/fxjs/cjs_document.h b/fxjs/cjs_document.h
index 0ba57f6..49448fc 100644
--- a/fxjs/cjs_document.h
+++ b/fxjs/cjs_document.h
@@ -20,7 +20,7 @@
 class CPDF_TextObject;
 struct CJS_DelayData;
 
-class CJS_Document final : public CJS_Object, public Observable<CJS_Document> {
+class CJS_Document final : public CJS_Object, public Observable {
  public:
   static int GetObjDefnID();
   static void DefineJSObjects(CFXJS_Engine* pEngine);
@@ -311,7 +311,7 @@
   CPDFSDK_InteractiveForm* GetSDKInteractiveForm();
 
   WideString m_cwBaseURL;
-  CPDFSDK_FormFillEnvironment::ObservedPtr m_pFormFillEnv;
+  ObservedPtr<CPDFSDK_FormFillEnvironment> m_pFormFillEnv;
   std::list<std::unique_ptr<CJS_DelayData>> m_DelayData;
   // Needs to be a std::list for iterator stability.
   std::list<WideString> m_IconNames;
diff --git a/fxjs/cjs_eventrecorder.h b/fxjs/cjs_eventrecorder.h
index 5d52edc..83be14d 100644
--- a/fxjs/cjs_eventrecorder.h
+++ b/fxjs/cjs_eventrecorder.h
@@ -196,8 +196,8 @@
   bool m_bRcDu = false;
   UnownedPtr<bool> m_pbRc;
   UnownedPtr<CPDF_Bookmark> m_pTargetBookMark;
-  CPDFSDK_FormFillEnvironment::ObservedPtr m_pTargetFormFillEnv;
-  CPDFSDK_Annot::ObservedPtr m_pTargetAnnot;
+  ObservedPtr<CPDFSDK_FormFillEnvironment> m_pTargetFormFillEnv;
+  ObservedPtr<CPDFSDK_Annot> m_pTargetAnnot;
 };
 
 #endif  // FXJS_CJS_EVENTRECORDER_H_
diff --git a/fxjs/cjs_field.cpp b/fxjs/cjs_field.cpp
index 6cd3f4e..dd3dd02 100644
--- a/fxjs/cjs_field.cpp
+++ b/fxjs/cjs_field.cpp
@@ -52,7 +52,7 @@
   CPDFSDK_InteractiveForm* pForm = pFormFillEnv->GetInteractiveForm();
 
   if (bResetAP) {
-    std::vector<CPDFSDK_Annot::ObservedPtr> widgets;
+    std::vector<ObservedPtr<CPDFSDK_Annot>> widgets;
     pForm->GetWidgets(pFormField, &widgets);
 
     if (IsComboBoxOrTextField(pFormField)) {
@@ -77,7 +77,7 @@
     // Refresh the widget list. The calls in |bResetAP| may have caused widgets
     // to be removed from the list. We need to call |GetWidgets| again to be
     // sure none of the widgets have been deleted.
-    std::vector<CPDFSDK_Annot::ObservedPtr> widgets;
+    std::vector<ObservedPtr<CPDFSDK_Annot>> widgets;
     pForm->GetWidgets(pFormField, &widgets);
 
     // TODO(dsinclair): Determine if all widgets share the same
@@ -107,7 +107,7 @@
   CPDFSDK_Widget* pWidget = pForm->GetWidget(pFormControl);
 
   if (pWidget) {
-    CPDFSDK_Widget::ObservedPtr observed_widget(pWidget);
+    ObservedPtr<CPDFSDK_Widget> observed_widget(pWidget);
     if (bResetAP) {
       FormFieldType fieldType = pWidget->GetFieldType();
       if (fieldType == FormFieldType::kComboBox ||
@@ -1515,7 +1515,7 @@
   if (!pFormField)
     return CJS_Result::Failure(JSMessage::kBadObjectError);
 
-  std::vector<CPDFSDK_Annot::ObservedPtr> widgets;
+  std::vector<ObservedPtr<CPDFSDK_Annot>> widgets;
   m_pFormFillEnv->GetInteractiveForm()->GetWidgets(pFormField, &widgets);
   if (widgets.empty())
     return CJS_Result::Success(pRuntime->NewNumber(-1));
@@ -2526,7 +2526,7 @@
   }
 
   if (pWidget) {
-    CPDFSDK_Annot::ObservedPtr pObserved(pWidget);
+    ObservedPtr<CPDFSDK_Annot> pObserved(pWidget);
     m_pFormFillEnv->SetFocusAnnot(&pObserved);
   }
 
diff --git a/fxjs/cjs_field.h b/fxjs/cjs_field.h
index 45d0f06..823a6a0 100644
--- a/fxjs/cjs_field.h
+++ b/fxjs/cjs_field.h
@@ -368,8 +368,8 @@
 
   void DoDelay();
 
-  CJS_Document::ObservedPtr m_pJSDoc;
-  CPDFSDK_FormFillEnvironment::ObservedPtr m_pFormFillEnv;
+  ObservedPtr<CJS_Document> m_pJSDoc;
+  ObservedPtr<CPDFSDK_FormFillEnvironment> m_pFormFillEnv;
   WideString m_FieldName;
   int m_nFormControlIndex = -1;
   bool m_bCanSet = false;
diff --git a/fxjs/cjs_global.h b/fxjs/cjs_global.h
index 6491bbf..b01a74f 100644
--- a/fxjs/cjs_global.h
+++ b/fxjs/cjs_global.h
@@ -82,7 +82,7 @@
   std::map<ByteString, std::unique_ptr<JSGlobalData>> m_MapGlobal;
   WideString m_sFilePath;
   CFX_GlobalData* m_pGlobalData;
-  CPDFSDK_FormFillEnvironment::ObservedPtr m_pFormFillEnv;
+  ObservedPtr<CPDFSDK_FormFillEnvironment> m_pFormFillEnv;
 };
 
 #endif  // FXJS_CJS_GLOBAL_H_
diff --git a/fxjs/cjs_object.h b/fxjs/cjs_object.h
index 791d589..5da72ff 100644
--- a/fxjs/cjs_object.h
+++ b/fxjs/cjs_object.h
@@ -55,7 +55,7 @@
  private:
   UnownedPtr<v8::Isolate> m_pIsolate;
   v8::Global<v8::Object> m_pV8Object;
-  CJS_Runtime::ObservedPtr m_pRuntime;
+  ObservedPtr<CJS_Runtime> m_pRuntime;
 };
 
 #endif  // FXJS_CJS_OBJECT_H_
diff --git a/fxjs/cjs_runtime.h b/fxjs/cjs_runtime.h
index b03bea1..55eb766 100644
--- a/fxjs/cjs_runtime.h
+++ b/fxjs/cjs_runtime.h
@@ -22,7 +22,7 @@
 
 class CJS_Runtime final : public IJS_Runtime,
                           public CFXJS_Engine,
-                          public Observable<CJS_Runtime> {
+                          public Observable {
  public:
   using FieldEvent = std::pair<WideString, JS_EVENT_T>;
 
@@ -63,7 +63,7 @@
   void SetFormFillEnvToDocument();
 
   std::vector<std::unique_ptr<CJS_EventContext>> m_EventContextArray;
-  CPDFSDK_FormFillEnvironment::ObservedPtr m_pFormFillEnv;
+  ObservedPtr<CPDFSDK_FormFillEnvironment> m_pFormFillEnv;
   bool m_bBlocking = false;
   bool m_isolateManaged = false;
   std::set<FieldEvent> m_FieldEventSet;
diff --git a/fxjs/global_timer.h b/fxjs/global_timer.h
index 8c63ceb..0b8e8aa 100644
--- a/fxjs/global_timer.h
+++ b/fxjs/global_timer.h
@@ -48,8 +48,8 @@
   const Type m_nType;
   const uint32_t m_dwTimeOut;
   const WideString m_swJScript;
-  CJS_Runtime::ObservedPtr m_pRuntime;
-  CPDFSDK_FormFillEnvironment::ObservedPtr m_pFormFillEnv;
+  ObservedPtr<CJS_Runtime> m_pRuntime;
+  ObservedPtr<CPDFSDK_FormFillEnvironment> m_pFormFillEnv;
 };
 
 #endif  // FXJS_GLOBAL_TIMER_H_
diff --git a/xfa/fgas/font/cfgas_fontmgr.h b/xfa/fgas/font/cfgas_fontmgr.h
index b8eca58..ff2050b 100644
--- a/xfa/fgas/font/cfgas_fontmgr.h
+++ b/xfa/fgas/font/cfgas_fontmgr.h
@@ -96,7 +96,7 @@
 
 #endif  // defined(OS_WIN)
 
-class CFGAS_FontMgr final : public Observable<CFGAS_FontMgr> {
+class CFGAS_FontMgr final : public Observable {
  public:
   CFGAS_FontMgr();
   ~CFGAS_FontMgr();
diff --git a/xfa/fgas/font/cfgas_gefont.h b/xfa/fgas/font/cfgas_gefont.h
index 76b02a9..6b6e417 100644
--- a/xfa/fgas/font/cfgas_gefont.h
+++ b/xfa/fgas/font/cfgas_gefont.h
@@ -74,7 +74,7 @@
 
   Optional<uint32_t> m_dwLogFontStyle;
   MaybeOwned<CFX_Font> m_pFont;  // Must come before |m_pFontEncoding|.
-  CFGAS_FontMgr::ObservedPtr const m_pFontMgr;
+  ObservedPtr<CFGAS_FontMgr> const m_pFontMgr;
   std::unique_ptr<CFX_UnicodeEncodingEx> m_pFontEncoding;
   std::map<wchar_t, int32_t> m_CharWidthMap;
   std::map<wchar_t, FX_RECT> m_BBoxMap;
diff --git a/xfa/fgas/font/cfgas_pdffontmgr.h b/xfa/fgas/font/cfgas_pdffontmgr.h
index e1b09c1..f9c56fc 100644
--- a/xfa/fgas/font/cfgas_pdffontmgr.h
+++ b/xfa/fgas/font/cfgas_pdffontmgr.h
@@ -17,7 +17,7 @@
 class CFGAS_GEFont;
 class CPDF_Document;
 
-class CFGAS_PDFFontMgr final : public Observable<CFGAS_PDFFontMgr> {
+class CFGAS_PDFFontMgr final : public Observable {
  public:
   explicit CFGAS_PDFFontMgr(CPDF_Document* pDoc, CFGAS_FontMgr* pFontMgr);
   ~CFGAS_PDFFontMgr();