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 auto it = std::find_if( |
83 bridges_.begin(), bridges_.end(), | |
84 [bridge](const std::unique_ptr<AccountAvatarFetcherBridge>& ptr) { | |
85 return ptr.get() == bridge; | |
86 }); | |
83 if (it != bridges_.end()) | 87 if (it != bridges_.end()) |
84 bridges_.erase(it); | 88 bridges_.erase(it); |
Nico
2017/01/03 18:12:35
nit: fwiw I find
for (const auto& it = bridges_
Avi (use Gerrit)
2017/01/03 22:54:53
Done.
| |
85 } | 89 } |
86 | 90 |
87 @end | 91 @end |
OLD | NEW |