| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #import "chrome/browser/ui/cocoa/passwords/account_avatar_fetcher_manager.h" | 5 #import "chrome/browser/ui/cocoa/passwords/account_avatar_fetcher_manager.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/mac/foundation_util.h" | 9 #include "base/mac/foundation_util.h" |
| 10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 AccountAvatarFetcher* fetcher = | 72 AccountAvatarFetcher* fetcher = |
| 73 new AccountAvatarFetcher(avatarURL, bridge->AsWeakPtr()); | 73 new AccountAvatarFetcher(avatarURL, bridge->AsWeakPtr()); |
| 74 bridges_.push_back(std::move(bridge)); | 74 bridges_.push_back(std::move(bridge)); |
| 75 [self startRequestWithFetcher:fetcher]; | 75 [self startRequestWithFetcher:fetcher]; |
| 76 } | 76 } |
| 77 | 77 |
| 78 - (void)updateAvatar:(NSImage*)image | 78 - (void)updateAvatar:(NSImage*)image |
| 79 fromBridge:(AccountAvatarFetcherBridge*)bridge | 79 fromBridge:(AccountAvatarFetcherBridge*)bridge |
| 80 forView:(CredentialItemButton*)view { | 80 forView:(CredentialItemButton*)view { |
| 81 [view setImage:image]; | 81 [view setImage:image]; |
| 82 auto it = std::find(bridges_.begin(), bridges_.end(), bridge); | 82 for (auto it = bridges_.begin(); it != bridges_.end(); it++) { |
| 83 if (it != bridges_.end()) | 83 if (it->get() == bridge) { |
| 84 bridges_.erase(it); | 84 bridges_.erase(it); |
| 85 return; |
| 86 } |
| 87 } |
| 85 } | 88 } |
| 86 | 89 |
| 87 @end | 90 @end |
| OLD | NEW |