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_WILDCARD_LOGIN_CHECKER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_POLICY_WILDCARD_LOGIN_CHECKER_H_ |
6 #define CHROME_BROWSER_CHROMEOS_POLICY_WILDCARD_LOGIN_CHECKER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_POLICY_WILDCARD_LOGIN_CHECKER_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 29 matching lines...) Expand all Loading... |
40 // Starts checking. The result will be reported via |callback_|. | 40 // Starts checking. The result will be reported via |callback_|. |
41 void Start(scoped_refptr<net::URLRequestContextGetter> signin_context, | 41 void Start(scoped_refptr<net::URLRequestContextGetter> signin_context, |
42 const StatusCallback& callback); | 42 const StatusCallback& callback); |
43 | 43 |
44 // Starts checking with a provided access token. | 44 // Starts checking with a provided access token. |
45 void StartWithAccessToken(const std::string& access_token, | 45 void StartWithAccessToken(const std::string& access_token, |
46 const StatusCallback& callback); | 46 const StatusCallback& callback); |
47 | 47 |
48 // UserInfoFetcher::Delegate: | 48 // UserInfoFetcher::Delegate: |
49 virtual void OnGetUserInfoSuccess(const base::DictionaryValue* response) | 49 virtual void OnGetUserInfoSuccess(const base::DictionaryValue* response) |
50 OVERRIDE; | 50 override; |
51 virtual void OnGetUserInfoFailure(const GoogleServiceAuthError& error) | 51 virtual void OnGetUserInfoFailure(const GoogleServiceAuthError& error) |
52 OVERRIDE; | 52 override; |
53 | 53 |
54 private: | 54 private: |
55 // Starts the check after successful token minting. | 55 // Starts the check after successful token minting. |
56 void OnPolicyTokenFetched(const std::string& access_token, | 56 void OnPolicyTokenFetched(const std::string& access_token, |
57 const GoogleServiceAuthError& error); | 57 const GoogleServiceAuthError& error); |
58 | 58 |
59 // Starts the user info fetcher. | 59 // Starts the user info fetcher. |
60 void StartUserInfoFetcher(const std::string& access_token); | 60 void StartUserInfoFetcher(const std::string& access_token); |
61 | 61 |
62 // Handles the response of the check and calls ReportResult(). | 62 // Handles the response of the check and calls ReportResult(). |
63 void OnCheckCompleted(Result result); | 63 void OnCheckCompleted(Result result); |
64 | 64 |
65 StatusCallback callback_; | 65 StatusCallback callback_; |
66 | 66 |
67 scoped_ptr<PolicyOAuth2TokenFetcher> token_fetcher_; | 67 scoped_ptr<PolicyOAuth2TokenFetcher> token_fetcher_; |
68 scoped_ptr<UserInfoFetcher> user_info_fetcher_; | 68 scoped_ptr<UserInfoFetcher> user_info_fetcher_; |
69 | 69 |
70 base::Time start_timestamp_; | 70 base::Time start_timestamp_; |
71 base::Time token_available_timestamp_; | 71 base::Time token_available_timestamp_; |
72 | 72 |
73 DISALLOW_COPY_AND_ASSIGN(WildcardLoginChecker); | 73 DISALLOW_COPY_AND_ASSIGN(WildcardLoginChecker); |
74 }; | 74 }; |
75 | 75 |
76 } // namespace policy | 76 } // namespace policy |
77 | 77 |
78 #endif // CHROME_BROWSER_CHROMEOS_POLICY_WILDCARD_LOGIN_CHECKER_H_ | 78 #endif // CHROME_BROWSER_CHROMEOS_POLICY_WILDCARD_LOGIN_CHECKER_H_ |
OLD | NEW |