1 // Copyright 2014 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_GAIA_SCREEN_H_
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_GAIA_SCREEN_H_
7 
8 #include <string>
9 
10 #include "base/bind.h"
11 #include "base/callback.h"
12 #include "base/macros.h"
13 #include "chrome/browser/chromeos/login/screens/base_screen.h"
14 
15 namespace chromeos {
16 
17 class GaiaView;
18 
19 // This class represents GAIA screen: login screen that is responsible for
20 // GAIA-based sign-in.
21 class GaiaScreen : public BaseScreen {
22  public:
23   using TView = GaiaView;
24 
25   enum class Result {
26     BACK,
27     CLOSE_DIALOG,
28   };
29 
30   static std::string GetResultString(Result result);
31 
32   using ScreenExitCallback = base::RepeatingCallback<void(Result result)>;
33 
34   explicit GaiaScreen(const ScreenExitCallback& exit_callback);
35   ~GaiaScreen() override;
36 
37   void SetView(GaiaView* view);
38 
39   void MaybePreloadAuthExtension();
40   // Loads online Gaia into the webview.
41   void LoadOnline(const AccountId& account);
42   // Loads online Gaia (for child signup) into the webview.
43   void LoadOnlineForChildSignup();
44   // Loads online Gaia (for child signin) into the webview.
45   void LoadOnlineForChildSignin();
46   // Loads offline version of Gaia.
47   void LoadOffline(const AccountId& account);
48 
49  private:
50   void ShowImpl() override;
51   void HideImpl() override;
52   void OnUserAction(const std::string& action_id) override;
53 
54   GaiaView* view_ = nullptr;
55 
56   ScreenExitCallback exit_callback_;
57 
58   DISALLOW_COPY_AND_ASSIGN(GaiaScreen);
59 };
60 
61 }  // namespace chromeos
62 
63 #endif  // CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_GAIA_SCREEN_H_
64