Remove friends from PWL classes

This CL removes the friend entries from the various pwl/ classes.

Change-Id: Ib93a2bedcde521eb92e53580b5d7cd9bca08902f
Reviewed-on: https://pdfium-review.googlesource.com/16150
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
diff --git a/fpdfsdk/pwl/cpwl_edit_impl.h b/fpdfsdk/pwl/cpwl_edit_impl.h
index 11edae6..387f6e7 100644
--- a/fpdfsdk/pwl/cpwl_edit_impl.h
+++ b/fpdfsdk/pwl/cpwl_edit_impl.h
@@ -362,17 +362,22 @@
                               uint16_t Word,
                               uint16_t SubWord);
 
- private:
-  friend class CPWL_EditImpl_Iterator;
-  friend class CFXEU_InsertWord;
-  friend class CFXEU_InsertReturn;
-  friend class CFXEU_Backspace;
-  friend class CFXEU_Delete;
-  friend class CFXEU_Clear;
-  friend class CFXEU_InsertText;
-
   void SetSelection(const CPVT_WordPlace& begin, const CPVT_WordPlace& end);
 
+  bool Delete(bool bAddUndo, bool bPaint);
+  bool Clear(bool bAddUndo, bool bPaint);
+  bool InsertText(const WideString& sText,
+                  int32_t charset,
+                  bool bAddUndo,
+                  bool bPaint);
+  bool InsertWord(uint16_t word, int32_t charset, bool bAddUndo, bool bPaint);
+  bool InsertReturn(bool bAddUndo, bool bPaint);
+  bool Backspace(bool bAddUndo, bool bPaint);
+  void SetCaret(const CPVT_WordPlace& place);
+
+  CFX_PointF VTToEdit(const CFX_PointF& point) const;
+
+ private:
   void RearrangeAll();
   void RearrangePart(const CPVT_WordRange& range);
   void ScrollToCaret();
@@ -382,35 +387,20 @@
   void SetScrollLimit();
   void SetContentChanged();
 
-  bool InsertWord(uint16_t word,
-                  int32_t charset,
-                  bool bAddUndo,
-                  bool bPaint);
-  bool InsertReturn(bool bAddUndo, bool bPaint);
-  bool Backspace(bool bAddUndo, bool bPaint);
-  bool Delete(bool bAddUndo, bool bPaint);
-  bool Clear(bool bAddUndo, bool bPaint);
-  bool InsertText(const WideString& sText,
-                  int32_t charset,
-                  bool bAddUndo,
-                  bool bPaint);
   void PaintInsertText(const CPVT_WordPlace& wpOld,
                        const CPVT_WordPlace& wpNew);
 
-  inline CFX_PointF VTToEdit(const CFX_PointF& point) const;
-  inline CFX_PointF EditToVT(const CFX_PointF& point) const;
-  inline CFX_FloatRect VTToEdit(const CFX_FloatRect& rect) const;
+  CFX_PointF EditToVT(const CFX_PointF& point) const;
+  CFX_FloatRect VTToEdit(const CFX_FloatRect& rect) const;
 
   void Refresh();
   void RefreshPushLineRects(const CPVT_WordRange& wr);
 
-  void SetCaret(const CPVT_WordPlace& place);
   void SetCaretInfo();
   void SetCaretOrigin();
 
   void AddEditUndoItem(std::unique_ptr<IFX_Edit_UndoItem> pEditUndoItem);
 
- private:
   std::unique_ptr<CPDF_VariableText> m_pVT;
   UnownedPtr<CPWL_EditCtrl> m_pNotify;
   UnownedPtr<CPWL_Edit> m_pOperationNotify;
