| 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; | |
| 28 class ErrorScreensHistogramHelper; | 27 class ErrorScreensHistogramHelper; |
| 29 | 28 |
| 30 // WebUIMessageHandler implementation which handles events occurring on the | 29 // WebUIMessageHandler implementation which handles events occurring on the |
| 31 // page, such as the user pressing the signin button. | 30 // page, such as the user pressing the signin button. |
| 32 class EnrollmentScreenHandler | 31 class EnrollmentScreenHandler |
| 33 : public BaseScreenHandler, | 32 : public BaseScreenHandler, |
| 34 public EnrollmentScreenActor, | 33 public EnrollmentScreenActor, |
| 35 public BrowsingDataRemover::Observer, | 34 public BrowsingDataRemover::Observer, |
| 36 public NetworkStateInformer::NetworkStateInformerObserver, | 35 public NetworkStateInformer::NetworkStateInformerObserver, |
| 37 public WebUILoginView::FrameObserver { | 36 public WebUILoginView::FrameObserver { |
| (...skipping 30 matching lines...) Expand all Loading... |
| 68 virtual void OnBrowsingDataRemoverDone() override; | 67 virtual void OnBrowsingDataRemoverDone() override; |
| 69 | 68 |
| 70 // Implements NetworkStateInformer::NetworkStateInformerObserver | 69 // Implements NetworkStateInformer::NetworkStateInformerObserver |
| 71 virtual void UpdateState(ErrorScreenActor::ErrorReason reason) override; | 70 virtual void UpdateState(ErrorScreenActor::ErrorReason reason) override; |
| 72 | 71 |
| 73 // Implements WebUILoginView::FrameObserver | 72 // Implements WebUILoginView::FrameObserver |
| 74 virtual void OnFrameError(const std::string& frame_unique_name) override; | 73 virtual void OnFrameError(const std::string& frame_unique_name) override; |
| 75 | 74 |
| 76 private: | 75 private: |
| 77 // Handlers for WebUI messages. | 76 // Handlers for WebUI messages. |
| 78 void HandleRetrieveAuthenticatedUserEmail(double attempt_token); | |
| 79 void HandleClose(const std::string& reason); | 77 void HandleClose(const std::string& reason); |
| 80 void HandleCompleteLogin(const std::string& user); | 78 void HandleCompleteLogin(const std::string& user); |
| 81 void HandleRetry(); | 79 void HandleRetry(); |
| 82 void HandleFrameLoadingCompleted(int status); | 80 void HandleFrameLoadingCompleted(int status); |
| 83 | 81 |
| 84 void SetupAndShowOfflineMessage(NetworkStateInformer::State state, | 82 void SetupAndShowOfflineMessage(NetworkStateInformer::State state, |
| 85 ErrorScreenActor::ErrorReason reason); | 83 ErrorScreenActor::ErrorReason reason); |
| 86 void HideOfflineMessage(NetworkStateInformer::State state, | 84 void HideOfflineMessage(NetworkStateInformer::State state, |
| 87 ErrorScreenActor::ErrorReason reason); | 85 ErrorScreenActor::ErrorReason reason); |
| 88 | 86 |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 // This intentionally lives here and not in the controller, since it needs to | 131 // This intentionally lives here and not in the controller, since it needs to |
| 134 // execute requests in the context of the profile that displays the webui. | 132 // execute requests in the context of the profile that displays the webui. |
| 135 scoped_ptr<policy::PolicyOAuth2TokenFetcher> oauth_fetcher_; | 133 scoped_ptr<policy::PolicyOAuth2TokenFetcher> oauth_fetcher_; |
| 136 | 134 |
| 137 // The browsing data remover instance currently active, if any. | 135 // The browsing data remover instance currently active, if any. |
| 138 BrowsingDataRemover* browsing_data_remover_; | 136 BrowsingDataRemover* browsing_data_remover_; |
| 139 | 137 |
| 140 // The callbacks to invoke after browsing data has been cleared. | 138 // The callbacks to invoke after browsing data has been cleared. |
| 141 std::vector<base::Closure> auth_reset_callbacks_; | 139 std::vector<base::Closure> auth_reset_callbacks_; |
| 142 | 140 |
| 143 // Helper that retrieves the authenticated user's e-mail address. | |
| 144 scoped_ptr<AuthenticatedUserEmailRetriever> email_retriever_; | |
| 145 | |
| 146 // Latest enrollment frame error. | 141 // Latest enrollment frame error. |
| 147 net::Error frame_error_; | 142 net::Error frame_error_; |
| 148 | 143 |
| 149 // Network state informer used to keep signin screen up. | 144 // Network state informer used to keep signin screen up. |
| 150 scoped_refptr<NetworkStateInformer> network_state_informer_; | 145 scoped_refptr<NetworkStateInformer> network_state_informer_; |
| 151 | 146 |
| 152 ErrorScreenActor* error_screen_actor_; | 147 ErrorScreenActor* error_screen_actor_; |
| 153 | 148 |
| 154 scoped_ptr<ErrorScreensHistogramHelper> histogram_helper_; | 149 scoped_ptr<ErrorScreensHistogramHelper> histogram_helper_; |
| 155 | 150 |
| 156 base::WeakPtrFactory<EnrollmentScreenHandler> weak_ptr_factory_; | 151 base::WeakPtrFactory<EnrollmentScreenHandler> weak_ptr_factory_; |
| 157 | 152 |
| 158 DISALLOW_COPY_AND_ASSIGN(EnrollmentScreenHandler); | 153 DISALLOW_COPY_AND_ASSIGN(EnrollmentScreenHandler); |
| 159 }; | 154 }; |
| 160 | 155 |
| 161 } // namespace chromeos | 156 } // namespace chromeos |
| 162 | 157 |
| 163 #endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_ENROLLMENT_SCREEN_HANDLER_H_ | 158 #endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_ENROLLMENT_SCREEN_HANDLER_H_ |
| OLD | NEW |