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 #include "chrome/browser/chromeos/login/policy_oauth_fetcher.h" | 5 #include "chrome/browser/chromeos/login/policy_oauth_fetcher.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "chrome/browser/browser_process.h" | 8 #include "chrome/browser/browser_process.h" |
| 9 #include "chrome/browser/policy/browser_policy_connector.h" | 9 #include "chrome/browser/policy/browser_policy_connector.h" |
| 10 #include "chrome/browser/policy/user_cloud_policy_manager_chromeos.h" | 10 #include "chrome/browser/policy/user_cloud_policy_manager_chromeos.h" |
| 11 #include "chrome/browser/profiles/profile.h" | 11 #include "chrome/browser/profiles/profile.h" |
| 12 #include "chrome/browser/profiles/profile_manager.h" | 12 #include "chrome/browser/profiles/profile_manager.h" |
|
Joao da Silva
2013/01/11 20:13:15
These 2 aren't used
zel
2013/01/11 20:54:20
Done.
| |
| 13 #include "google_apis/gaia/gaia_constants.h" | 13 #include "google_apis/gaia/gaia_constants.h" |
| 14 #include "google_apis/gaia/google_service_auth_error.h" | 14 #include "google_apis/gaia/google_service_auth_error.h" |
| 15 | 15 |
| 16 namespace chromeos { | 16 namespace chromeos { |
| 17 | 17 |
| 18 namespace { | 18 namespace { |
| 19 const char kServiceScopeChromeOSDeviceManagement[] = | 19 const char kServiceScopeChromeOSDeviceManagement[] = |
| 20 "https://www.googleapis.com/auth/chromeosdevicemanagement"; | 20 "https://www.googleapis.com/auth/chromeosdevicemanagement"; |
| 21 } // namespace | 21 } // namespace |
| 22 | 22 |
| 23 PolicyOAuthFetcher::PolicyOAuthFetcher(Profile* profile, | 23 PolicyOAuthFetcher::PolicyOAuthFetcher( |
| 24 const std::string& oauth1_token, | 24 net::URLRequestContextGetter* context_getter, |
| 25 const std::string& oauth1_secret) | 25 const std::string& oauth1_token, |
| 26 const std::string& oauth1_secret) | |
| 26 : oauth_fetcher_(this, | 27 : oauth_fetcher_(this, |
| 27 profile->GetRequestContext(), | 28 context_getter, |
| 28 kServiceScopeChromeOSDeviceManagement), | 29 kServiceScopeChromeOSDeviceManagement), |
| 29 oauth1_token_(oauth1_token), | 30 oauth1_token_(oauth1_token), |
| 30 oauth1_secret_(oauth1_secret) { | 31 oauth1_secret_(oauth1_secret) { |
| 31 } | 32 } |
| 32 | 33 |
| 33 PolicyOAuthFetcher::PolicyOAuthFetcher(Profile* profile) | 34 PolicyOAuthFetcher::PolicyOAuthFetcher( |
| 35 net::URLRequestContextGetter* context_getter) | |
| 34 : oauth_fetcher_(this, | 36 : oauth_fetcher_(this, |
| 35 profile->GetRequestContext(), | 37 context_getter, |
| 36 kServiceScopeChromeOSDeviceManagement) { | 38 kServiceScopeChromeOSDeviceManagement) { |
| 37 } | 39 } |
| 38 | 40 |
| 39 PolicyOAuthFetcher::~PolicyOAuthFetcher() { | 41 PolicyOAuthFetcher::~PolicyOAuthFetcher() { |
| 40 } | 42 } |
| 41 | 43 |
| 42 void PolicyOAuthFetcher::Start() { | 44 void PolicyOAuthFetcher::Start() { |
| 43 oauth_fetcher_.SetAutoFetchLimit( | 45 oauth_fetcher_.SetAutoFetchLimit( |
| 44 GaiaOAuthFetcher::OAUTH2_SERVICE_ACCESS_TOKEN); | 46 GaiaOAuthFetcher::OAUTH2_SERVICE_ACCESS_TOKEN); |
| 45 | 47 |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 104 browser_policy_connector->GetUserCloudPolicyManager(); | 106 browser_policy_connector->GetUserCloudPolicyManager(); |
| 105 if (cloud_policy_manager) { | 107 if (cloud_policy_manager) { |
| 106 if (token.empty()) | 108 if (token.empty()) |
| 107 cloud_policy_manager->CancelWaitForPolicyFetch(); | 109 cloud_policy_manager->CancelWaitForPolicyFetch(); |
| 108 else | 110 else |
| 109 cloud_policy_manager->RegisterClient(token); | 111 cloud_policy_manager->RegisterClient(token); |
| 110 } | 112 } |
| 111 } | 113 } |
| 112 | 114 |
| 113 } // namespace chromeos | 115 } // namespace chromeos |
| OLD | NEW |