cros: Move some *View classes into *Handler files

- KioskEnableScreenView
- MarketingOptInScreenView
- WrongHwidScreenView
- SyncConsentScreenView

Also remove the Delegate classes on the moved views where applicable.

Bug: 928555
Change-Id: Ia833a286b49dda8af7c93f7b5aacebe239f021d6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1572539
Commit-Queue: Jacob Dufault <jdufault@chromium.org>
Reviewed-by: Alexander Alekseev <alemate@chromium.org>
Cr-Commit-Position: refs/heads/master@{#652630}
diff --git a/chrome/browser/chromeos/BUILD.gn b/chrome/browser/chromeos/BUILD.gn
index bc294d0..61579d0 100644
--- a/chrome/browser/chromeos/BUILD.gn
+++ b/chrome/browser/chromeos/BUILD.gn
@@ -1295,16 +1295,13 @@
     "login/screens/gaia_screen.h",
     "login/screens/hid_detection_screen.cc",
     "login/screens/hid_detection_screen.h",
-    "login/screens/hid_detection_view.h",
     "login/screens/kiosk_autolaunch_screen.cc",
     "login/screens/kiosk_autolaunch_screen.h",
     "login/screens/kiosk_autolaunch_screen_view.h",
     "login/screens/kiosk_enable_screen.cc",
     "login/screens/kiosk_enable_screen.h",
-    "login/screens/kiosk_enable_screen_view.h",
     "login/screens/marketing_opt_in_screen.cc",
     "login/screens/marketing_opt_in_screen.h",
-    "login/screens/marketing_opt_in_screen_view.h",
     "login/screens/multidevice_setup_screen.cc",
     "login/screens/multidevice_setup_screen.h",
     "login/screens/multidevice_setup_screen_view.h",
@@ -1321,7 +1318,6 @@
     "login/screens/recommend_apps/recommend_apps_fetcher_impl.h",
     "login/screens/recommend_apps_screen.cc",
     "login/screens/recommend_apps_screen.h",
-    "login/screens/recommend_apps_screen_view.h",
     "login/screens/reset_screen.cc",
     "login/screens/reset_screen.h",
     "login/screens/supervision_transition_screen.cc",
@@ -1329,7 +1325,6 @@
     "login/screens/supervision_transition_screen_view.h",
     "login/screens/sync_consent_screen.cc",
     "login/screens/sync_consent_screen.h",
-    "login/screens/sync_consent_screen_view.h",
     "login/screens/terms_of_service_screen.cc",
     "login/screens/terms_of_service_screen.h",
     "login/screens/terms_of_service_screen_view.h",
@@ -1345,7 +1340,6 @@
     "login/screens/welcome_screen.h",
     "login/screens/wrong_hwid_screen.cc",
     "login/screens/wrong_hwid_screen.h",
-    "login/screens/wrong_hwid_screen_view.h",
     "login/session/chrome_session_manager.cc",
     "login/session/chrome_session_manager.h",
     "login/session/user_session_manager.cc",
diff --git a/chrome/browser/chromeos/login/screens/hid_detection_screen.cc b/chrome/browser/chromeos/login/screens/hid_detection_screen.cc
index b5cb944..f4e1af8 100644
--- a/chrome/browser/chromeos/login/screens/hid_detection_screen.cc
+++ b/chrome/browser/chromeos/login/screens/hid_detection_screen.cc
@@ -11,8 +11,8 @@
 #include "base/metrics/histogram_macros.h"
 #include "base/strings/string_number_conversions.h"
 #include "base/strings/utf_string_conversions.h"
-#include "chrome/browser/chromeos/login/screens/hid_detection_view.h"
 #include "chrome/browser/chromeos/login/wizard_controller.h"
+#include "chrome/browser/ui/webui/chromeos/login/hid_detection_screen_handler.h"
 #include "chrome/grit/generated_resources.h"
 #include "content/public/browser/browser_thread.h"
 #include "content/public/common/service_manager_connection.h"
diff --git a/chrome/browser/chromeos/login/screens/hid_detection_screen_browsertest.cc b/chrome/browser/chromeos/login/screens/hid_detection_screen_browsertest.cc
index 193df6c..c8789ff 100644
--- a/chrome/browser/chromeos/login/screens/hid_detection_screen_browsertest.cc
+++ b/chrome/browser/chromeos/login/screens/hid_detection_screen_browsertest.cc
@@ -8,7 +8,6 @@
 #include "chrome/browser/chromeos/login/login_wizard.h"
 #include "chrome/browser/chromeos/login/screens/base_screen.h"
 #include "chrome/browser/chromeos/login/screens/hid_detection_screen.h"
-#include "chrome/browser/chromeos/login/screens/hid_detection_view.h"
 #include "chrome/browser/chromeos/login/test/oobe_screen_waiter.h"
 #include "chrome/browser/chromeos/login/wizard_controller.h"
 #include "chrome/browser/ui/webui/chromeos/login/hid_detection_screen_handler.h"
diff --git a/chrome/browser/chromeos/login/screens/hid_detection_view.h b/chrome/browser/chromeos/login/screens/hid_detection_view.h
deleted file mode 100644
index 6569be91..0000000
--- a/chrome/browser/chromeos/login/screens/hid_detection_view.h
+++ /dev/null
@@ -1,48 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_HID_DETECTION_VIEW_H_
-#define CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_HID_DETECTION_VIEW_H_
-
-#include <string>
-
-#include "base/callback.h"
-#include "chrome/browser/chromeos/login/oobe_screen.h"
-
-namespace chromeos {
-
-class HIDDetectionScreen;
-
-// Interface between HID detection screen and its representation, either WebUI
-// or Views one. Note, do not forget to call OnViewDestroyed in the
-// dtor.
-class HIDDetectionView {
- public:
-  constexpr static OobeScreen kScreenId = OobeScreen::SCREEN_OOBE_HID_DETECTION;
-
-  virtual ~HIDDetectionView() {}
-
-  virtual void Show() = 0;
-  virtual void Hide() = 0;
-  virtual void Bind(HIDDetectionScreen* screen) = 0;
-  virtual void Unbind() = 0;
-  // Checks if we should show the screen or enough devices already present.
-  // Calls corresponding set of actions based on the bool result.
-  virtual void CheckIsScreenRequired(
-      const base::Callback<void(bool)>& on_check_done) = 0;
-
-  virtual void SetKeyboardState(const std::string& value) = 0;
-  virtual void SetMouseState(const std::string& value) = 0;
-  virtual void SetKeyboardPinCode(const std::string& value) = 0;
-  virtual void SetNumKeysEnteredExpected(bool value) = 0;
-  virtual void SetNumKeysEnteredPinCode(int value) = 0;
-  virtual void SetMouseDeviceName(const std::string& value) = 0;
-  virtual void SetKeyboardDeviceName(const std::string& value) = 0;
-  virtual void SetKeyboardDeviceLabel(const std::string& value) = 0;
-  virtual void SetContinueButtonEnabled(bool value) = 0;
-};
-
-}  // namespace chromeos
-
-#endif  // CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_HID_DETECTION_VIEW_H_
diff --git a/chrome/browser/chromeos/login/screens/kiosk_enable_screen.cc b/chrome/browser/chromeos/login/screens/kiosk_enable_screen.cc
index 0044dc6..f554e98 100644
--- a/chrome/browser/chromeos/login/screens/kiosk_enable_screen.cc
+++ b/chrome/browser/chromeos/login/screens/kiosk_enable_screen.cc
@@ -7,6 +7,7 @@
 #include "base/logging.h"
 #include "chrome/browser/chromeos/customization/customization_document.h"
 #include "chrome/browser/chromeos/login/wizard_controller.h"
+#include "chrome/browser/ui/webui/chromeos/login/kiosk_enable_screen_handler.h"
 
 namespace chromeos {
 
@@ -26,11 +27,6 @@
     view_->SetDelegate(NULL);
 }
 
-void KioskEnableScreen::Show() {
-  if (view_)
-    view_->Show();
-}
-
 void KioskEnableScreen::OnExit() {
   exit_callback_.Run();
 }
@@ -40,4 +36,11 @@
     view_ = NULL;
 }
 
