Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(69)

Side by Side Diff: components/proximity_auth/cryptauth/mock_cryptauth_client.cc

Issue 2423353002: Reduce usage of FOR_EACH_OBSERVER macro in components/ (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 #include "components/proximity_auth/cryptauth/mock_cryptauth_client.h" 5 #include "components/proximity_auth/cryptauth/mock_cryptauth_client.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/callback.h" 9 #include "base/callback.h"
10 10
(...skipping 12 matching lines...) Expand all
23 MockCryptAuthClientFactory::~MockCryptAuthClientFactory() { 23 MockCryptAuthClientFactory::~MockCryptAuthClientFactory() {
24 } 24 }
25 25
26 std::unique_ptr<CryptAuthClient> MockCryptAuthClientFactory::CreateInstance() { 26 std::unique_ptr<CryptAuthClient> MockCryptAuthClientFactory::CreateInstance() {
27 std::unique_ptr<MockCryptAuthClient> client; 27 std::unique_ptr<MockCryptAuthClient> client;
28 if (mock_type_ == MockType::MAKE_STRICT_MOCKS) 28 if (mock_type_ == MockType::MAKE_STRICT_MOCKS)
29 client.reset(new testing::StrictMock<MockCryptAuthClient>()); 29 client.reset(new testing::StrictMock<MockCryptAuthClient>());
30 else 30 else
31 client.reset(new testing::NiceMock<MockCryptAuthClient>()); 31 client.reset(new testing::NiceMock<MockCryptAuthClient>());
32 32
33 FOR_EACH_OBSERVER(Observer, observer_list_, 33 for (auto& observer : observer_list_)
34 OnCryptAuthClientCreated(client.get())); 34 observer.OnCryptAuthClientCreated(client.get());
35 return std::move(client); 35 return std::move(client);
36 } 36 }
37 37
38 void MockCryptAuthClientFactory::AddObserver(Observer* observer) { 38 void MockCryptAuthClientFactory::AddObserver(Observer* observer) {
39 observer_list_.AddObserver(observer); 39 observer_list_.AddObserver(observer);
40 } 40 }
41 41
42 void MockCryptAuthClientFactory::RemoveObserver(Observer* observer) { 42 void MockCryptAuthClientFactory::RemoveObserver(Observer* observer) {
43 observer_list_.RemoveObserver(observer); 43 observer_list_.RemoveObserver(observer);
44 } 44 }
45 45
46 } // namespace proximity_auth 46 } // namespace proximity_auth
OLDNEW
« no previous file with comments | « components/proximity_auth/cryptauth/fake_cryptauth_gcm_manager.cc ('k') | components/proximity_auth/logging/log_buffer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698