Chromium Code Reviews| 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_CHROMEOS_LOGIN_POLICY_OAUTH_FETCHER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_POLICY_OAUTH_FETCHER_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_POLICY_OAUTH_FETCHER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_POLICY_OAUTH_FETCHER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
| 12 #include "chrome/browser/net/gaia/gaia_oauth_consumer.h" | 12 #include "chrome/browser/net/gaia/gaia_oauth_consumer.h" |
| 13 #include "chrome/browser/net/gaia/gaia_oauth_fetcher.h" | 13 #include "chrome/browser/net/gaia/gaia_oauth_fetcher.h" |
| 14 | 14 |
| 15 class Profile; | 15 class Profile; |
|
Joao da Silva
2013/01/11 20:13:15
Not used
zel
2013/01/11 20:54:20
Done.
| |
| 16 | 16 |
| 17 namespace chromeos { | 17 namespace chromeos { |
| 18 | 18 |
| 19 // Fetches the oauth token for the device management service. Since Profile | 19 // Fetches the oauth token for the device management service. Since Profile |
| 20 // creation might be blocking on a user policy fetch, this fetcher must always | 20 // creation might be blocking on a user policy fetch, this fetcher must always |
| 21 // send a (possibly empty) token to the BrowserPolicyConnector, which will then | 21 // send a (possibly empty) token to the BrowserPolicyConnector, which will then |
| 22 // let the policy subsystem proceed and resume Profile creation. | 22 // let the policy subsystem proceed and resume Profile creation. |
| 23 // Sending the token even when no Profile is pending is also OK. | 23 // Sending the token even when no Profile is pending is also OK. |
| 24 class PolicyOAuthFetcher : public GaiaOAuthConsumer { | 24 class PolicyOAuthFetcher : public GaiaOAuthConsumer { |
| 25 public: | 25 public: |
| 26 // Fetches the device management service's oauth token using |oauth1_token| | 26 // Fetches the device management service's oauth token using |oauth1_token| |
| 27 // and |oauth1_secret| as access tokens. | 27 // and |oauth1_secret| as access tokens. |
| 28 PolicyOAuthFetcher(Profile* profile, | 28 PolicyOAuthFetcher(net::URLRequestContextGetter* context_getter, |
|
Joao da Silva
2013/01/11 20:13:15
Forward decl for URLRequestContextGetter
zel
2013/01/11 20:54:20
Done.
| |
| 29 const std::string& oauth1_token, | 29 const std::string& oauth1_token, |
| 30 const std::string& oauth1_secret); | 30 const std::string& oauth1_secret); |
| 31 // Fetches the device management service's oauth token, after also retrieving | 31 // Fetches the device management service's oauth token, after also retrieving |
| 32 // the access tokens. | 32 // the access tokens. |
| 33 explicit PolicyOAuthFetcher(Profile* profile); | 33 explicit PolicyOAuthFetcher(net::URLRequestContextGetter* context_getter); |
| 34 virtual ~PolicyOAuthFetcher(); | 34 virtual ~PolicyOAuthFetcher(); |
| 35 | 35 |
| 36 void Start(); | 36 void Start(); |
| 37 | 37 |
| 38 const std::string& oauth1_token() const { return oauth1_token_; } | 38 const std::string& oauth1_token() const { return oauth1_token_; } |
| 39 const std::string& oauth1_secret() const { return oauth1_secret_; } | 39 const std::string& oauth1_secret() const { return oauth1_secret_; } |
| 40 bool failed() const { | 40 bool failed() const { |
| 41 return !oauth_fetcher_.HasPendingFetch() && policy_token_.empty(); | 41 return !oauth_fetcher_.HasPendingFetch() && policy_token_.empty(); |
| 42 } | 42 } |
| 43 | 43 |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 65 std::string oauth1_token_; | 65 std::string oauth1_token_; |
| 66 std::string oauth1_secret_; | 66 std::string oauth1_secret_; |
| 67 std::string policy_token_; | 67 std::string policy_token_; |
| 68 | 68 |
| 69 DISALLOW_COPY_AND_ASSIGN(PolicyOAuthFetcher); | 69 DISALLOW_COPY_AND_ASSIGN(PolicyOAuthFetcher); |
| 70 }; | 70 }; |
| 71 | 71 |
| 72 } // namespace chromeos | 72 } // namespace chromeos |
| 73 | 73 |
| 74 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_POLICY_OAUTH_FETCHER_H_ | 74 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_POLICY_OAUTH_FETCHER_H_ |
| OLD | NEW |