• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright (c) 2010 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_ACCOUNT_CREATION_VIEW_H_
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_ACCOUNT_CREATION_VIEW_H_
7 #pragma once
8 
9 #include <string>
10 
11 #include "chrome/browser/chromeos/login/web_page_view.h"
12 #include "views/view.h"
13 
14 class Profile;
15 class SiteContents;
16 
17 namespace chromeos {
18 
19 class AccountCreationViewDelegate {
20  public:
~AccountCreationViewDelegate()21   virtual ~AccountCreationViewDelegate() {}
22 
23   // Notify about new user name and password. This notification is sent before
24   // server validates form so user may not be created. In this case this
25   // this function will be called on each try.
26   virtual void OnUserCreated(const std::string& username,
27                              const std::string& password) = 0;
28 };
29 
30 class AccountCreationDomView : public WebPageDomView {
31  public:
32   AccountCreationDomView();
33   virtual ~AccountCreationDomView();
34 
35   // Set delegate that will be notified about user actions.
36   void SetAccountCreationViewDelegate(AccountCreationViewDelegate* delegate);
37 
38  protected:
39   // Overriden from DOMView:
40   virtual TabContents* CreateTabContents(Profile* profile,
41                                          SiteInstance* instance);
42 
43  private:
44   AccountCreationViewDelegate* delegate_;
45 
46   DISALLOW_COPY_AND_ASSIGN(AccountCreationDomView);
47 };
48 
49 class AccountCreationView : public WebPageView {
50  public:
51   AccountCreationView();
52   virtual ~AccountCreationView();
53 
54   // Set delegate that will be notified about user actions.
55   void SetAccountCreationViewDelegate(AccountCreationViewDelegate* delegate);
56 
57  protected:
dom_view()58   virtual WebPageDomView* dom_view() { return dom_view_; }
59 
60  private:
61   // View that renders page.
62   AccountCreationDomView* dom_view_;
63 
64   DISALLOW_COPY_AND_ASSIGN(AccountCreationView);
65 };
66 
67 }  // namespace chromeos
68 
69 #endif  // CHROME_BROWSER_CHROMEOS_LOGIN_ACCOUNT_CREATION_VIEW_H_
70