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

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

Issue 1864583006: Simplify BrowserContext by removing redundant methods. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix Created 4 years, 8 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
OLDNEW
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 "extensions/shell/browser/api/identity/identity_api.h" 5 #include "extensions/shell/browser/api/identity/identity_api.h"
6 6
7 #include <set> 7 #include <set>
8 #include <string> 8 #include <string>
9 9
10 #include "base/guid.h" 10 #include "base/guid.h"
11 #include "content/public/browser/browser_context.h" 11 #include "content/public/browser/browser_context.h"
12 #include "content/public/browser/storage_partition.h"
12 #include "extensions/common/manifest_handlers/oauth2_manifest_handler.h" 13 #include "extensions/common/manifest_handlers/oauth2_manifest_handler.h"
13 #include "extensions/shell/browser/shell_oauth2_token_service.h" 14 #include "extensions/shell/browser/shell_oauth2_token_service.h"
14 #include "extensions/shell/common/api/identity.h" 15 #include "extensions/shell/common/api/identity.h"
15 #include "google_apis/gaia/gaia_auth_util.h" 16 #include "google_apis/gaia/gaia_auth_util.h"
16 17
17 namespace extensions { 18 namespace extensions {
18 namespace shell { 19 namespace shell {
19 20
20 namespace { 21 namespace {
21 const char kIdentityApiId[] = "identity_api"; 22 const char kIdentityApiId[] = "identity_api";
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 this, 103 this,
103 OAuth2MintTokenFlow::Parameters( 104 OAuth2MintTokenFlow::Parameters(
104 extension()->id(), 105 extension()->id(),
105 oauth2_info.client_id, 106 oauth2_info.client_id,
106 oauth2_info.scopes, 107 oauth2_info.scopes,
107 IdentityAPI::Get(browser_context())->device_id(), 108 IdentityAPI::Get(browser_context())->device_id(),
108 OAuth2MintTokenFlow::MODE_MINT_TOKEN_FORCE))); 109 OAuth2MintTokenFlow::MODE_MINT_TOKEN_FORCE)));
109 } 110 }
110 111
111 // Use the logging-in-user access token to mint an access token for this app. 112 // Use the logging-in-user access token to mint an access token for this app.
112 mint_token_flow_->Start(browser_context()->GetRequestContext(), access_token); 113 mint_token_flow_->Start(
114 content::BrowserContext::GetDefaultStoragePartition(browser_context())->
115 GetURLRequestContext(),
116 access_token);
113 } 117 }
114 118
115 void IdentityGetAuthTokenFunction::OnGetTokenFailure( 119 void IdentityGetAuthTokenFunction::OnGetTokenFailure(
116 const OAuth2TokenService::Request* request, 120 const OAuth2TokenService::Request* request,
117 const GoogleServiceAuthError& error) { 121 const GoogleServiceAuthError& error) {
118 Respond(Error(error.ToString())); 122 Respond(Error(error.ToString()));
119 Release(); // Balanced in Run(). 123 Release(); // Balanced in Run().
120 } 124 }
121 125
122 void IdentityGetAuthTokenFunction::OnMintTokenSuccess( 126 void IdentityGetAuthTokenFunction::OnMintTokenSuccess(
(...skipping 28 matching lines...) Expand all
151 scoped_ptr<api::identity::RemoveCachedAuthToken::Params> params( 155 scoped_ptr<api::identity::RemoveCachedAuthToken::Params> params(
152 api::identity::RemoveCachedAuthToken::Params::Create(*args_)); 156 api::identity::RemoveCachedAuthToken::Params::Create(*args_));
153 EXTENSION_FUNCTION_VALIDATE(params.get()); 157 EXTENSION_FUNCTION_VALIDATE(params.get());
154 // This stub identity API does not maintain a token cache, so there is nothing 158 // This stub identity API does not maintain a token cache, so there is nothing
155 // to remove. 159 // to remove.
156 return RespondNow(NoArguments()); 160 return RespondNow(NoArguments());
157 } 161 }
158 162
159 } // namespace shell 163 } // namespace shell
160 } // namespace extensions 164 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698