• 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_UI_WEBUI_CHROMEOS_ENTERPRISE_ENROLLMENT_UI_H_
6 #define CHROME_BROWSER_UI_WEBUI_CHROMEOS_ENTERPRISE_ENROLLMENT_UI_H_
7 #pragma once
8 
9 #include "base/compiler_specific.h"
10 #include "content/browser/webui/web_ui.h"
11 
12 namespace chromeos {
13 
14 // WebUI implementation that handles the enterprise enrollment dialog in the
15 // Chrome OS login flow.
16 class EnterpriseEnrollmentUI : public WebUI {
17  public:
18   // This defines the interface for controllers which will be called back when
19   // something happens on the UI. It is stored in a property of the TabContents.
20   class Controller {
21    public:
~Controller()22     virtual ~Controller() {}
23 
24     virtual void OnAuthSubmitted(const std::string& user,
25                                  const std::string& password,
26                                  const std::string& captcha,
27                                  const std::string& access_code) = 0;
28     virtual void OnAuthCancelled() = 0;
29     virtual void OnConfirmationClosed() = 0;
30     virtual bool GetInitialUser(std::string* user) = 0;
31   };
32 
33   explicit EnterpriseEnrollmentUI(TabContents* contents);
34   virtual ~EnterpriseEnrollmentUI();
35 
36   // Overriden from WebUI.
37   virtual void RenderViewCreated(RenderViewHost* render_view_host) OVERRIDE;
38 
39   // Gets the URL for loading the UI.
40   static GURL GetURL();
41 
42   // Gets the controller the given |web_ui| is associated with. Returns NULL if
43   // there is no controller set.
44   static Controller* GetController(WebUI* web_ui);
45 
46   // Sets the controller on a tab contents.
47   static void SetController(TabContents* contents, Controller* controller);
48 
49  private:
50   DISALLOW_COPY_AND_ASSIGN(EnterpriseEnrollmentUI);
51 };
52 
53 }  // namespace chromeos
54 
55 #endif  // CHROME_BROWSER_UI_WEBUI_CHROMEOS_ENTERPRISE_ENROLLMENT_UI_H_
56