| 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/extensions/api/identity/identity_api.h" | 5 #include "chrome/browser/extensions/api/identity/identity_api.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 348 | 348 |
| 349 token_key_.reset( | 349 token_key_.reset( |
| 350 new ExtensionTokenKey(GetExtension()->id(), account_key, scopes)); | 350 new ExtensionTokenKey(GetExtension()->id(), account_key, scopes)); |
| 351 | 351 |
| 352 // From here on out, results must be returned asynchronously. | 352 // From here on out, results must be returned asynchronously. |
| 353 StartAsyncRun(); | 353 StartAsyncRun(); |
| 354 | 354 |
| 355 #if defined(OS_CHROMEOS) | 355 #if defined(OS_CHROMEOS) |
| 356 policy::BrowserPolicyConnectorChromeOS* connector = | 356 policy::BrowserPolicyConnectorChromeOS* connector = |
| 357 g_browser_process->platform_part()->browser_policy_connector_chromeos(); | 357 g_browser_process->platform_part()->browser_policy_connector_chromeos(); |
| 358 if (chromeos::UserManager::Get()->IsLoggedInAsKioskApp() && | 358 if (chromeos::GetUserManager()->IsLoggedInAsKioskApp() && |
| 359 connector->IsEnterpriseManaged()) { | 359 connector->IsEnterpriseManaged()) { |
| 360 StartMintTokenFlow(IdentityMintRequestQueue::MINT_TYPE_NONINTERACTIVE); | 360 StartMintTokenFlow(IdentityMintRequestQueue::MINT_TYPE_NONINTERACTIVE); |
| 361 return true; | 361 return true; |
| 362 } | 362 } |
| 363 #endif | 363 #endif |
| 364 | 364 |
| 365 if (!HasLoginToken()) { | 365 if (!HasLoginToken()) { |
| 366 if (!should_prompt_for_signin_) { | 366 if (!should_prompt_for_signin_) { |
| 367 CompleteFunctionWithError(identity_constants::kUserNotSignedIn); | 367 CompleteFunctionWithError(identity_constants::kUserNotSignedIn); |
| 368 return true; | 368 return true; |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 459 IdentityAPI* id_api = IdentityAPI::GetFactoryInstance()->Get(GetProfile()); | 459 IdentityAPI* id_api = IdentityAPI::GetFactoryInstance()->Get(GetProfile()); |
| 460 IdentityTokenCacheValue cache_entry = id_api->GetCachedToken(*token_key_); | 460 IdentityTokenCacheValue cache_entry = id_api->GetCachedToken(*token_key_); |
| 461 IdentityTokenCacheValue::CacheValueStatus cache_status = | 461 IdentityTokenCacheValue::CacheValueStatus cache_status = |
| 462 cache_entry.status(); | 462 cache_entry.status(); |
| 463 | 463 |
| 464 if (type == IdentityMintRequestQueue::MINT_TYPE_NONINTERACTIVE) { | 464 if (type == IdentityMintRequestQueue::MINT_TYPE_NONINTERACTIVE) { |
| 465 switch (cache_status) { | 465 switch (cache_status) { |
| 466 case IdentityTokenCacheValue::CACHE_STATUS_NOTFOUND: | 466 case IdentityTokenCacheValue::CACHE_STATUS_NOTFOUND: |
| 467 #if defined(OS_CHROMEOS) | 467 #if defined(OS_CHROMEOS) |
| 468 // Always force minting token for ChromeOS kiosk app. | 468 // Always force minting token for ChromeOS kiosk app. |
| 469 if (chromeos::UserManager::Get()->IsLoggedInAsKioskApp()) { | 469 if (chromeos::GetUserManager()->IsLoggedInAsKioskApp()) { |
| 470 gaia_mint_token_mode_ = OAuth2MintTokenFlow::MODE_MINT_TOKEN_FORCE; | 470 gaia_mint_token_mode_ = OAuth2MintTokenFlow::MODE_MINT_TOKEN_FORCE; |
| 471 policy::BrowserPolicyConnectorChromeOS* connector = | 471 policy::BrowserPolicyConnectorChromeOS* connector = |
| 472 g_browser_process->platform_part() | 472 g_browser_process->platform_part() |
| 473 ->browser_policy_connector_chromeos(); | 473 ->browser_policy_connector_chromeos(); |
| 474 if (connector->IsEnterpriseManaged()) { | 474 if (connector->IsEnterpriseManaged()) { |
| 475 StartDeviceLoginAccessTokenRequest(); | 475 StartDeviceLoginAccessTokenRequest(); |
| 476 } else { | 476 } else { |
| 477 StartLoginAccessTokenRequest(); | 477 StartLoginAccessTokenRequest(); |
| 478 } | 478 } |
| 479 return; | 479 return; |
| (...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 874 void IdentityLaunchWebAuthFlowFunction::OnAuthFlowURLChange( | 874 void IdentityLaunchWebAuthFlowFunction::OnAuthFlowURLChange( |
| 875 const GURL& redirect_url) { | 875 const GURL& redirect_url) { |
| 876 if (redirect_url.GetWithEmptyPath() == final_url_prefix_) { | 876 if (redirect_url.GetWithEmptyPath() == final_url_prefix_) { |
| 877 SetResult(new base::StringValue(redirect_url.spec())); | 877 SetResult(new base::StringValue(redirect_url.spec())); |
| 878 SendResponse(true); | 878 SendResponse(true); |
| 879 Release(); // Balanced in RunAsync. | 879 Release(); // Balanced in RunAsync. |
| 880 } | 880 } |
| 881 } | 881 } |
| 882 | 882 |
| 883 } // namespace extensions | 883 } // namespace extensions |
| OLD | NEW |