| 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 #include "chrome/browser/ui/webui/chromeos/login/enrollment_screen_handler.h" | 5 #include "chrome/browser/ui/webui/chromeos/login/enrollment_screen_handler.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| 11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
| 12 #include "base/macros.h" |
| 12 #include "base/message_loop/message_loop.h" | 13 #include "base/message_loop/message_loop.h" |
| 13 #include "base/strings/string_util.h" | 14 #include "base/strings/string_util.h" |
| 14 #include "base/values.h" | 15 #include "base/values.h" |
| 15 #include "chrome/browser/browser_process.h" | 16 #include "chrome/browser/browser_process.h" |
| 16 #include "chrome/browser/browsing_data/browsing_data_helper.h" | 17 #include "chrome/browser/browsing_data/browsing_data_helper.h" |
| 17 #include "chrome/browser/browsing_data/browsing_data_remover.h" | 18 #include "chrome/browser/browsing_data/browsing_data_remover.h" |
| 18 #include "chrome/browser/chromeos/login/ui/login_display_host_impl.h" | 19 #include "chrome/browser/chromeos/login/ui/login_display_host_impl.h" |
| 19 #include "chrome/browser/chromeos/policy/policy_oauth2_token_fetcher.h" | 20 #include "chrome/browser/chromeos/policy/policy_oauth2_token_fetcher.h" |
| 20 #include "chrome/browser/profiles/profile.h" | 21 #include "chrome/browser/profiles/profile.h" |
| 21 #include "chrome/browser/ui/webui/chromeos/login/authenticated_user_email_retrie
ver.h" | 22 #include "chrome/browser/ui/webui/chromeos/login/authenticated_user_email_retrie
ver.h" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 41 | 42 |
| 42 // Start page of GAIA authentication extension. | 43 // Start page of GAIA authentication extension. |
| 43 const char kGaiaExtStartPage[] = | 44 const char kGaiaExtStartPage[] = |
| 44 "chrome-extension://mfffpogegjflfpflabcdkioaeobkgjik/main.html"; | 45 "chrome-extension://mfffpogegjflfpflabcdkioaeobkgjik/main.html"; |
| 45 | 46 |
| 46 // Enrollment step names. | 47 // Enrollment step names. |
| 47 const char kEnrollmentStepSignin[] = "signin"; | 48 const char kEnrollmentStepSignin[] = "signin"; |
| 48 const char kEnrollmentStepSuccess[] = "success"; | 49 const char kEnrollmentStepSuccess[] = "success"; |
| 49 | 50 |
| 50 // Enrollment mode strings. | 51 // Enrollment mode strings. |
| 51 const char kEnrollmentModeManual[] = "manual"; | 52 const char* const kModeStrings[EnrollmentScreenActor::ENROLLMENT_MODE_COUNT] = |
| 52 const char kEnrollmentModeForced[] = "forced"; | 53 { "manual", "forced", "auto", "recovery" }; |
| 53 const char kEnrollmentModeAuto[] = "auto"; | |
| 54 | 54 |
| 55 std::string EnrollmentModeToString(EnrollmentScreenActor::EnrollmentMode mode) { | 55 std::string EnrollmentModeToString(EnrollmentScreenActor::EnrollmentMode mode) { |
| 56 switch (mode) { | 56 CHECK(0 <= mode && mode < EnrollmentScreenActor::ENROLLMENT_MODE_COUNT); |
| 57 case EnrollmentScreenActor::ENROLLMENT_MODE_MANUAL: | 57 return kModeStrings[mode]; |
| 58 return kEnrollmentModeManual; | |
| 59 case EnrollmentScreenActor::ENROLLMENT_MODE_FORCED: | |
| 60 return kEnrollmentModeForced; | |
| 61 case EnrollmentScreenActor::ENROLLMENT_MODE_AUTO: | |
| 62 return kEnrollmentModeAuto; | |
| 63 default: | |
| 64 NOTREACHED() << "Bad enrollment mode " << mode; | |
| 65 } | |
| 66 | |
| 67 return kEnrollmentModeManual; | |
| 68 } | 58 } |
| 69 | 59 |
| 70 // A helper class that takes care of asynchronously revoking a given token. | 60 // A helper class that takes care of asynchronously revoking a given token. |
| 71 class TokenRevoker : public GaiaAuthConsumer { | 61 class TokenRevoker : public GaiaAuthConsumer { |
| 72 public: | 62 public: |
| 73 TokenRevoker() | 63 TokenRevoker() |
| 74 : gaia_fetcher_(this, | 64 : gaia_fetcher_(this, |
| 75 GaiaConstants::kChromeOSSource, | 65 GaiaConstants::kChromeOSSource, |
| 76 g_browser_process->system_request_context()) {} | 66 g_browser_process->system_request_context()) {} |
| 77 virtual ~TokenRevoker() {} | 67 virtual ~TokenRevoker() {} |
| (...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 598 screen_data.SetString("signin_url", kGaiaExtStartPage); | 588 screen_data.SetString("signin_url", kGaiaExtStartPage); |
| 599 screen_data.SetString("gaiaUrl", GaiaUrls::GetInstance()->gaia_url().spec()); | 589 screen_data.SetString("gaiaUrl", GaiaUrls::GetInstance()->gaia_url().spec()); |
| 600 screen_data.SetString("enrollment_mode", | 590 screen_data.SetString("enrollment_mode", |
| 601 EnrollmentModeToString(enrollment_mode_)); | 591 EnrollmentModeToString(enrollment_mode_)); |
| 602 screen_data.SetString("management_domain", management_domain_); | 592 screen_data.SetString("management_domain", management_domain_); |
| 603 | 593 |
| 604 ShowScreen(OobeUI::kScreenOobeEnrollment, &screen_data); | 594 ShowScreen(OobeUI::kScreenOobeEnrollment, &screen_data); |
| 605 } | 595 } |
| 606 | 596 |
| 607 } // namespace chromeos | 597 } // namespace chromeos |
| OLD | NEW |