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..4ee48731dfbdad1251f59ada654251daa5adf2d7 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,11 @@ void IdentityInternalsUIMessageHandler::OnTokenRevokerDone( |
| result); |
| // Erase the revoker. |
| - ScopedVector<IdentityInternalsTokenRevoker>::iterator iter = |
| - std::find(token_revokers_.begin(), token_revokers_.end(), token_revoker); |
| + auto iter = token_revokers_.begin(); |
| + for (; iter != token_revokers_.end(); ++iter) { |
| + if (iter->get() == token_revoker) |
| + break; |
| + } |
| DCHECK(iter != token_revokers_.end()); |
| token_revokers_.erase(iter); |
|
Bernhard Bauer
2017/01/04 11:20:09
Can you move this inside the loop and then make it
Avi (use Gerrit)
2017/01/04 16:42:34
I can't switch to an object iterator because I can
|
| } |
| @@ -259,7 +263,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)); |
| } |