| 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/ui/webui/chromeos/login/base_screen_handler.h" | 17 #include "chrome/browser/ui/webui/chromeos/login/base_screen_handler.h" |
| 18 | 18 |
| 19 namespace policy { | 19 namespace policy { |
| 20 class PolicyOAuth2TokenFetcher; | 20 class PolicyOAuth2TokenFetcher; |
| 21 } | 21 } |
| 22 | 22 |
| 23 namespace chromeos { | 23 namespace chromeos { |
| 24 | 24 |
| 25 class AuthenticatedUserEmailRetriever; |
| 26 |
| 25 // WebUIMessageHandler implementation which handles events occurring on the | 27 // WebUIMessageHandler implementation which handles events occurring on the |
| 26 // page, such as the user pressing the signin button. | 28 // page, such as the user pressing the signin button. |
| 27 class EnrollmentScreenHandler | 29 class EnrollmentScreenHandler |
| 28 : public BaseScreenHandler, | 30 : public BaseScreenHandler, |
| 29 public EnrollmentScreenActor, | 31 public EnrollmentScreenActor, |
| 30 public BrowsingDataRemover::Observer { | 32 public BrowsingDataRemover::Observer { |
| 31 public: | 33 public: |
| 32 EnrollmentScreenHandler(); | 34 EnrollmentScreenHandler(); |
| 33 virtual ~EnrollmentScreenHandler(); | 35 virtual ~EnrollmentScreenHandler(); |
| 34 | 36 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 54 | 56 |
| 55 // Implements BaseScreenHandler: | 57 // Implements BaseScreenHandler: |
| 56 virtual void Initialize() OVERRIDE; | 58 virtual void Initialize() OVERRIDE; |
| 57 virtual void DeclareLocalizedValues(LocalizedValuesBuilder* builder) OVERRIDE; | 59 virtual void DeclareLocalizedValues(LocalizedValuesBuilder* builder) OVERRIDE; |
| 58 | 60 |
| 59 // Implements BrowsingDataRemover::Observer: | 61 // Implements BrowsingDataRemover::Observer: |
| 60 virtual void OnBrowsingDataRemoverDone() OVERRIDE; | 62 virtual void OnBrowsingDataRemoverDone() OVERRIDE; |
| 61 | 63 |
| 62 private: | 64 private: |
| 63 // Handlers for WebUI messages. | 65 // Handlers for WebUI messages. |
| 66 void HandleRetrieveAuthenticatedUserEmail(double attempt_token); |
| 64 void HandleClose(const std::string& reason); | 67 void HandleClose(const std::string& reason); |
| 65 void HandleCompleteLogin(const std::string& user); | 68 void HandleCompleteLogin(const std::string& user); |
| 66 void HandleRetry(); | 69 void HandleRetry(); |
| 67 | 70 |
| 68 // Shows a given enrollment step. | 71 // Shows a given enrollment step. |
| 69 void ShowStep(const char* step); | 72 void ShowStep(const char* step); |
| 70 | 73 |
| 71 // Display the given i18n resource as error message. | 74 // Display the given i18n resource as error message. |
| 72 void ShowError(int message_id, bool retry); | 75 void ShowError(int message_id, bool retry); |
| 73 | 76 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 104 // This intentionally lives here and not in the controller, since it needs to | 107 // This intentionally lives here and not in the controller, since it needs to |
| 105 // execute requests in the context of the profile that displays the webui. | 108 // execute requests in the context of the profile that displays the webui. |
| 106 scoped_ptr<policy::PolicyOAuth2TokenFetcher> oauth_fetcher_; | 109 scoped_ptr<policy::PolicyOAuth2TokenFetcher> oauth_fetcher_; |
| 107 | 110 |
| 108 // The browsing data remover instance currently active, if any. | 111 // The browsing data remover instance currently active, if any. |
| 109 BrowsingDataRemover* browsing_data_remover_; | 112 BrowsingDataRemover* browsing_data_remover_; |
| 110 | 113 |
| 111 // The callbacks to invoke after browsing data has been cleared. | 114 // The callbacks to invoke after browsing data has been cleared. |
| 112 std::vector<base::Closure> auth_reset_callbacks_; | 115 std::vector<base::Closure> auth_reset_callbacks_; |
| 113 | 116 |
| 117 // Helper that retrieves the authenticated user's e-mail address. |
| 118 scoped_ptr<AuthenticatedUserEmailRetriever> email_retriever_; |
| 119 |
| 114 DISALLOW_COPY_AND_ASSIGN(EnrollmentScreenHandler); | 120 DISALLOW_COPY_AND_ASSIGN(EnrollmentScreenHandler); |
| 115 }; | 121 }; |
| 116 | 122 |
| 117 } // namespace chromeos | 123 } // namespace chromeos |
| 118 | 124 |
| 119 #endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_ENROLLMENT_SCREEN_HANDLER_H_ | 125 #endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_ENROLLMENT_SCREEN_HANDLER_H_ |
| OLD | NEW |