Chromium Code Reviews| Index: chrome/browser/ui/webui/identity_internals_ui.cc |
| diff --git a/chrome/browser/ui/webui/identity_internals_ui.cc b/chrome/browser/ui/webui/identity_internals_ui.cc |
| index a517727cb5f79240659098a31ae4e11012469472..1ec0c3befc04471737c72d74e5a356c73e1b675a 100644 |
| --- a/chrome/browser/ui/webui/identity_internals_ui.cc |
| +++ b/chrome/browser/ui/webui/identity_internals_ui.cc |
| @@ -11,6 +11,7 @@ |
| #include "base/bind.h" |
| #include "base/i18n/time_formatting.h" |
| #include "base/macros.h" |
| +#include "base/memory/ptr_util.h" |
| #include "base/strings/utf_string_conversions.h" |
| #include "base/values.h" |
| #include "chrome/browser/extensions/api/identity/identity_api.h" |
| @@ -95,7 +96,7 @@ class IdentityInternalsUIMessageHandler : public content::WebUIMessageHandler { |
| void RevokeToken(const base::ListValue* args); |
| // A vector of token revokers that are currently revoking tokens. |
| - ScopedVector<IdentityInternalsTokenRevoker> token_revokers_; |
| + std::vector<std::unique_ptr<IdentityInternalsTokenRevoker>> token_revokers_; |
| }; |
| // Handles the revoking of an access token and helps performing the clean up |
| @@ -159,8 +160,12 @@ void IdentityInternalsUIMessageHandler::OnTokenRevokerDone( |
| result); |
| // Erase the revoker. |
| - ScopedVector<IdentityInternalsTokenRevoker>::iterator iter = |
| - std::find(token_revokers_.begin(), token_revokers_.end(), token_revoker); |
| + auto iter = std::find_if( |
| + token_revokers_.begin(), token_revokers_.end(), |
| + [token_revoker]( |
| + const std::unique_ptr<IdentityInternalsTokenRevoker>& ptr) { |
| + return ptr.get() == token_revoker; |
| + }); |
|
Nico
2017/01/03 18:12:35
same
Avi (use Gerrit)
2017/01/03 22:54:53
Done.
|
| DCHECK(iter != token_revokers_.end()); |
| token_revokers_.erase(iter); |
| } |
| @@ -259,7 +264,7 @@ void IdentityInternalsUIMessageHandler::RevokeToken( |
| std::string access_token; |
| args->GetString(kRevokeTokenExtensionOffset, &extension_id); |
| args->GetString(kRevokeTokenTokenOffset, &access_token); |
| - token_revokers_.push_back(new IdentityInternalsTokenRevoker( |
| + token_revokers_.push_back(base::MakeUnique<IdentityInternalsTokenRevoker>( |
| extension_id, access_token, Profile::FromWebUI(web_ui()), this)); |
| } |