1 // Copyright 2018 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_ASSISTANT_OPTIN_FLOW_SCREEN_H_ 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_ASSISTANT_OPTIN_FLOW_SCREEN_H_ 7 8 #include <string> 9 10 #include "base/auto_reset.h" 11 #include "base/bind.h" 12 #include "base/callback.h" 13 #include "base/macros.h" 14 #include "chrome/browser/chromeos/login/screens/base_screen.h" 15 16 namespace chromeos { 17 18 class AssistantOptInFlowScreenView; 19 20 class AssistantOptInFlowScreen : public BaseScreen { 21 public: 22 using TView = AssistantOptInFlowScreenView; 23 24 enum class Result { NEXT, NOT_APPLICABLE }; 25 26 static std::string GetResultString(Result result); 27 28 using ScreenExitCallback = base::RepeatingCallback<void(Result result)>; 29 30 AssistantOptInFlowScreen(AssistantOptInFlowScreenView* view, 31 const ScreenExitCallback& exit_callback); 32 ~AssistantOptInFlowScreen() override; 33 34 // Called when view is destroyed so there's no dead reference to it. 35 void OnViewDestroyed(AssistantOptInFlowScreenView* view_); 36 37 static std::unique_ptr<base::AutoReset<bool>> 38 ForceLibAssistantEnabledForTesting(bool enabled); 39 set_exit_callback_for_testing(const ScreenExitCallback & exit_callback)40 void set_exit_callback_for_testing(const ScreenExitCallback& exit_callback) { 41 exit_callback_ = exit_callback; 42 } 43 get_exit_callback_for_testing()44 const ScreenExitCallback& get_exit_callback_for_testing() { 45 return exit_callback_; 46 } 47 48 protected: 49 // BaseScreen: 50 bool MaybeSkip(WizardContext* context) override; 51 void ShowImpl() override; 52 void HideImpl() override; 53 void OnUserAction(const std::string& action_id) override; 54 55 private: 56 AssistantOptInFlowScreenView* view_; 57 ScreenExitCallback exit_callback_; 58 59 DISALLOW_COPY_AND_ASSIGN(AssistantOptInFlowScreen); 60 }; 61 62 } // namespace chromeos 63 64 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_ASSISTANT_OPTIN_FLOW_SCREEN_H_ 65