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

Side by Side Diff: trunk/src/remoting/protocol/pairing_registry.cc

Issue 101113004: Revert 239759 "The comment in base64.h implies that base::Base64..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 years 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/pairing_registry.h" 5 #include "remoting/protocol/pairing_registry.h"
6 6
7 #include "base/base64.h" 7 #include "base/base64.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/guid.h" 9 #include "base/guid.h"
10 #include "base/json/json_string_value_serializer.h" 10 #include "base/json/json_string_value_serializer.h"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 PairingRegistry::Pairing::~Pairing() { 42 PairingRegistry::Pairing::~Pairing() {
43 } 43 }
44 44
45 PairingRegistry::Pairing PairingRegistry::Pairing::Create( 45 PairingRegistry::Pairing PairingRegistry::Pairing::Create(
46 const std::string& client_name) { 46 const std::string& client_name) {
47 base::Time created_time = base::Time::Now(); 47 base::Time created_time = base::Time::Now();
48 std::string client_id = base::GenerateGUID(); 48 std::string client_id = base::GenerateGUID();
49 std::string shared_secret; 49 std::string shared_secret;
50 char buffer[kKeySize]; 50 char buffer[kKeySize];
51 crypto::RandBytes(buffer, arraysize(buffer)); 51 crypto::RandBytes(buffer, arraysize(buffer));
52 base::Base64Encode(base::StringPiece(buffer, arraysize(buffer)), 52 if (!base::Base64Encode(base::StringPiece(buffer, arraysize(buffer)),
53 &shared_secret); 53 &shared_secret)) {
54 LOG(FATAL) << "Base64Encode failed.";
55 }
54 return Pairing(created_time, client_name, client_id, shared_secret); 56 return Pairing(created_time, client_name, client_id, shared_secret);
55 } 57 }
56 58
57 PairingRegistry::Pairing PairingRegistry::Pairing::CreateFromValue( 59 PairingRegistry::Pairing PairingRegistry::Pairing::CreateFromValue(
58 const base::DictionaryValue& pairing) { 60 const base::DictionaryValue& pairing) {
59 std::string client_name, client_id; 61 std::string client_name, client_id;
60 double created_time_value; 62 double created_time_value;
61 if (pairing.GetDouble(kCreatedTimeKey, &created_time_value) && 63 if (pairing.GetDouble(kCreatedTimeKey, &created_time_value) &&
62 pairing.GetString(kClientNameKey, &client_name) && 64 pairing.GetString(kClientNameKey, &client_name) &&
63 pairing.GetString(kClientIdKey, &client_id)) { 65 pairing.GetString(kClientIdKey, &client_id)) {
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 293
292 void PairingRegistry::ServiceNextRequest() { 294 void PairingRegistry::ServiceNextRequest() {
293 if (pending_requests_.empty()) 295 if (pending_requests_.empty())
294 return; 296 return;
295 297
296 PostTask(delegate_task_runner_, FROM_HERE, pending_requests_.front()); 298 PostTask(delegate_task_runner_, FROM_HERE, pending_requests_.front());
297 } 299 }
298 300
299 } // namespace protocol 301 } // namespace protocol
300 } // namespace remoting 302 } // namespace remoting
OLDNEW
« no previous file with comments | « trunk/src/remoting/protocol/authenticator_test_base.cc ('k') | trunk/src/remoting/protocol/v2_authenticator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698