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