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

Side by Side Diff: remoting/protocol/protocol_mock_objects.cc

Issue 15709005: Linux pairing registry delegate implementation (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed Windows and Mac compile errors. Created 7 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « remoting/protocol/protocol_mock_objects.h ('k') | remoting/remoting.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "remoting/protocol/protocol_mock_objects.h" 5 #include "remoting/protocol/protocol_mock_objects.h"
6 6
7 namespace remoting { 7 namespace remoting {
8 namespace protocol { 8 namespace protocol {
9 9
10 MockConnectionToClient::MockConnectionToClient( 10 MockConnectionToClient::MockConnectionToClient(
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 MockSessionManager::MockSessionManager() {} 47 MockSessionManager::MockSessionManager() {}
48 48
49 MockSessionManager::~MockSessionManager() {} 49 MockSessionManager::~MockSessionManager() {}
50 50
51 MockPairingRegistryDelegate::MockPairingRegistryDelegate() { 51 MockPairingRegistryDelegate::MockPairingRegistryDelegate() {
52 } 52 }
53 53
54 MockPairingRegistryDelegate::~MockPairingRegistryDelegate() { 54 MockPairingRegistryDelegate::~MockPairingRegistryDelegate() {
55 } 55 }
56 56
57 void MockPairingRegistryDelegate::AddPairing( 57 void MockPairingRegistryDelegate::Save(
58 const PairingRegistry::Pairing& new_paired_client, 58 const std::string& pairings_json,
59 const PairingRegistry::AddPairingCallback& callback) { 59 const PairingRegistry::SaveCallback& callback) {
60 paired_clients_[new_paired_client.client_id()] = new_paired_client; 60 pairings_json_ = pairings_json;
61 if (!callback.is_null()) { 61 if (!callback.is_null()) {
62 callback.Run(true); 62 callback.Run(true);
63 } 63 }
64 } 64 }
65 65
66 void MockPairingRegistryDelegate::GetPairing( 66 void MockPairingRegistryDelegate::Load(
67 const std::string& client_id, 67 const PairingRegistry::LoadCallback& callback) {
68 const PairingRegistry::GetPairingCallback& callback) { 68 load_callback_ = base::Bind(base::Bind(callback), pairings_json_);
69 PairingRegistry::Pairing result;
70 PairingRegistry::PairedClients::const_iterator i =
71 paired_clients_.find(client_id);
72 if (i != paired_clients_.end()) {
73 result = i->second;
74 }
75 saved_callback_ = base::Bind(base::Bind(callback), result);
76 } 69 }
77 70
78 void MockPairingRegistryDelegate::RunCallback() { 71 void MockPairingRegistryDelegate::RunCallback() {
79 DCHECK(!saved_callback_.is_null()); 72 DCHECK(!load_callback_.is_null());
80 saved_callback_.Run(); 73 load_callback_.Run();
81 saved_callback_.Reset(); 74 load_callback_.Reset();
82 } 75 }
83 76
84 } // namespace protocol 77 } // namespace protocol
85 } // namespace remoting 78 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/protocol/protocol_mock_objects.h ('k') | remoting/remoting.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698