OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_CHROMEOS_POLICY_CONSUMER_ENROLLMENT_HANDLER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_POLICY_CONSUMER_ENROLLMENT_HANDLER_H_ |
6 #define CHROME_BROWSER_CHROMEOS_POLICY_CONSUMER_ENROLLMENT_HANDLER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_POLICY_CONSUMER_ENROLLMENT_HANDLER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 const base::Time& expiration_time) override; | 46 const base::Time& expiration_time) override; |
47 virtual void OnGetTokenFailure( | 47 virtual void OnGetTokenFailure( |
48 const OAuth2TokenService::Request* request, | 48 const OAuth2TokenService::Request* request, |
49 const GoogleServiceAuthError& error) override; | 49 const GoogleServiceAuthError& error) override; |
50 | 50 |
51 OAuth2TokenService::Request* GetTokenRequestForTesting() { | 51 OAuth2TokenService::Request* GetTokenRequestForTesting() { |
52 return token_request_.get(); | 52 return token_request_.get(); |
53 } | 53 } |
54 | 54 |
55 private: | 55 private: |
56 void Start(); | |
57 | |
58 // Continues the enrollment process after the owner ID is stored into the boot | 56 // Continues the enrollment process after the owner ID is stored into the boot |
59 // lockbox and the owner signs in. | 57 // lockbox and the owner signs in. |
60 void ContinueEnrollmentProcess(); | 58 void ContinueEnrollmentProcess(); |
61 | 59 |
62 // Called when the owner's refresh token is available. | 60 // Called when the owner's refresh token is available. |
63 void OnOwnerRefreshTokenAvailable(); | 61 void OnOwnerRefreshTokenAvailable(); |
64 | 62 |
65 // Called when the owner's access token for device management is available. | 63 // Called when the owner's access token for device management is available. |
66 void OnOwnerAccessTokenAvailable(const std::string& access_token); | 64 void OnOwnerAccessTokenAvailable(const std::string& access_token); |
67 | 65 |
68 // Called upon the completion of the enrollment process. | 66 // Called upon the completion of the enrollment process. |
69 void OnEnrollmentCompleted(EnrollmentStatus status); | 67 void OnEnrollmentCompleted(EnrollmentStatus status); |
70 | 68 |
71 // Ends the enrollment process and shows a desktop notification if the | 69 // Ends the enrollment process. |
72 // current user is the owner. | |
73 void EndEnrollment(ConsumerManagementService::EnrollmentStage stage); | 70 void EndEnrollment(ConsumerManagementService::EnrollmentStage stage); |
74 | 71 |
75 // Shows a desktop notification and resets the enrollment stage. | |
76 void ShowDesktopNotificationAndResetStage( | |
77 ConsumerManagementService::EnrollmentStage stage); | |
78 | |
79 // Opens the settings page. | |
80 void OpenSettingsPage() const; | |
81 | |
82 // Opens the enrollment confirmation dialog in the settings page. | |
83 void TryEnrollmentAgain() const; | |
84 | |
85 Profile* profile_; | 72 Profile* profile_; |
86 ConsumerManagementService* consumer_management_service_; | 73 ConsumerManagementService* consumer_management_service_; |
87 DeviceManagementService* device_management_service_; | 74 DeviceManagementService* device_management_service_; |
88 std::string gaia_account_id_; | 75 std::string gaia_account_id_; |
89 | 76 |
90 scoped_ptr<OAuth2TokenService::Request> token_request_; | 77 scoped_ptr<OAuth2TokenService::Request> token_request_; |
91 base::WeakPtrFactory<ConsumerEnrollmentHandler> weak_ptr_factory_; | 78 base::WeakPtrFactory<ConsumerEnrollmentHandler> weak_ptr_factory_; |
92 | 79 |
93 DISALLOW_COPY_AND_ASSIGN(ConsumerEnrollmentHandler); | 80 DISALLOW_COPY_AND_ASSIGN(ConsumerEnrollmentHandler); |
94 }; | 81 }; |
95 | 82 |
96 } // namespace policy | 83 } // namespace policy |
97 | 84 |
98 #endif // CHROME_BROWSER_CHROMEOS_POLICY_CONSUMER_ENROLLMENT_HANDLER_H_ | 85 #endif // CHROME_BROWSER_CHROMEOS_POLICY_CONSUMER_ENROLLMENT_HANDLER_H_ |
OLD | NEW |