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

Side by Side Diff: components/cryptauth/fake_secure_channel.cc

Issue 2713993003: Revert of build: Enable auto raw pointer deduction check on linux. (Closed)
Patch Set: Created 3 years, 9 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 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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/cryptauth/fake_secure_channel.h" 5 #include "components/cryptauth/fake_secure_channel.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 8
9 namespace cryptauth { 9 namespace cryptauth {
10 10
11 FakeSecureChannel::SentMessage::SentMessage(const std::string& feature, 11 FakeSecureChannel::SentMessage::SentMessage(const std::string& feature,
12 const std::string& payload) 12 const std::string& payload)
13 : feature(feature), payload(payload) {} 13 : feature(feature), payload(payload) {}
14 14
15 FakeSecureChannel::FakeSecureChannel(std::unique_ptr<Connection> connection, 15 FakeSecureChannel::FakeSecureChannel(std::unique_ptr<Connection> connection,
16 std::unique_ptr<Delegate> delegate) 16 std::unique_ptr<Delegate> delegate)
17 : SecureChannel(std::move(connection), std::move(delegate)) {} 17 : SecureChannel(std::move(connection), std::move(delegate)) {}
18 18
19 FakeSecureChannel::~FakeSecureChannel() {} 19 FakeSecureChannel::~FakeSecureChannel() {}
20 20
21 void FakeSecureChannel::ChangeStatus(const Status& new_status) { 21 void FakeSecureChannel::ChangeStatus(const Status& new_status) {
22 Status old_status = status_; 22 Status old_status = status_;
23 status_ = new_status; 23 status_ = new_status;
24 24
25 // Copy to prevent channel from being removed during handler. 25 // Copy to prevent channel from being removed during handler.
26 std::vector<Observer*> observers_copy = observers_; 26 std::vector<Observer*> observers_copy = observers_;
27 for (auto* observer : observers_copy) { 27 for (auto observer : observers_copy) {
28 observer->OnSecureChannelStatusChanged(this, old_status, status_); 28 observer->OnSecureChannelStatusChanged(this, old_status, status_);
29 } 29 }
30 } 30 }
31 31
32 void FakeSecureChannel::ReceiveMessage(const std::string& feature, 32 void FakeSecureChannel::ReceiveMessage(const std::string& feature,
33 const std::string& payload) { 33 const std::string& payload) {
34 // Copy to prevent channel from being removed during handler. 34 // Copy to prevent channel from being removed during handler.
35 std::vector<Observer*> observers_copy = observers_; 35 std::vector<Observer*> observers_copy = observers_;
36 for (auto* observer : observers_copy) { 36 for (auto observer : observers_copy) {
37 observer->OnMessageReceived(this, feature, payload); 37 observer->OnMessageReceived(this, feature, payload);
38 } 38 }
39 } 39 }
40 40
41 void FakeSecureChannel::Initialize() {} 41 void FakeSecureChannel::Initialize() {}
42 42
43 void FakeSecureChannel::SendMessage(const std::string& feature, 43 void FakeSecureChannel::SendMessage(const std::string& feature,
44 const std::string& payload) { 44 const std::string& payload) {
45 sent_messages_.push_back(SentMessage(feature, payload)); 45 sent_messages_.push_back(SentMessage(feature, payload));
46 } 46 }
47 47
48 void FakeSecureChannel::Disconnect() { 48 void FakeSecureChannel::Disconnect() {
49 ChangeStatus(Status::DISCONNECTED); 49 ChangeStatus(Status::DISCONNECTED);
50 } 50 }
51 51
52 void FakeSecureChannel::AddObserver(Observer* observer) { 52 void FakeSecureChannel::AddObserver(Observer* observer) {
53 observers_.push_back(observer); 53 observers_.push_back(observer);
54 } 54 }
55 55
56 void FakeSecureChannel::RemoveObserver(Observer* observer) { 56 void FakeSecureChannel::RemoveObserver(Observer* observer) {
57 observers_.erase(std::find(observers_.begin(), observers_.end(), observer), 57 observers_.erase(std::find(observers_.begin(), observers_.end(), observer),
58 observers_.end()); 58 observers_.end());
59 } 59 }
60 60
61 } // namespace cryptauth 61 } // namespace cryptauth
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698