Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(595)

Side by Side Diff: chrome/browser/extensions/api/identity/identity_api.cc

Issue 444903002: [cros] user_manager component - move UserManagerBase and UserManager (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 22 matching lines...) Expand all
33 #include "extensions/browser/event_router.h" 33 #include "extensions/browser/event_router.h"
34 #include "extensions/browser/extension_function_dispatcher.h" 34 #include "extensions/browser/extension_function_dispatcher.h"
35 #include "extensions/common/extension.h" 35 #include "extensions/common/extension.h"
36 #include "extensions/common/permissions/permission_set.h" 36 #include "extensions/common/permissions/permission_set.h"
37 #include "extensions/common/permissions/permissions_data.h" 37 #include "extensions/common/permissions/permissions_data.h"
38 #include "google_apis/gaia/gaia_urls.h" 38 #include "google_apis/gaia/gaia_urls.h"
39 #include "url/gurl.h" 39 #include "url/gurl.h"
40 40
41 #if defined(OS_CHROMEOS) 41 #if defined(OS_CHROMEOS)
42 #include "chrome/browser/chromeos/login/session/user_session_manager.h" 42 #include "chrome/browser/chromeos/login/session/user_session_manager.h"
43 #include "chrome/browser/chromeos/login/users/user_manager.h"
44 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" 43 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h"
45 #include "chrome/browser/chromeos/settings/device_oauth2_token_service.h" 44 #include "chrome/browser/chromeos/settings/device_oauth2_token_service.h"
46 #include "chrome/browser/chromeos/settings/device_oauth2_token_service_factory.h " 45 #include "chrome/browser/chromeos/settings/device_oauth2_token_service_factory.h "
46 #include "components/user_manager/user_manager.h"
47 #include "google_apis/gaia/gaia_constants.h" 47 #include "google_apis/gaia/gaia_constants.h"
48 #endif 48 #endif
49 49
50 namespace extensions { 50 namespace extensions {
51 51
52 namespace identity_constants { 52 namespace identity_constants {
53 const char kInvalidClientId[] = "Invalid OAuth2 Client ID."; 53 const char kInvalidClientId[] = "Invalid OAuth2 Client ID.";
54 const char kInvalidScopes[] = "Invalid OAuth2 scopes."; 54 const char kInvalidScopes[] = "Invalid OAuth2 scopes.";
55 const char kAuthFailure[] = "OAuth2 request failed: "; 55 const char kAuthFailure[] = "OAuth2 request failed: ";
56 const char kNoGrant[] = "OAuth2 not granted or revoked."; 56 const char kNoGrant[] = "OAuth2 not granted or revoked.";
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 360
361 token_key_.reset( 361 token_key_.reset(
362 new ExtensionTokenKey(extension()->id(), account_key, scopes)); 362 new ExtensionTokenKey(extension()->id(), account_key, scopes));
363 363
364 // From here on out, results must be returned asynchronously. 364 // From here on out, results must be returned asynchronously.
365 StartAsyncRun(); 365 StartAsyncRun();
366 366
367 #if defined(OS_CHROMEOS) 367 #if defined(OS_CHROMEOS)
368 policy::BrowserPolicyConnectorChromeOS* connector = 368 policy::BrowserPolicyConnectorChromeOS* connector =
369 g_browser_process->platform_part()->browser_policy_connector_chromeos(); 369 g_browser_process->platform_part()->browser_policy_connector_chromeos();
370 if (chromeos::UserManager::Get()->IsLoggedInAsKioskApp() && 370 if (user_manager::UserManager::Get()->IsLoggedInAsKioskApp() &&
371 connector->IsEnterpriseManaged()) { 371 connector->IsEnterpriseManaged()) {
372 StartMintTokenFlow(IdentityMintRequestQueue::MINT_TYPE_NONINTERACTIVE); 372 StartMintTokenFlow(IdentityMintRequestQueue::MINT_TYPE_NONINTERACTIVE);
373 return true; 373 return true;
374 } 374 }
375 #endif 375 #endif
376 376
377 if (!HasLoginToken()) { 377 if (!HasLoginToken()) {
378 if (!should_prompt_for_signin_) { 378 if (!should_prompt_for_signin_) {
379 CompleteFunctionWithError(identity_constants::kUserNotSignedIn); 379 CompleteFunctionWithError(identity_constants::kUserNotSignedIn);
380 return true; 380 return true;
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
484 IdentityAPI* id_api = IdentityAPI::GetFactoryInstance()->Get(GetProfile()); 484 IdentityAPI* id_api = IdentityAPI::GetFactoryInstance()->Get(GetProfile());
485 IdentityTokenCacheValue cache_entry = id_api->GetCachedToken(*token_key_); 485 IdentityTokenCacheValue cache_entry = id_api->GetCachedToken(*token_key_);
486 IdentityTokenCacheValue::CacheValueStatus cache_status = 486 IdentityTokenCacheValue::CacheValueStatus cache_status =
487 cache_entry.status(); 487 cache_entry.status();
488 488
489 if (type == IdentityMintRequestQueue::MINT_TYPE_NONINTERACTIVE) { 489 if (type == IdentityMintRequestQueue::MINT_TYPE_NONINTERACTIVE) {
490 switch (cache_status) { 490 switch (cache_status) {
491 case IdentityTokenCacheValue::CACHE_STATUS_NOTFOUND: 491 case IdentityTokenCacheValue::CACHE_STATUS_NOTFOUND:
492 #if defined(OS_CHROMEOS) 492 #if defined(OS_CHROMEOS)
493 // Always force minting token for ChromeOS kiosk app. 493 // Always force minting token for ChromeOS kiosk app.
494 if (chromeos::UserManager::Get()->IsLoggedInAsKioskApp()) { 494 if (user_manager::UserManager::Get()->IsLoggedInAsKioskApp()) {
495 gaia_mint_token_mode_ = OAuth2MintTokenFlow::MODE_MINT_TOKEN_FORCE; 495 gaia_mint_token_mode_ = OAuth2MintTokenFlow::MODE_MINT_TOKEN_FORCE;
496 policy::BrowserPolicyConnectorChromeOS* connector = 496 policy::BrowserPolicyConnectorChromeOS* connector =
497 g_browser_process->platform_part() 497 g_browser_process->platform_part()
498 ->browser_policy_connector_chromeos(); 498 ->browser_policy_connector_chromeos();
499 if (connector->IsEnterpriseManaged()) { 499 if (connector->IsEnterpriseManaged()) {
500 StartDeviceLoginAccessTokenRequest(); 500 StartDeviceLoginAccessTokenRequest();
501 } else { 501 } else {
502 StartLoginAccessTokenRequest(); 502 StartLoginAccessTokenRequest();
503 } 503 }
504 return; 504 return;
(...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after
943 void IdentityLaunchWebAuthFlowFunction::OnAuthFlowURLChange( 943 void IdentityLaunchWebAuthFlowFunction::OnAuthFlowURLChange(
944 const GURL& redirect_url) { 944 const GURL& redirect_url) {
945 if (redirect_url.GetWithEmptyPath() == final_url_prefix_) { 945 if (redirect_url.GetWithEmptyPath() == final_url_prefix_) {
946 SetResult(new base::StringValue(redirect_url.spec())); 946 SetResult(new base::StringValue(redirect_url.spec()));
947 SendResponse(true); 947 SendResponse(true);
948 Release(); // Balanced in RunAsync. 948 Release(); // Balanced in RunAsync.
949 } 949 }
950 } 950 }
951 951
952 } // namespace extensions 952 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698