Move all* protected members in RenderWidget to be private or public

All data members are moved to be private. Most methods are as well.
A few methods are virtual to be overridden by subclasses (ie
RenderWidgetFullscreenPepper), so they stay protected. And a few
accessors are added or methods moved to be public as they are actually
called from outside the class.

Things used during RenderViewImpl initialization are left in protected
as this is a temporary state and initialization is Not Addressed Here.

If only called in tests, then the power of friendship is used to access
them instead of public.

[email protected], [email protected]

Bug: 419087
Change-Id: I5a215417945aca4c3725ebc6e1561a939e6816aa
Reviewed-on: https://chromium-review.googlesource.com/1144424
Commit-Queue: danakj <[email protected]>
Reviewed-by: Albert J. Wong <[email protected]>
Reviewed-by: Avi Drissman <[email protected]>
Cr-Commit-Position: refs/heads/master@{#578080}
diff --git a/content/renderer/render_widget.cc b/content/renderer/render_widget.cc
index fc5366e1..e2f4005 100644
--- a/content/renderer/render_widget.cc
+++ b/content/renderer/render_widget.cc
@@ -661,8 +661,12 @@
   RenderProcess::current()->ReleaseProcess();
 }
 
-void RenderWidget::SetPopupOriginAdjustmentsForEmulation(
-    RenderWidgetScreenMetricsEmulator* emulator) {
+void RenderWidget::ApplyEmulatedScreenMetricsForPopupWidget(
+    RenderWidget* origin_widget) {
+  RenderWidgetScreenMetricsEmulator* emulator =
+      origin_widget->screen_metrics_emulator_.get();
+  if (!emulator)
+    return;
   popup_origin_scale_for_emulation_ = emulator->scale();
   popup_view_origin_for_emulation_ = emulator->applied_widget_rect().origin();
   popup_screen_origin_for_emulation_ =
@@ -1588,6 +1592,10 @@
   return nullptr;
 }
 
+void RenderWidget::SetHandlingInputEvent(bool handling_input_event) {
+  input_handler_->set_handling_input_event(handling_input_event);
+}
+
 void RenderWidget::QueueMessage(IPC::Message* msg,
                                 MessageDeliveryPolicy policy) {
   // RenderThreadImpl::current() is NULL in some tests.
@@ -2022,14 +2030,6 @@
   Send(new ViewHostMsg_UpdateScreenRects_ACK(routing_id()));
 }
 
-void RenderWidget::OnUpdateWindowScreenRect(
-    const gfx::Rect& window_screen_rect) {
-  if (screen_metrics_emulator_)
-    screen_metrics_emulator_->OnUpdateWindowScreenRect(window_screen_rect);
-  else
-    window_screen_rect_ = window_screen_rect;
-}
-
 void RenderWidget::OnSetViewportIntersection(
     const gfx::Rect& viewport_intersection,
     const gfx::Rect& compositor_visible_rect) {
@@ -3042,6 +3042,7 @@
 }
 
 void RenderWidget::OnWaitNextFrameForTests(int routing_id) {
+  // Sends an ACK to the browser process during the next compositor frame.
   QueueMessage(new ViewHostMsg_WaitForNextFrameForTests_ACK(routing_id),
                MESSAGE_DELIVERY_POLICY_WITH_VISUAL_STATE);
 }
@@ -3145,13 +3146,20 @@
   }
 }
 
+void RenderWidget::SetWindowScreenRect(const gfx::Rect& window_screen_rect) {
+  if (screen_metrics_emulator_)
+    screen_metrics_emulator_->OnUpdateWindowScreenRect(window_screen_rect);
+  else
+    window_screen_rect_ = window_screen_rect;
+}
+
 bool RenderWidget::IsSurfaceSynchronizationEnabled() const {
   return layer_tree_view_ &&
          layer_tree_view_->IsSurfaceSynchronizationEnabled();
 }
 
-void RenderWidget::SetHandlingInputEventForTesting(bool handling_input_event) {
-  input_handler_->set_handling_input_event(handling_input_event);
+void RenderWidget::UseSynchronousResizeModeForTesting(bool enable) {
+  resizing_mode_selector_->set_is_synchronous_mode(enable);
 }
 
 void RenderWidget::SetDeviceScaleFactorForTesting(float factor) {