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

Side by Side Diff: chrome/browser/extensions/api/audio_modem/audio_modem_api.cc

Issue 943053002: Adding CRC and multi-client support in the Whispernet NaCl wrapper (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixing crc decoding in nacl Created 5 years, 10 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
« no previous file with comments | « no previous file | chrome/browser/resources/whispernet_proxy/js/init.js » ('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 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 <map> 5 #include <map>
6 #include <string> 6 #include <string>
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/base64.h" 9 #include "base/base64.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 transmitters_[audio_type] = app_id; 137 transmitters_[audio_type] = app_id;
138 else if (transmitters_[audio_type] != app_id) 138 else if (transmitters_[audio_type] != app_id)
139 return STATUS_INUSE; 139 return STATUS_INUSE;
140 140
141 DVLOG(3) << "Starting transmit for app " << app_id; 141 DVLOG(3) << "Starting transmit for app " << app_id;
142 142
143 std::string encoded_token; 143 std::string encoded_token;
144 base::Base64Encode(token, &encoded_token); 144 base::Base64Encode(token, &encoded_token);
145 base::RemoveChars(encoded_token, "=", &encoded_token); 145 base::RemoveChars(encoded_token, "=", &encoded_token);
146 146
147 modem_->SetTokenParams(audio_type, TokenParamsForEncoding(params.encoding));
147 modem_->SetToken(audio_type, encoded_token); 148 modem_->SetToken(audio_type, encoded_token);
148 modem_->SetTokenParams(audio_type, TokenParamsForEncoding(params.encoding));
149 modem_->StartPlaying(audio_type); 149 modem_->StartPlaying(audio_type);
150 150
151 transmit_timers_[audio_type].Start( 151 transmit_timers_[audio_type].Start(
152 FROM_HERE, 152 FROM_HERE,
153 base::TimeDelta::FromMilliseconds(params.timeout_millis), 153 base::TimeDelta::FromMilliseconds(params.timeout_millis),
154 base::Bind(base::IgnoreResult(&AudioModemAPI::StopTransmit), 154 base::Bind(base::IgnoreResult(&AudioModemAPI::StopTransmit),
155 base::Unretained(this), 155 base::Unretained(this),
156 app_id, 156 app_id,
157 audio_type)); 157 audio_type));
158 return STATUS_SUCCESS; 158 return STATUS_SUCCESS;
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 ExtensionFunction::ResponseAction AudioModemStopReceiveFunction::Run() { 339 ExtensionFunction::ResponseAction AudioModemStopReceiveFunction::Run() {
340 scoped_ptr<StopReceive::Params> params(StopReceive::Params::Create(*args_)); 340 scoped_ptr<StopReceive::Params> params(StopReceive::Params::Create(*args_));
341 EXTENSION_FUNCTION_VALIDATE(params.get()); 341 EXTENSION_FUNCTION_VALIDATE(params.get());
342 342
343 Status status = AudioModemAPI::GetFactoryInstance()->Get(browser_context()) 343 Status status = AudioModemAPI::GetFactoryInstance()->Get(browser_context())
344 ->StopReceive(extension_id(), AudioTypeForBand(params->band)); 344 ->StopReceive(extension_id(), AudioTypeForBand(params->band));
345 return RespondNow(ArgumentList(StopReceive::Results::Create(status))); 345 return RespondNow(ArgumentList(StopReceive::Results::Create(status)));
346 } 346 }
347 347
348 } // namespace extensions 348 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/resources/whispernet_proxy/js/init.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698