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