OLD | NEW |
| (Empty) |
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_LOGIN_SCREEN_H_ | |
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_LOGIN_SCREEN_H_ | |
7 #pragma once | |
8 | |
9 #include <string> | |
10 | |
11 #include "base/ref_counted.h" | |
12 #include "chrome/browser/chromeos/login/authenticator.h" | |
13 #include "chrome/browser/chromeos/login/login_status_consumer.h" | |
14 #include "chrome/browser/chromeos/login/message_bubble.h" | |
15 #include "chrome/browser/chromeos/login/new_user_view.h" | |
16 #include "chrome/browser/chromeos/login/view_screen.h" | |
17 | |
18 namespace chromeos { | |
19 | |
20 class MessageBubble; | |
21 | |
22 // This screen is obsolete, used only on test images. http://crosbug.com/7214 | |
23 // TODO(nkostylev): Use ExistingUserController sign in screen for test images. | |
24 class LoginScreen : public ViewScreen<NewUserView>, | |
25 public NewUserView::Delegate, | |
26 public LoginStatusConsumer, | |
27 public MessageBubbleDelegate { | |
28 public: | |
29 explicit LoginScreen(WizardScreenDelegate* delegate); | |
30 virtual ~LoginScreen(); | |
31 | |
32 bool IsErrorShown() { | |
33 return bubble_ != NULL; | |
34 } | |
35 | |
36 // NewUserView::Delegate: | |
37 virtual void OnLogin(const std::string& username, | |
38 const std::string& password); | |
39 virtual void OnLoginOffTheRecord(); | |
40 virtual void OnCreateAccount(); | |
41 virtual void AddStartUrl(const GURL& start_url) { start_url_ = start_url; } | |
42 virtual void ClearErrors(); | |
43 virtual void NavigateAway() {} | |
44 virtual void SetStatusAreaEnabled(bool enable) {} | |
45 | |
46 // Overridden from LoginStatusConsumer. | |
47 virtual void OnLoginFailure(const LoginFailure& error); | |
48 virtual void OnLoginSuccess( | |
49 const std::string& username, | |
50 const std::string& password, | |
51 const GaiaAuthConsumer::ClientLoginResult& credentials, | |
52 bool pending_requests); | |
53 virtual void OnOffTheRecordLoginSuccess(); | |
54 | |
55 // Overridden from views::InfoBubbleDelegate. | |
56 virtual void InfoBubbleClosing(InfoBubble* info_bubble, | |
57 bool closed_by_escape) { | |
58 bubble_ = NULL; | |
59 } | |
60 virtual bool CloseOnEscape() { return true; } | |
61 virtual bool FadeInOnShow() { return false; } | |
62 virtual void OnHelpLinkActivated(); | |
63 | |
64 private: | |
65 // ViewScreen<NewUserView>: | |
66 virtual NewUserView* AllocateView(); | |
67 | |
68 // Adds start url to command line. | |
69 void AppendStartUrlToCmdline(); | |
70 | |
71 // Shows error message with the specified message id. | |
72 // If |details| string is not empty, it specify additional error text | |
73 // provided by authenticator, it is not localized. | |
74 void ShowError(int error_id, const std::string& details); | |
75 | |
76 // Pointer to shown message bubble. We don't need to delete it because | |
77 // it will be deleted on bubble closing. | |
78 MessageBubble* bubble_; | |
79 | |
80 scoped_refptr<Authenticator> authenticator_; | |
81 | |
82 // URL that will be opened on browser startup. | |
83 GURL start_url_; | |
84 | |
85 DISALLOW_COPY_AND_ASSIGN(LoginScreen); | |
86 }; | |
87 | |
88 } // namespace chromeos | |
89 | |
90 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_LOGIN_SCREEN_H_ | |
OLD | NEW |