+void KioskEnableScreen::Show() {
+  if (view_)
+    view_->Show();
+}
+
+void KioskEnableScreen::Hide() {}
+
 }  // namespace chromeos
diff --git a/chrome/browser/chromeos/login/screens/kiosk_enable_screen.h b/chrome/browser/chromeos/login/screens/kiosk_enable_screen.h
index c0b9549..7ae2dde 100644
--- a/chrome/browser/chromeos/login/screens/kiosk_enable_screen.h
+++ b/chrome/browser/chromeos/login/screens/kiosk_enable_screen.h
@@ -11,26 +11,28 @@
 #include "base/compiler_specific.h"
 #include "base/macros.h"
 #include "chrome/browser/chromeos/login/screens/base_screen.h"
-#include "chrome/browser/chromeos/login/screens/kiosk_enable_screen_view.h"
 
 namespace chromeos {
 
+class KioskEnableScreenView;
+
 // Representation independent class that controls screen for enabling
 // consumer kiosk mode.
-class KioskEnableScreen : public BaseScreen,
-                          public KioskEnableScreenView::Delegate {
+class KioskEnableScreen : public BaseScreen {
  public:
   KioskEnableScreen(KioskEnableScreenView* view,
                     const base::RepeatingClosure& exit_callback);
   ~KioskEnableScreen() override;
 
+  // Called when screen is exited.
+  void OnExit();
+  // This method is called, when view is being destroyed. Note, if Delegate
+  // is destroyed earlier then it has to call SetDelegate(nullptr).
+  void OnViewDestroyed(KioskEnableScreenView* view);
+
   // BaseScreen implementation:
   void Show() override;
-  void Hide() override {}
-
-  // KioskEnableScreenActor::Delegate implementation:
-  void OnExit() override;
-  void OnViewDestroyed(KioskEnableScreenView* view) override;
+  void Hide() override;
 
  private:
   KioskEnableScreenView* view_;
diff --git a/chrome/browser/chromeos/login/screens/kiosk_enable_screen_view.h b/chrome/browser/chromeos/login/screens/kiosk_enable_screen_view.h
deleted file mode 100644
index 2dbaad3..0000000
--- a/chrome/browser/chromeos/login/screens/kiosk_enable_screen_view.h
+++ /dev/null
@@ -1,40 +0,0 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_KIOSK_ENABLE_SCREEN_VIEW_H_
-#define CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_KIOSK_ENABLE_SCREEN_VIEW_H_
-
-#include <string>
-#include "chrome/browser/chromeos/login/oobe_screen.h"
-
-namespace chromeos {
-
-// Interface between enable kiosk screen and its representation.
-// Note, do not forget to call OnViewDestroyed in the dtor.
-class KioskEnableScreenView {
- public:
-  // Allows us to get info from reset screen that we need.
-  class Delegate {
-   public:
-    virtual ~Delegate() {}
-
-    // Called when screen is exited.
-    virtual void OnExit() = 0;
-
-    // This method is called, when view is being destroyed. Note, if Delegate
-    // is destroyed earlier then it has to call SetDelegate(nullptr).
-    virtual void OnViewDestroyed(KioskEnableScreenView* view) = 0;
-  };
-
-  constexpr static OobeScreen kScreenId = OobeScreen::SCREEN_KIOSK_ENABLE;
-
-  virtual ~KioskEnableScreenView() {}
-
-  virtual void Show() = 0;
-  virtual void SetDelegate(Delegate* delegate) = 0;
-};
-
-}  // namespace chromeos
-
-#endif  // CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_KIOSK_ENABLE_SCREEN_VIEW_H_
diff --git a/chrome/browser/chromeos/login/screens/marketing_opt_in_screen.cc b/chrome/browser/chromeos/login/screens/marketing_opt_in_screen.cc
index 2ea5b57..bb95894 100644
--- a/chrome/browser/chromeos/login/screens/marketing_opt_in_screen.cc
+++ b/chrome/browser/chromeos/login/screens/marketing_opt_in_screen.cc
@@ -5,10 +5,10 @@
 #include "chrome/browser/chromeos/login/screens/marketing_opt_in_screen.h"
 
 #include "base/logging.h"
-#include "chrome/browser/chromeos/login/screens/marketing_opt_in_screen_view.h"
 #include "chrome/browser/chromeos/login/users/chrome_user_manager_util.h"
 #include "chrome/browser/profiles/profile.h"
 #include "chrome/browser/profiles/profile_manager.h"
+#include "chrome/browser/ui/webui/chromeos/login/marketing_opt_in_screen_handler.h"
 #include "chrome/common/pref_names.h"
 #include "chromeos/constants/chromeos_switches.h"
 #include "components/prefs/pref_service.h"
diff --git a/chrome/browser/chromeos/login/screens/marketing_opt_in_screen_view.h b/chrome/browser/chromeos/login/screens/marketing_opt_in_screen_view.h
deleted file mode 100644
index 3ba0a174..0000000
--- a/chrome/browser/chromeos/login/screens/marketing_opt_in_screen_view.h
+++ /dev/null
@@ -1,34 +0,0 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_MARKETING_OPT_IN_SCREEN_VIEW_H_
-#define CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_MARKETING_OPT_IN_SCREEN_VIEW_H_
-
-#include "chrome/browser/chromeos/login/oobe_screen.h"
-
-namespace chromeos {
-
-class MarketingOptInScreen;
-
-// Interface for dependency injection between MarketingOptInScreen and its
-// WebUI representation.
-class MarketingOptInScreenView {
- public:
-  constexpr static OobeScreen kScreenId = OobeScreen::SCREEN_MARKETING_OPT_IN;
-
-  virtual ~MarketingOptInScreenView() = default;
-
-  // Sets screen this view belongs to.
-  virtual void Bind(MarketingOptInScreen* screen) = 0;
-
-  // Shows the contents of the screen.
-  virtual void Show() = 0;
-
-  // Hides the contents of the screen.
-  virtual void Hide() = 0;
-};
-
-}  // namespace chromeos
-
-#endif  // CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_MARKETING_OPT_IN_SCREEN_VIEW_H_
diff --git a/chrome/browser/chromeos/login/screens/mock_wrong_hwid_screen.cc b/chrome/browser/chromeos/login/screens/mock_wrong_hwid_screen.cc
index 0f38b32..38b77d9 100644
--- a/chrome/browser/chromeos/login/screens/mock_wrong_hwid_screen.cc
+++ b/chrome/browser/chromeos/login/screens/mock_wrong_hwid_screen.cc
@@ -20,7 +20,7 @@
     delegate_->OnViewDestroyed(this);
 }
 
-void MockWrongHWIDScreenView::SetDelegate(Delegate* delegate) {
+void MockWrongHWIDScreenView::SetDelegate(WrongHWIDScreen* delegate) {
   delegate_ = delegate;
   MockSetDelegate(delegate);
 }
diff --git a/chrome/browser/chromeos/login/screens/mock_wrong_hwid_screen.h b/chrome/browser/chromeos/login/screens/mock_wrong_hwid_screen.h
index c34a67a..1485bd3 100644
--- a/chrome/browser/chromeos/login/screens/mock_wrong_hwid_screen.h
+++ b/chrome/browser/chromeos/login/screens/mock_wrong_hwid_screen.h
@@ -6,7 +6,7 @@
 #define CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_MOCK_WRONG_HWID_SCREEN_H_
 
 #include "chrome/browser/chromeos/login/screens/wrong_hwid_screen.h"
-#include "chrome/browser/chromeos/login/screens/wrong_hwid_screen_view.h"
+#include "chrome/browser/ui/webui/chromeos/login/wrong_hwid_screen_handler.h"
 #include "testing/gmock/include/gmock/gmock.h"
 
 namespace chromeos {
@@ -26,14 +26,14 @@
   MockWrongHWIDScreenView();
   ~MockWrongHWIDScreenView() override;
 
-  void SetDelegate(Delegate* delegate) override;
+  void SetDelegate(WrongHWIDScreen* delegate) override;
 
   MOCK_METHOD0(Show, void());
   MOCK_METHOD0(Hide, void());
-  MOCK_METHOD1(MockSetDelegate, void(Delegate*));
+  MOCK_METHOD1(MockSetDelegate, void(WrongHWIDScreen*));
 
  private:
-  Delegate* delegate_ = nullptr;
+  WrongHWIDScreen* delegate_ = nullptr;
 };
 
 }  // namespace chromeos
diff --git a/chrome/browser/chromeos/login/screens/recommend_apps_screen.cc b/chrome/browser/chromeos/login/screens/recommend_apps_screen.cc
index e572568..b121eb4 100644
--- a/chrome/browser/chromeos/login/screens/recommend_apps_screen.cc
+++ b/chrome/browser/chromeos/login/screens/recommend_apps_screen.cc
@@ -5,6 +5,7 @@
 #include "chrome/browser/chromeos/login/screens/recommend_apps_screen.h"
 
 #include "chrome/browser/chromeos/login/screens/recommend_apps/recommend_apps_fetcher.h"
+#include "chrome/browser/ui/webui/chromeos/login/recommend_apps_screen_handler.h"
 
 namespace chromeos {
 
diff --git a/chrome/browser/chromeos/login/screens/recommend_apps_screen.h b/chrome/browser/chromeos/login/screens/recommend_apps_screen.h
index 864f8ba..de5d33de 100644
--- a/chrome/browser/chromeos/login/screens/recommend_apps_screen.h
+++ b/chrome/browser/chromeos/login/screens/recommend_apps_screen.h
@@ -12,7 +12,7 @@
 #include "base/macros.h"
 #include "chrome/browser/chromeos/login/screens/base_screen.h"
 #include "chrome/browser/chromeos/login/screens/recommend_apps/recommend_apps_fetcher_delegate.h"
-#include "chrome/browser/chromeos/login/screens/recommend_apps_screen_view.h"
+#include "chrome/browser/chromeos/login/screens/recommend_apps_screen_view_observer.h"
 
 namespace base {
 class Value;
@@ -21,6 +21,7 @@
 namespace chromeos {
 
 class RecommendAppsFetcher;
+class RecommendAppsScreenView;
 
 // This is Recommend Apps screen that is displayed as a part of user first
 // sign-in flow.
diff --git a/chrome/browser/chromeos/login/screens/recommend_apps_screen_view.h b/chrome/browser/chromeos/login/screens/recommend_apps_screen_view.h
deleted file mode 100644
index 5cfd38f..0000000
--- a/chrome/browser/chromeos/login/screens/recommend_apps_screen_view.h
+++ /dev/null
@@ -1,51 +0,0 @@
-// Copyright 2018 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_RECOMMEND_APPS_SCREEN_VIEW_H_
-#define CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_RECOMMEND_APPS_SCREEN_VIEW_H_
-
-#include "chrome/browser/chromeos/login/oobe_screen.h"
-#include "chrome/browser/chromeos/login/screens/recommend_apps_screen_view_observer.h"
-
-namespace chromeos {
-
-class RecommendAppsScreen;
-
-// Interface for dependency injection between RecommendAppsScreen and its
-// WebUI representation.
-class RecommendAppsScreenView {
- public:
-  constexpr static OobeScreen kScreenId = OobeScreen::SCREEN_RECOMMEND_APPS;
-
-  virtual ~RecommendAppsScreenView() = default;
-
-  // Adds/Removes observer for view.
-  virtual void AddObserver(RecommendAppsScreenViewObserver* observer) = 0;
-  virtual void RemoveObserver(RecommendAppsScreenViewObserver* observer) = 0;
-
-  // Sets screen this view belongs to.
-  virtual void Bind(RecommendAppsScreen* screen) = 0;
-
-  // Shows the contents of the screen.
-  virtual void Show() = 0;
-
-  // Hides the contents of the screen.
-  virtual void Hide() = 0;
-
-  // Called when the download of the recommend app list fails. Show an error
-  // message to the user.
-  virtual void OnLoadError() = 0;
-
-  // Called when the download of the recommend app list is successful. Shows the
-  // downloaded |app_list| to the user.
-  virtual void OnLoadSuccess(const base::Value& app_list) = 0;
-
-  // Called when parsing the recommend app list response fails. Should skip this
-  // screen.
-  virtual void OnParseResponseError() = 0;
-};
-
-}  // namespace chromeos
-
-#endif  // CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_RECOMMEND_APPS_SCREEN_VIEW_H_
diff --git a/chrome/browser/chromeos/login/screens/sync_consent_screen.h b/chrome/browser/chromeos/login/screens/sync_consent_screen.h
index f3c9035..1b87ff0 100644
--- a/chrome/browser/chromeos/login/screens/sync_consent_screen.h
+++ b/chrome/browser/chromeos/login/screens/sync_consent_screen.h
@@ -11,7 +11,7 @@
 #include "base/macros.h"
 #include "base/optional.h"
 #include "chrome/browser/chromeos/login/screens/base_screen.h"
-#include "chrome/browser/chromeos/login/screens/sync_consent_screen_view.h"
+#include "chrome/browser/ui/webui/chromeos/login/sync_consent_screen_handler.h"
 #include "components/sync/driver/sync_service_observer.h"
 #include "components/user_manager/user.h"
 
diff --git a/chrome/browser/chromeos/login/screens/sync_consent_screen_view.h b/chrome/browser/chromeos/login/screens/sync_consent_screen_view.h
deleted file mode 100644
index 17f3c4e..0000000
--- a/chrome/browser/chromeos/login/screens/sync_consent_screen_view.h
+++ /dev/null
@@ -1,38 +0,0 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_SYNC_CONSENT_SCREEN_VIEW_H_
-#define CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_SYNC_CONSENT_SCREEN_VIEW_H_
-
-#include "chrome/browser/chromeos/login/oobe_screen.h"
-
-namespace chromeos {
-
-class SyncConsentScreen;
-
-// Interface for dependency injection between SyncConsentScreen and its
-// WebUI representation.
-class SyncConsentScreenView {
- public:
-  constexpr static OobeScreen kScreenId = OobeScreen::SCREEN_SYNC_CONSENT;
-
-  virtual ~SyncConsentScreenView() = default;
-
-  // Sets screen this view belongs to.
-  virtual void Bind(SyncConsentScreen* screen) = 0;
-
-  // Shows the contents of the screen.
-  virtual void Show() = 0;
-
-  // Hides the contents of the screen.
-  virtual void Hide() = 0;
-
-  // Controls if the loading throbber is visible. This is used when
-  // SyncScreenBehavior is unknown.
-  virtual void SetThrobberVisible(bool visible) = 0;
-};
-
-}  // namespace chromeos
-
-#endif  // CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_SYNC_CONSENT_SCREEN_VIEW_H_
diff --git a/chrome/browser/chromeos/login/screens/wrong_hwid_screen.cc b/chrome/browser/chromeos/login/screens/wrong_hwid_screen.cc
index df7a0a6..bb7f23e 100644
--- a/chrome/browser/chromeos/login/screens/wrong_hwid_screen.cc
+++ b/chrome/browser/chromeos/login/screens/wrong_hwid_screen.cc
@@ -5,6 +5,7 @@
 #include "chrome/browser/chromeos/login/screens/wrong_hwid_screen.h"
 
 #include "chrome/browser/chromeos/login/wizard_controller.h"
+#include "chrome/browser/ui/webui/chromeos/login/wrong_hwid_screen_handler.h"
 
 namespace chromeos {
 
@@ -23,6 +24,15 @@
     view_->SetDelegate(nullptr);
 }
 
+void WrongHWIDScreen::OnExit() {
+  exit_callback_.Run();
+}
+
+void WrongHWIDScreen::OnViewDestroyed(WrongHWIDScreenView* view) {
+  if (view_ == view)
+    view_ = nullptr;
+}
+
 void WrongHWIDScreen::Show() {
   if (view_)
     view_->Show();
@@ -33,13 +43,4 @@
     view_->Hide();
 }
 
-void WrongHWIDScreen::OnExit() {
-  exit_callback_.Run();
-}
-
-void WrongHWIDScreen::OnViewDestroyed(WrongHWIDScreenView* view) {
-  if (view_ == view)
-    view_ = nullptr;
-}
-
 }  // namespace chromeos
diff --git a/chrome/browser/chromeos/login/screens/wrong_hwid_screen.h b/chrome/browser/chromeos/login/screens/wrong_hwid_screen.h
index cd3861fd..6f23dcd 100644
--- a/chrome/browser/chromeos/login/screens/wrong_hwid_screen.h
+++ b/chrome/browser/chromeos/login/screens/wrong_hwid_screen.h
@@ -11,27 +11,29 @@
 #include "base/compiler_specific.h"
 #include "base/macros.h"
 #include "chrome/browser/chromeos/login/screens/base_screen.h"
-#include "chrome/browser/chromeos/login/screens/wrong_hwid_screen_view.h"
 
 namespace chromeos {
 
+class WrongHWIDScreenView;
+
 // Representation independent class that controls screen showing warning about
 // malformed HWID to users.
-class WrongHWIDScreen : public BaseScreen,
-                        public WrongHWIDScreenView::Delegate {
+class WrongHWIDScreen : public BaseScreen {
  public:
   WrongHWIDScreen(WrongHWIDScreenView* view,
                   const base::RepeatingClosure& exit_callback);
   ~WrongHWIDScreen() override;
 
+  // Called when screen is exited.
+  void OnExit();
+  // This method is called, when view is being destroyed. Note, if Delegate
+  // is destroyed earlier then it has to call SetDelegate(NULL).
+  void OnViewDestroyed(WrongHWIDScreenView* view);
+
   // BaseScreen implementation:
   void Show() override;
   void Hide() override;
 
-  // WrongHWIDScreenView::Delegate implementation:
-  void OnExit() override;
-  void OnViewDestroyed(WrongHWIDScreenView* view) override;
-
  private:
   WrongHWIDScreenView* view_;
   base::RepeatingClosure exit_callback_;
diff --git a/chrome/browser/chromeos/login/screens/wrong_hwid_screen_view.h b/chrome/browser/chromeos/login/screens/wrong_hwid_screen_view.h
deleted file mode 100644
index 38c8881..0000000
--- a/chrome/browser/chromeos/login/screens/wrong_hwid_screen_view.h
+++ /dev/null
@@ -1,41 +0,0 @@
-// Copyright (c) 2013 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_WRONG_HWID_SCREEN_VIEW_H_
-#define CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_WRONG_HWID_SCREEN_VIEW_H_
-
-#include <string>
-#include "chrome/browser/chromeos/login/oobe_screen.h"
-
-namespace chromeos {
-
-// Interface between wrong HWID screen and its representation.
-// Note, do not forget to call OnViewDestroyed in the dtor.
-class WrongHWIDScreenView {
- public:
-  // Allows us to get info from wrong HWID screen that we need.
-  class Delegate {
-   public:
-    virtual ~Delegate() {}
-
-    // Called when screen is exited.
-    virtual void OnExit() = 0;
-
-    // This method is called, when view is being destroyed. Note, if Delegate
-    // is destroyed earlier then it has to call SetDelegate(NULL).
-    virtual void OnViewDestroyed(WrongHWIDScreenView* view) = 0;
-  };
-
-  constexpr static OobeScreen kScreenId = OobeScreen::SCREEN_WRONG_HWID;
-
-  virtual ~WrongHWIDScreenView() {}
-
-  virtual void Show() = 0;
-  virtual void Hide() = 0;
-  virtual void SetDelegate(Delegate* delegate) = 0;
-};
-
-}  // namespace chromeos
-
-#endif  // CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_WRONG_HWID_SCREEN_VIEW_H_
diff --git a/chrome/browser/chromeos/login/wizard_controller.cc b/chrome/browser/chromeos/login/wizard_controller.cc
index ba68e89..a01a87e 100644
--- a/chrome/browser/chromeos/login/wizard_controller.cc
+++ b/chrome/browser/chromeos/login/wizard_controller.cc
@@ -56,7 +56,6 @@
 #include "chrome/browser/chromeos/login/screens/eula_screen.h"
 #include "chrome/browser/chromeos/login/screens/fingerprint_setup_screen.h"
 #include "chrome/browser/chromeos/login/screens/hid_detection_screen.h"
-#include "chrome/browser/chromeos/login/screens/hid_detection_view.h"
 #include "chrome/browser/chromeos/login/screens/kiosk_autolaunch_screen.h"
 #include "chrome/browser/chromeos/login/screens/kiosk_enable_screen.h"
 #include "chrome/browser/chromeos/login/screens/marketing_opt_in_screen.h"
@@ -90,6 +89,7 @@
 #include "chrome/browser/profiles/profile_manager.h"
 #include "chrome/browser/ui/ash/login_screen_client.h"
 #include "chrome/browser/ui/ash/tablet_mode_client.h"
+#include "chrome/browser/ui/webui/chromeos/login/hid_detection_screen_handler.h"
 #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h"
 #include "chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h"
 #include "chrome/browser/ui/webui/chromeos/login/welcome_screen_handler.h"
diff --git a/chrome/browser/ui/webui/chromeos/login/hid_detection_screen_handler.h b/chrome/browser/ui/webui/chromeos/login/hid_detection_screen_handler.h
index 956d8dc..3b442c1 100644
--- a/chrome/browser/ui/webui/chromeos/login/hid_detection_screen_handler.h
+++ b/chrome/browser/ui/webui/chromeos/login/hid_detection_screen_handler.h
@@ -10,7 +10,6 @@
 #include "base/compiler_specific.h"
 #include "base/macros.h"
 #include "base/values.h"
-#include "chrome/browser/chromeos/login/screens/hid_detection_view.h"
 #include "chrome/browser/ui/webui/chromeos/login/base_screen_handler.h"
 #include "components/prefs/pref_registry_simple.h"
 #include "content/public/browser/web_ui.h"
@@ -18,6 +17,36 @@
 namespace chromeos {
 
 class CoreOobeView;
+class HIDDetectionScreen;
+
+// Interface between HID detection screen and its representation, either WebUI
+// or Views one. Note, do not forget to call OnViewDestroyed in the
+// dtor.
+class HIDDetectionView {
+ public:
+  constexpr static OobeScreen kScreenId = OobeScreen::SCREEN_OOBE_HID_DETECTION;
+
+  virtual ~HIDDetectionView() {}
+
+  virtual void Show() = 0;
+  virtual void Hide() = 0;
+  virtual void Bind(HIDDetectionScreen* screen) = 0;
+  virtual void Unbind() = 0;
+  // Checks if we should show the screen or enough devices already present.
+  // Calls corresponding set of actions based on the bool result.
+  virtual void CheckIsScreenRequired(
+      const base::Callback<void(bool)>& on_check_done) = 0;
+
+  virtual void SetKeyboardState(const std::string& value) = 0;
+  virtual void SetMouseState(const std::string& value) = 0;
+  virtual void SetKeyboardPinCode(const std::string& value) = 0;
+  virtual void SetNumKeysEnteredExpected(bool value) = 0;
+  virtual void SetNumKeysEnteredPinCode(int value) = 0;
+  virtual void SetMouseDeviceName(const std::string& value) = 0;
+  virtual void SetKeyboardDeviceName(const std::string& value) = 0;
+  virtual void SetKeyboardDeviceLabel(const std::string& value) = 0;
+  virtual void SetContinueButtonEnabled(bool value) = 0;
+};
 
 // WebUI implementation of HIDDetectionScreenView.
 class HIDDetectionScreenHandler
diff --git a/chrome/browser/ui/webui/chromeos/login/kiosk_enable_screen_handler.cc b/chrome/browser/ui/webui/chromeos/login/kiosk_enable_screen_handler.cc
index 1f4eb1d..82951c24 100644
--- a/chrome/browser/ui/webui/chromeos/login/kiosk_enable_screen_handler.cc
+++ b/chrome/browser/ui/webui/chromeos/login/kiosk_enable_screen_handler.cc
@@ -9,6 +9,7 @@
 #include "base/bind.h"
 #include "chrome/browser/browser_process.h"
 #include "chrome/browser/chrome_notification_types.h"
+#include "chrome/browser/chromeos/login/screens/kiosk_enable_screen.h"
 #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h"
 #include "chrome/common/chrome_switches.h"
 #include "chrome/grit/generated_resources.h"
@@ -59,7 +60,7 @@
       content::NotificationService::NoDetails());
 }
 
-void KioskEnableScreenHandler::SetDelegate(Delegate* delegate) {
+void KioskEnableScreenHandler::SetDelegate(KioskEnableScreen* delegate) {
   delegate_ = delegate;
   if (page_is_ready())
     Initialize();
diff --git a/chrome/browser/ui/webui/chromeos/login/kiosk_enable_screen_handler.h b/chrome/browser/ui/webui/chromeos/login/kiosk_enable_screen_handler.h
index 0f3a0df..7af84fc 100644
--- a/chrome/browser/ui/webui/chromeos/login/kiosk_enable_screen_handler.h
+++ b/chrome/browser/ui/webui/chromeos/login/kiosk_enable_screen_handler.h
@@ -9,11 +9,24 @@
 #include "base/macros.h"
 #include "base/memory/weak_ptr.h"
 #include "chrome/browser/chromeos/app_mode/kiosk_app_manager.h"
-#include "chrome/browser/chromeos/login/screens/kiosk_enable_screen_view.h"
 #include "chrome/browser/ui/webui/chromeos/login/base_screen_handler.h"
 
 namespace chromeos {
 
+class KioskEnableScreen;
+
+// Interface between enable kiosk screen and its representation.
+// Note, do not forget to call OnViewDestroyed in the dtor.
+class KioskEnableScreenView {
+ public:
+  constexpr static OobeScreen kScreenId = OobeScreen::SCREEN_KIOSK_ENABLE;
+
+  virtual ~KioskEnableScreenView() {}
+
+  virtual void Show() = 0;
+  virtual void SetDelegate(KioskEnableScreen* delegate) = 0;
+};
+
 // WebUI implementation of KioskEnableScreenActor.
 class KioskEnableScreenHandler : public KioskEnableScreenView,
                                  public BaseScreenHandler {
@@ -23,7 +36,7 @@
 
   // KioskEnableScreenActor implementation:
   void Show() override;
-  void SetDelegate(Delegate* delegate) override;
+  void SetDelegate(KioskEnableScreen* delegate) override;
 
   // BaseScreenHandler implementation:
   void DeclareLocalizedValues(
@@ -45,7 +58,7 @@
   void OnGetConsumerKioskAutoLaunchStatus(
       KioskAppManager::ConsumerKioskAutoLaunchStatus status);
 
-  Delegate* delegate_ = nullptr;
+  KioskEnableScreen* delegate_ = nullptr;
 
   // Keeps whether screen should be shown right after initialization.
   bool show_on_init_ = false;
diff --git a/chrome/browser/ui/webui/chromeos/login/marketing_opt_in_screen_handler.h b/chrome/browser/ui/webui/chromeos/login/marketing_opt_in_screen_handler.h
index f0953bc..ae77194 100644
--- a/chrome/browser/ui/webui/chromeos/login/marketing_opt_in_screen_handler.h
+++ b/chrome/browser/ui/webui/chromeos/login/marketing_opt_in_screen_handler.h
@@ -6,13 +6,30 @@
 #define CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_MARKETING_OPT_IN_SCREEN_HANDLER_H_
 
 #include "base/macros.h"
-#include "chrome/browser/chromeos/login/screens/marketing_opt_in_screen_view.h"
 #include "chrome/browser/ui/webui/chromeos/login/base_screen_handler.h"
 
 namespace chromeos {
 
 class MarketingOptInScreen;
 
+// Interface for dependency injection between MarketingOptInScreen and its
+// WebUI representation.
+class MarketingOptInScreenView {
+ public:
+  constexpr static OobeScreen kScreenId = OobeScreen::SCREEN_MARKETING_OPT_IN;
+
+  virtual ~MarketingOptInScreenView() = default;
+
+  // Sets screen this view belongs to.
+  virtual void Bind(MarketingOptInScreen* screen) = 0;
+
+  // Shows the contents of the screen.
+  virtual void Show() = 0;
+
+  // Hides the contents of the screen.
+  virtual void Hide() = 0;
+};
+
 // The sole implementation of the MarketingOptInScreenView, using WebUI.
 class MarketingOptInScreenHandler : public BaseScreenHandler,
                                     public MarketingOptInScreenView {
diff --git a/chrome/browser/ui/webui/chromeos/login/recommend_apps_screen_handler.h b/chrome/browser/ui/webui/chromeos/login/recommend_apps_screen_handler.h
index a3e6943..3568cd14 100644
--- a/chrome/browser/ui/webui/chromeos/login/recommend_apps_screen_handler.h
+++ b/chrome/browser/ui/webui/chromeos/login/recommend_apps_screen_handler.h
@@ -7,13 +7,47 @@
 
 #include "base/macros.h"
 #include "base/values.h"
-#include "chrome/browser/chromeos/login/screens/recommend_apps_screen_view.h"
 #include "chrome/browser/ui/webui/chromeos/login/base_screen_handler.h"
 #include "components/prefs/pref_service.h"
 
 namespace chromeos {
 
 class RecommendAppsScreen;
+class RecommendAppsScreenViewObserver;
+
+// Interface for dependency injection between RecommendAppsScreen and its
+// WebUI representation.
+class RecommendAppsScreenView {
+ public:
+  constexpr static OobeScreen kScreenId = OobeScreen::SCREEN_RECOMMEND_APPS;
+
+  virtual ~RecommendAppsScreenView() = default;
+
+  // Adds/Removes observer for view.
+  virtual void AddObserver(RecommendAppsScreenViewObserver* observer) = 0;
+  virtual void RemoveObserver(RecommendAppsScreenViewObserver* observer) = 0;
+
+  // Sets screen this view belongs to.
+  virtual void Bind(RecommendAppsScreen* screen) = 0;
+
+  // Shows the contents of the screen.
+  virtual void Show() = 0;
+
+  // Hides the contents of the screen.
+  virtual void Hide() = 0;
+
+  // Called when the download of the recommend app list fails. Show an error
+  // message to the user.
+  virtual void OnLoadError() = 0;
+
+  // Called when the download of the recommend app list is successful. Shows the
+  // downloaded |app_list| to the user.
+  virtual void OnLoadSuccess(const base::Value& app_list) = 0;
+
+  // Called when parsing the recommend app list response fails. Should skip this
+  // screen.
+  virtual void OnParseResponseError() = 0;
+};
 
 // The sole implementation of the RecommendAppsScreenView, using WebUI.
 class RecommendAppsScreenHandler : public BaseScreenHandler,
diff --git a/chrome/browser/ui/webui/chromeos/login/sync_consent_screen_handler.h b/chrome/browser/ui/webui/chromeos/login/sync_consent_screen_handler.h
index 1c74e17..8912c3b 100644
--- a/chrome/browser/ui/webui/chromeos/login/sync_consent_screen_handler.h
+++ b/chrome/browser/ui/webui/chromeos/login/sync_consent_screen_handler.h
@@ -8,13 +8,34 @@
 #include <unordered_set>
 
 #include "base/macros.h"
-#include "chrome/browser/chromeos/login/screens/sync_consent_screen_view.h"
 #include "chrome/browser/ui/webui/chromeos/login/base_screen_handler.h"
 
 namespace chromeos {
 
 class SyncConsentScreen;
 
+// Interface for dependency injection between SyncConsentScreen and its
+// WebUI representation.
+class SyncConsentScreenView {
+ public:
+  constexpr static OobeScreen kScreenId = OobeScreen::SCREEN_SYNC_CONSENT;
+
+  virtual ~SyncConsentScreenView() = default;
+
+  // Sets screen this view belongs to.
+  virtual void Bind(SyncConsentScreen* screen) = 0;
+
+  // Shows the contents of the screen.
+  virtual void Show() = 0;
+
+  // Hides the contents of the screen.
+  virtual void Hide() = 0;
+
+  // Controls if the loading throbber is visible. This is used when
+  // SyncScreenBehavior is unknown.
+  virtual void SetThrobberVisible(bool visible) = 0;
+};
+
 // The sole implementation of the SyncConsentScreenView, using WebUI.
 class SyncConsentScreenHandler : public BaseScreenHandler,
                                  public SyncConsentScreenView {
diff --git a/chrome/browser/ui/webui/chromeos/login/wrong_hwid_screen_handler.cc b/chrome/browser/ui/webui/chromeos/login/wrong_hwid_screen_handler.cc
index a8331d2..1851eed 100644
--- a/chrome/browser/ui/webui/chromeos/login/wrong_hwid_screen_handler.cc
+++ b/chrome/browser/ui/webui/chromeos/login/wrong_hwid_screen_handler.cc
@@ -5,6 +5,7 @@
 #include "chrome/browser/ui/webui/chromeos/login/wrong_hwid_screen_handler.h"
 
 #include "chrome/browser/chromeos/login/oobe_screen.h"
+#include "chrome/browser/chromeos/login/screens/wrong_hwid_screen.h"
 #include "chrome/grit/generated_resources.h"
 #include "components/login/localized_values_builder.h"
 
@@ -31,7 +32,7 @@
 void WrongHWIDScreenHandler::Hide() {
 }
 
-void WrongHWIDScreenHandler::SetDelegate(Delegate* delegate) {
+void WrongHWIDScreenHandler::SetDelegate(WrongHWIDScreen* delegate) {
   delegate_ = delegate;
   if (page_is_ready())
     Initialize();
diff --git a/chrome/browser/ui/webui/chromeos/login/wrong_hwid_screen_handler.h b/chrome/browser/ui/webui/chromeos/login/wrong_hwid_screen_handler.h
index 5a3b489..0113dc7 100644
--- a/chrome/browser/ui/webui/chromeos/login/wrong_hwid_screen_handler.h
+++ b/chrome/browser/ui/webui/chromeos/login/wrong_hwid_screen_handler.h
@@ -7,12 +7,26 @@
 
 #include "base/compiler_specific.h"
 #include "base/macros.h"
-#include "chrome/browser/chromeos/login/screens/wrong_hwid_screen_view.h"
 #include "chrome/browser/ui/webui/chromeos/login/base_screen_handler.h"
 #include "content/public/browser/web_ui.h"
 
 namespace chromeos {
 
+class WrongHWIDScreen;
+
+// Interface between wrong HWID screen and its representation.
+// Note, do not forget to call OnViewDestroyed in the dtor.
+class WrongHWIDScreenView {
+ public:
+  constexpr static OobeScreen kScreenId = OobeScreen::SCREEN_WRONG_HWID;
+
+  virtual ~WrongHWIDScreenView() {}
+
+  virtual void Show() = 0;
+  virtual void Hide() = 0;
+  virtual void SetDelegate(WrongHWIDScreen* delegate) = 0;
+};
+
 // WebUI implementation of WrongHWIDScreenActor.
 class WrongHWIDScreenHandler : public WrongHWIDScreenView,
                                public BaseScreenHandler {
@@ -23,7 +37,7 @@
   // WrongHWIDScreenActor implementation:
   void Show() override;
   void Hide() override;
-  void SetDelegate(Delegate* delegate) override;
+  void SetDelegate(WrongHWIDScreen* delegate) override;
 
   // BaseScreenHandler implementation:
   void DeclareLocalizedValues(
@@ -37,7 +51,7 @@
   // JS messages handlers.
   void HandleOnSkip();
 
-  Delegate* delegate_ = nullptr;
+  WrongHWIDScreen* delegate_ = nullptr;
 
   // Keeps whether screen should be shown right after initialization.
   bool show_on_init_ = false;