OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_ENROLLMENT_SCREEN_HANDLER_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_ENROLLMENT_SCREEN_HANDLER_H_ |
6 #define CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_ENROLLMENT_SCREEN_HANDLER_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_ENROLLMENT_SCREEN_HANDLER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/callback_forward.h" | 12 #include "base/callback_forward.h" |
13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
14 #include "base/memory/scoped_vector.h" | 14 #include "base/memory/scoped_vector.h" |
15 #include "chrome/browser/browsing_data/browsing_data_remover.h" | 15 #include "chrome/browser/browsing_data/browsing_data_remover.h" |
16 #include "chrome/browser/chromeos/login/enrollment/enrollment_screen_actor.h" | 16 #include "chrome/browser/chromeos/login/enrollment/enrollment_screen_actor.h" |
17 #include "chrome/browser/chromeos/login/ui/webui_login_view.h" | 17 #include "chrome/browser/chromeos/login/ui/webui_login_view.h" |
18 #include "chrome/browser/ui/webui/chromeos/login/base_screen_handler.h" | 18 #include "chrome/browser/ui/webui/chromeos/login/base_screen_handler.h" |
19 #include "chrome/browser/ui/webui/chromeos/login/network_state_informer.h" | 19 #include "chrome/browser/ui/webui/chromeos/login/network_state_informer.h" |
20 | 20 |
21 namespace policy { | 21 namespace policy { |
22 class PolicyOAuth2TokenFetcher; | 22 class PolicyOAuth2TokenFetcher; |
23 } | 23 } |
24 | 24 |
25 namespace chromeos { | 25 namespace chromeos { |
26 | 26 |
| 27 class AuthenticatedUserEmailRetriever; |
27 class ErrorScreensHistogramHelper; | 28 class ErrorScreensHistogramHelper; |
28 | 29 |
29 // WebUIMessageHandler implementation which handles events occurring on the | 30 // WebUIMessageHandler implementation which handles events occurring on the |
30 // page, such as the user pressing the signin button. | 31 // page, such as the user pressing the signin button. |
31 class EnrollmentScreenHandler | 32 class EnrollmentScreenHandler |
32 : public BaseScreenHandler, | 33 : public BaseScreenHandler, |
33 public EnrollmentScreenActor, | 34 public EnrollmentScreenActor, |
34 public BrowsingDataRemover::Observer, | 35 public BrowsingDataRemover::Observer, |
35 public NetworkStateInformer::NetworkStateInformerObserver, | 36 public NetworkStateInformer::NetworkStateInformerObserver, |
36 public WebUILoginView::FrameObserver { | 37 public WebUILoginView::FrameObserver { |
(...skipping 30 matching lines...) Expand all Loading... |
67 virtual void OnBrowsingDataRemoverDone() override; | 68 virtual void OnBrowsingDataRemoverDone() override; |
68 | 69 |
69 // Implements NetworkStateInformer::NetworkStateInformerObserver | 70 // Implements NetworkStateInformer::NetworkStateInformerObserver |
70 virtual void UpdateState(ErrorScreenActor::ErrorReason reason) override; | 71 virtual void UpdateState(ErrorScreenActor::ErrorReason reason) override; |
71 | 72 |
72 // Implements WebUILoginView::FrameObserver | 73 // Implements WebUILoginView::FrameObserver |
73 virtual void OnFrameError(const std::string& frame_unique_name) override; | 74 virtual void OnFrameError(const std::string& frame_unique_name) override; |
74 | 75 |
75 private: | 76 private: |
76 // Handlers for WebUI messages. | 77 // Handlers for WebUI messages. |
| 78 void HandleRetrieveAuthenticatedUserEmail(double attempt_token); |
77 void HandleClose(const std::string& reason); | 79 void HandleClose(const std::string& reason); |
78 void HandleCompleteLogin(const std::string& user); | 80 void HandleCompleteLogin(const std::string& user); |
79 void HandleRetry(); | 81 void HandleRetry(); |
80 void HandleFrameLoadingCompleted(int status); | 82 void HandleFrameLoadingCompleted(int status); |
81 | 83 |
82 void SetupAndShowOfflineMessage(NetworkStateInformer::State state, | 84 void SetupAndShowOfflineMessage(NetworkStateInformer::State state, |
83 ErrorScreenActor::ErrorReason reason); | 85 ErrorScreenActor::ErrorReason reason); |
84 void HideOfflineMessage(NetworkStateInformer::State state, | 86 void HideOfflineMessage(NetworkStateInformer::State state, |
85 ErrorScreenActor::ErrorReason reason); | 87 ErrorScreenActor::ErrorReason reason); |
86 | 88 |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 // This intentionally lives here and not in the controller, since it needs to | 133 // This intentionally lives here and not in the controller, since it needs to |
132 // execute requests in the context of the profile that displays the webui. | 134 // execute requests in the context of the profile that displays the webui. |
133 scoped_ptr<policy::PolicyOAuth2TokenFetcher> oauth_fetcher_; | 135 scoped_ptr<policy::PolicyOAuth2TokenFetcher> oauth_fetcher_; |
134 | 136 |
135 // The browsing data remover instance currently active, if any. | 137 // The browsing data remover instance currently active, if any. |
136 BrowsingDataRemover* browsing_data_remover_; | 138 BrowsingDataRemover* browsing_data_remover_; |
137 | 139 |
138 // The callbacks to invoke after browsing data has been cleared. | 140 // The callbacks to invoke after browsing data has been cleared. |
139 std::vector<base::Closure> auth_reset_callbacks_; | 141 std::vector<base::Closure> auth_reset_callbacks_; |
140 | 142 |
| 143 // Helper that retrieves the authenticated user's e-mail address. |
| 144 scoped_ptr<AuthenticatedUserEmailRetriever> email_retriever_; |
| 145 |
141 // Latest enrollment frame error. | 146 // Latest enrollment frame error. |
142 net::Error frame_error_; | 147 net::Error frame_error_; |
143 | 148 |
144 // Network state informer used to keep signin screen up. | 149 // Network state informer used to keep signin screen up. |
145 scoped_refptr<NetworkStateInformer> network_state_informer_; | 150 scoped_refptr<NetworkStateInformer> network_state_informer_; |
146 | 151 |
147 ErrorScreenActor* error_screen_actor_; | 152 ErrorScreenActor* error_screen_actor_; |
148 | 153 |
149 scoped_ptr<ErrorScreensHistogramHelper> histogram_helper_; | 154 scoped_ptr<ErrorScreensHistogramHelper> histogram_helper_; |
150 | 155 |
151 base::WeakPtrFactory<EnrollmentScreenHandler> weak_ptr_factory_; | 156 base::WeakPtrFactory<EnrollmentScreenHandler> weak_ptr_factory_; |
152 | 157 |
153 DISALLOW_COPY_AND_ASSIGN(EnrollmentScreenHandler); | 158 DISALLOW_COPY_AND_ASSIGN(EnrollmentScreenHandler); |
154 }; | 159 }; |
155 | 160 |
156 } // namespace chromeos | 161 } // namespace chromeos |
157 | 162 |
158 #endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_ENROLLMENT_SCREEN_HANDLER_H_ | 163 #endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_ENROLLMENT_SCREEN_HANDLER_H_ |
OLD | NEW |