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 #include "chrome/browser/chromeos/policy/wildcard_login_checker.h" | 5 #include "chrome/browser/chromeos/policy/wildcard_login_checker.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
10 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
(...skipping 26 matching lines...) Expand all Loading... |
37 void WildcardLoginChecker::Start( | 37 void WildcardLoginChecker::Start( |
38 scoped_refptr<net::URLRequestContextGetter> signin_context, | 38 scoped_refptr<net::URLRequestContextGetter> signin_context, |
39 const StatusCallback& callback) { | 39 const StatusCallback& callback) { |
40 CHECK(!token_fetcher_); | 40 CHECK(!token_fetcher_); |
41 CHECK(!user_info_fetcher_); | 41 CHECK(!user_info_fetcher_); |
42 | 42 |
43 start_timestamp_ = base::Time::Now(); | 43 start_timestamp_ = base::Time::Now(); |
44 | 44 |
45 callback_ = callback; | 45 callback_ = callback; |
46 token_fetcher_.reset(new PolicyOAuth2TokenFetcher( | 46 token_fetcher_.reset(new PolicyOAuth2TokenFetcher( |
47 signin_context, | 47 signin_context.get(), |
48 g_browser_process->system_request_context(), | 48 g_browser_process->system_request_context(), |
49 base::Bind(&WildcardLoginChecker::OnPolicyTokenFetched, | 49 base::Bind(&WildcardLoginChecker::OnPolicyTokenFetched, |
50 base::Unretained(this)))); | 50 base::Unretained(this)))); |
51 token_fetcher_->Start(); | 51 token_fetcher_->Start(); |
52 } | 52 } |
53 | 53 |
54 void WildcardLoginChecker::StartWithAccessToken( | 54 void WildcardLoginChecker::StartWithAccessToken( |
55 const std::string& access_token, | 55 const std::string& access_token, |
56 const StatusCallback& callback) { | 56 const StatusCallback& callback) { |
57 CHECK(!token_fetcher_); | 57 CHECK(!token_fetcher_); |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 new UserInfoFetcher(this, g_browser_process->system_request_context())); | 106 new UserInfoFetcher(this, g_browser_process->system_request_context())); |
107 user_info_fetcher_->Start(access_token); | 107 user_info_fetcher_->Start(access_token); |
108 } | 108 } |
109 | 109 |
110 void WildcardLoginChecker::OnCheckCompleted(Result result) { | 110 void WildcardLoginChecker::OnCheckCompleted(Result result) { |
111 if (!callback_.is_null()) | 111 if (!callback_.is_null()) |
112 callback_.Run(result); | 112 callback_.Run(result); |
113 } | 113 } |
114 | 114 |
115 } // namespace policy | 115 } // namespace policy |
OLD | NEW |