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