• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright (c) 2011 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_ENTERPRISE_ENROLLMENT_VIEW_H_
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_ENTERPRISE_ENROLLMENT_VIEW_H_
7 #pragma once
8 
9 #include <string>
10 
11 #include "base/basictypes.h"
12 #include "base/compiler_specific.h"
13 #include "chrome/browser/chromeos/login/web_page_view.h"
14 #include "chrome/browser/ui/webui/chromeos/enterprise_enrollment_ui.h"
15 #include "chrome/common/net/gaia/google_service_auth_error.h"
16 #include "views/view.h"
17 
18 class DictionaryValue;
19 
20 namespace views {
21 class GridLayout;
22 class Label;
23 }
24 
25 namespace chromeos {
26 
27 class EnterpriseEnrollmentController;
28 class ScreenObserver;
29 
30 // Implements the UI for the enterprise enrollment screen in OOBE.
31 class EnterpriseEnrollmentView : public views::View,
32                                  public EnterpriseEnrollmentUI::Controller {
33  public:
34   explicit EnterpriseEnrollmentView(EnterpriseEnrollmentController* controller);
35   virtual ~EnterpriseEnrollmentView();
36 
37   void set_editable_user(bool editable);
38 
39   // Initialize view controls and layout.
40   void Init();
41 
42   // Switches to the confirmation screen.
43   void ShowConfirmationScreen();
44 
45   // Show an authentication error.
46   void ShowAuthError(const GoogleServiceAuthError& error);
47   void ShowAccountError();
48   void ShowFatalAuthError();
49   void ShowFatalEnrollmentError();
50   void ShowNetworkEnrollmentError();
51 
52   // EnterpriseEnrollmentUI::Controller implementation.
53   virtual void OnAuthSubmitted(const std::string& user,
54                                const std::string& password,
55                                const std::string& captcha,
56                                const std::string& access_code) OVERRIDE;
57   virtual void OnAuthCancelled() OVERRIDE;
58   virtual void OnConfirmationClosed() OVERRIDE;
59   virtual bool GetInitialUser(std::string* user) OVERRIDE;
60 
61  private:
62   // Updates the gaia login box.
63   void UpdateGaiaLogin(const DictionaryValue& args);
64 
65   // Display the given i18n string as error message.
66   void ShowError(int message_id);
67 
68   // Overriden from views::View:
69   virtual void Layout() OVERRIDE;
70 
71   EnterpriseEnrollmentController* controller_;
72 
73   // Controls.
74   WebPageDomView* enrollment_page_view_;
75 
76   bool editable_user_;
77 
78   DISALLOW_COPY_AND_ASSIGN(EnterpriseEnrollmentView);
79 };
80 
81 }  // namespace chromeos
82 
83 #endif  // CHROME_BROWSER_CHROMEOS_LOGIN_ENTERPRISE_ENROLLMENT_VIEW_H_
84