| OLD | NEW |
| 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 "base/memory/ptr_util.h" | |
| 12 #include "content/public/browser/browser_context.h" | 11 #include "content/public/browser/browser_context.h" |
| 13 #include "content/public/browser/storage_partition.h" | 12 #include "content/public/browser/storage_partition.h" |
| 14 #include "extensions/common/manifest_handlers/oauth2_manifest_handler.h" | 13 #include "extensions/common/manifest_handlers/oauth2_manifest_handler.h" |
| 15 #include "extensions/shell/browser/shell_oauth2_token_service.h" | 14 #include "extensions/shell/browser/shell_oauth2_token_service.h" |
| 16 #include "extensions/shell/common/api/identity.h" | 15 #include "extensions/shell/common/api/identity.h" |
| 17 #include "google_apis/gaia/gaia_auth_util.h" | 16 #include "google_apis/gaia/gaia_auth_util.h" |
| 18 | 17 |
| 19 namespace extensions { | 18 namespace extensions { |
| 20 namespace shell { | 19 namespace shell { |
| 21 | 20 |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 void IdentityGetAuthTokenFunction::OnGetTokenFailure( | 119 void IdentityGetAuthTokenFunction::OnGetTokenFailure( |
| 121 const OAuth2TokenService::Request* request, | 120 const OAuth2TokenService::Request* request, |
| 122 const GoogleServiceAuthError& error) { | 121 const GoogleServiceAuthError& error) { |
| 123 Respond(Error(error.ToString())); | 122 Respond(Error(error.ToString())); |
| 124 Release(); // Balanced in Run(). | 123 Release(); // Balanced in Run(). |
| 125 } | 124 } |
| 126 | 125 |
| 127 void IdentityGetAuthTokenFunction::OnMintTokenSuccess( | 126 void IdentityGetAuthTokenFunction::OnMintTokenSuccess( |
| 128 const std::string& access_token, | 127 const std::string& access_token, |
| 129 int time_to_live) { | 128 int time_to_live) { |
| 130 Respond(OneArgument(base::MakeUnique<base::StringValue>(access_token))); | 129 Respond(OneArgument(new base::StringValue(access_token))); |
| 131 Release(); // Balanced in Run(). | 130 Release(); // Balanced in Run(). |
| 132 } | 131 } |
| 133 | 132 |
| 134 void IdentityGetAuthTokenFunction::OnIssueAdviceSuccess( | 133 void IdentityGetAuthTokenFunction::OnIssueAdviceSuccess( |
| 135 const IssueAdviceInfo& issue_advice) { | 134 const IssueAdviceInfo& issue_advice) { |
| 136 Respond(Error(kErrorUserPermissionRequired)); | 135 Respond(Error(kErrorUserPermissionRequired)); |
| 137 Release(); // Balanced in Run(). | 136 Release(); // Balanced in Run(). |
| 138 } | 137 } |
| 139 | 138 |
| 140 void IdentityGetAuthTokenFunction::OnMintTokenFailure( | 139 void IdentityGetAuthTokenFunction::OnMintTokenFailure( |
| (...skipping 15 matching lines...) Expand all Loading... |
| 156 std::unique_ptr<api::identity::RemoveCachedAuthToken::Params> params( | 155 std::unique_ptr<api::identity::RemoveCachedAuthToken::Params> params( |
| 157 api::identity::RemoveCachedAuthToken::Params::Create(*args_)); | 156 api::identity::RemoveCachedAuthToken::Params::Create(*args_)); |
| 158 EXTENSION_FUNCTION_VALIDATE(params.get()); | 157 EXTENSION_FUNCTION_VALIDATE(params.get()); |
| 159 // 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 |
| 160 // to remove. | 159 // to remove. |
| 161 return RespondNow(NoArguments()); | 160 return RespondNow(NoArguments()); |
| 162 } | 161 } |
| 163 | 162 |
| 164 } // namespace shell | 163 } // namespace shell |
| 165 } // namespace extensions | 164 } // namespace extensions |
| OLD | NEW |