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

Side by Side Diff: chrome/browser/media/desktop_streams_registry.cc

Issue 86913002: Make base::Base64Encode() return void (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: One more chromeos-specific fix. 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
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 "chrome/browser/media/desktop_streams_registry.h" 5 #include "chrome/browser/media/desktop_streams_registry.h"
6 6
7 #include "base/base64.h" 7 #include "base/base64.h"
8 #include "base/location.h" 8 #include "base/location.h"
9 #include "base/time/time.h" 9 #include "base/time/time.h"
10 #include "content/public/browser/browser_thread.h" 10 #include "content/public/browser/browser_thread.h"
11 #include "crypto/random.h" 11 #include "crypto/random.h"
12 12
13 namespace { 13 namespace {
14 14
15 const int kStreamIdLengthBytes = 16; 15 const int kStreamIdLengthBytes = 16;
16 16
17 const int kApprovedStreamTimeToLiveSeconds = 10; 17 const int kApprovedStreamTimeToLiveSeconds = 10;
18 18
19 std::string GenerateRandomStreamId() { 19 std::string GenerateRandomStreamId() {
20 char buffer[kStreamIdLengthBytes]; 20 char buffer[kStreamIdLengthBytes];
21 crypto::RandBytes(buffer, arraysize(buffer)); 21 crypto::RandBytes(buffer, arraysize(buffer));
22 std::string result; 22 std::string result;
23 if (!base::Base64Encode(base::StringPiece(buffer, arraysize(buffer)), 23 base::Base64Encode(base::StringPiece(buffer, arraysize(buffer)),
24 &result)) { 24 &result);
25 LOG(FATAL) << "Base64Encode failed.";
26 }
27 return result; 25 return result;
28 } 26 }
29 27
30 } // namespace 28 } // namespace
31 29
32 DesktopStreamsRegistry::DesktopStreamsRegistry() {} 30 DesktopStreamsRegistry::DesktopStreamsRegistry() {}
33 DesktopStreamsRegistry::~DesktopStreamsRegistry() {} 31 DesktopStreamsRegistry::~DesktopStreamsRegistry() {}
34 32
35 std::string DesktopStreamsRegistry::RegisterStream( 33 std::string DesktopStreamsRegistry::RegisterStream(
36 int render_process_id, 34 int render_process_id,
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 73
76 content::DesktopMediaID result = it->second.source; 74 content::DesktopMediaID result = it->second.source;
77 approved_streams_.erase(it); 75 approved_streams_.erase(it);
78 return result; 76 return result;
79 } 77 }
80 78
81 void DesktopStreamsRegistry::CleanupStream(const std::string& id) { 79 void DesktopStreamsRegistry::CleanupStream(const std::string& id) {
82 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); 80 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
83 approved_streams_.erase(id); 81 approved_streams_.erase(id);
84 } 82 }
OLDNEW
« no previous file with comments | « chrome/browser/managed_mode/managed_user_registration_utility.cc ('k') | chrome/browser/metrics/metrics_log.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698