diff --git a/fpdfsdk/pwl/cpwl_wnd.cpp b/fpdfsdk/pwl/cpwl_wnd.cpp
index ec605a3..368db74 100644
--- a/fpdfsdk/pwl/cpwl_wnd.cpp
+++ b/fpdfsdk/pwl/cpwl_wnd.cpp
@@ -47,31 +47,14 @@
 CPWL_Wnd::CreateParams::~CreateParams() = default;
 
 class CPWL_MsgControl : public Observable<CPWL_MsgControl> {
-  friend class CPWL_Wnd;
-
  public:
-  explicit CPWL_MsgControl(CPWL_Wnd* pWnd) {
-    m_pCreatedWnd = pWnd;
-    Default();
-  }
-
-  ~CPWL_MsgControl() { Default(); }
-
-  void Default() {
-    m_aMousePath.clear();
-    m_aKeyboardPath.clear();
-    m_pMainMouseWnd = nullptr;
-    m_pMainKeyboardWnd = nullptr;
-  }
+  explicit CPWL_MsgControl(CPWL_Wnd* pWnd) : m_pCreatedWnd(pWnd) {}
+  ~CPWL_MsgControl() {}
 
   bool IsWndCreated(const CPWL_Wnd* pWnd) const {
     return m_pCreatedWnd == pWnd;
   }
 
-  bool IsMainCaptureMouse(const CPWL_Wnd* pWnd) const {
-    return pWnd == m_pMainMouseWnd;
-  }
-
   bool IsWndCaptureMouse(const CPWL_Wnd* pWnd) const {
     return pWnd && pdfium::ContainsValue(m_aMousePath, pWnd);
   }
@@ -114,7 +97,6 @@
   void SetCapture(CPWL_Wnd* pWnd) {
     m_aMousePath.clear();
     if (pWnd) {
-      m_pMainMouseWnd = pWnd;
       CPWL_Wnd* pParent = pWnd;
       while (pParent) {
         m_aMousePath.push_back(pParent);
@@ -124,15 +106,15 @@
   }
 
   void ReleaseCapture() {
-    m_pMainMouseWnd = nullptr;
     m_aMousePath.clear();
   }
 
+  CPWL_Wnd* GetFocusedWindow() const { return m_pMainKeyboardWnd.Get(); }
+
  private:
   std::vector<CPWL_Wnd*> m_aMousePath;
   std::vector<CPWL_Wnd*> m_aKeyboardPath;
   UnownedPtr<CPWL_Wnd> m_pCreatedWnd;
-  UnownedPtr<CPWL_Wnd> m_pMainMouseWnd;
   UnownedPtr<CPWL_Wnd> m_pMainKeyboardWnd;
 };
 
@@ -804,7 +786,7 @@
 
 const CPWL_Wnd* CPWL_Wnd::GetFocused() const {
   CPWL_MsgControl* pMsgCtrl = GetMsgControl();
-  return pMsgCtrl ? pMsgCtrl->m_pMainKeyboardWnd.Get() : nullptr;
+  return pMsgCtrl ? pMsgCtrl->GetFocusedWindow() : nullptr;
 }
 
 void CPWL_Wnd::EnableWindow(bool bEnable) {
diff --git a/fpdfsdk/pwl/cpwl_wnd.h b/fpdfsdk/pwl/cpwl_wnd.h
index a9a434d..ba52420 100644
--- a/fpdfsdk/pwl/cpwl_wnd.h
+++ b/fpdfsdk/pwl/cpwl_wnd.h
@@ -249,9 +249,10 @@
   void SetChildMatrix(const CFX_Matrix& mt);
   CFX_Matrix GetWindowMatrix() const;
 
- protected:
-  friend class CPWL_MsgControl;
+  virtual void OnSetFocus();
+  virtual void OnKillFocus();
 
+ protected:
   // CPWL_TimerHandler
   CFX_SystemHandler* GetSystemHandler() const override;
 
@@ -267,9 +268,6 @@
   virtual void OnCreated();
   virtual void OnDestroy();
 
-  virtual void OnSetFocus();
-  virtual void OnKillFocus();
-
   void SetNotifyFlag(bool bNotifying = true) { m_bNotifying = bNotifying; }
   bool IsNotifying() const { return m_bNotifying; }
   bool IsValid() const { return m_bCreated; }