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

Side by Side Diff: extensions/browser/api/cast_channel/cast_channel_api.cc

Issue 807723004: Cast audio only policy enforcement support. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed windows compiler warning Created 5 years, 11 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "extensions/browser/api/cast_channel/cast_channel_api.h" 5 #include "extensions/browser/api/cast_channel/cast_channel_api.h"
6 6
7 #include <limits> 7 #include <limits>
8 #include <string> 8 #include <string>
9 9
10 #include "base/json/json_writer.h" 10 #include "base/json/json_writer.h"
(...skipping 19 matching lines...) Expand all
30 // Used if not otherwise specified at ConnectInfo::timeout. 30 // Used if not otherwise specified at ConnectInfo::timeout.
31 const int kDefaultConnectTimeoutMillis = 5000; // 5 seconds. 31 const int kDefaultConnectTimeoutMillis = 5000; // 5 seconds.
32 32
33 namespace extensions { 33 namespace extensions {
34 34
35 namespace Close = cast_channel::Close; 35 namespace Close = cast_channel::Close;
36 namespace OnError = cast_channel::OnError; 36 namespace OnError = cast_channel::OnError;
37 namespace OnMessage = cast_channel::OnMessage; 37 namespace OnMessage = cast_channel::OnMessage;
38 namespace Open = cast_channel::Open; 38 namespace Open = cast_channel::Open;
39 namespace Send = cast_channel::Send; 39 namespace Send = cast_channel::Send;
40 using cast_channel::CastDeviceCapability;
40 using cast_channel::CastMessage; 41 using cast_channel::CastMessage;
41 using cast_channel::CastSocket; 42 using cast_channel::CastSocket;
42 using cast_channel::ChannelAuthType; 43 using cast_channel::ChannelAuthType;
43 using cast_channel::ChannelError; 44 using cast_channel::ChannelError;
44 using cast_channel::ChannelInfo; 45 using cast_channel::ChannelInfo;
45 using cast_channel::ConnectInfo; 46 using cast_channel::ConnectInfo;
46 using cast_channel::ErrorInfo; 47 using cast_channel::ErrorInfo;
47 using cast_channel::LastErrors; 48 using cast_channel::LastErrors;
48 using cast_channel::Logger; 49 using cast_channel::Logger;
49 using cast_channel::MessageInfo; 50 using cast_channel::MessageInfo;
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
340 scoped_ptr<CastSocket> test_socket = api_->GetSocketForTest(); 341 scoped_ptr<CastSocket> test_socket = api_->GetSocketForTest();
341 if (test_socket.get()) { 342 if (test_socket.get()) {
342 socket = test_socket.release(); 343 socket = test_socket.release();
343 } else { 344 } else {
344 socket = new cast_channel::CastSocketImpl( 345 socket = new cast_channel::CastSocketImpl(
345 extension_->id(), *ip_endpoint_, channel_auth_, 346 extension_->id(), *ip_endpoint_, channel_auth_,
346 ExtensionsBrowserClient::Get()->GetNetLog(), 347 ExtensionsBrowserClient::Get()->GetNetLog(),
347 base::TimeDelta::FromMilliseconds(connect_info_->timeout.get() 348 base::TimeDelta::FromMilliseconds(connect_info_->timeout.get()
348 ? *connect_info_->timeout 349 ? *connect_info_->timeout
349 : kDefaultConnectTimeoutMillis), 350 : kDefaultConnectTimeoutMillis),
350 api_->GetLogger()); 351 api_->GetLogger(),
352 connect_info_->capabilities ? *connect_info_->capabilities
353 : CastDeviceCapability::NONE);
351 } 354 }
352 new_channel_id_ = AddSocket(socket); 355 new_channel_id_ = AddSocket(socket);
353 scoped_ptr<CastMessageHandler> delegate(new CastMessageHandler(api_, socket)); 356 scoped_ptr<CastMessageHandler> delegate(new CastMessageHandler(api_, socket));
354 api_->GetLogger()->LogNewSocketEvent(*socket); 357 api_->GetLogger()->LogNewSocketEvent(*socket);
355 socket->Connect(delegate.Pass(), 358 socket->Connect(delegate.Pass(),
356 base::Bind(&CastChannelOpenFunction::OnOpen, this)); 359 base::Bind(&CastChannelOpenFunction::OnOpen, this));
357 } 360 }
358 361
359 void CastChannelOpenFunction::OnOpen(cast_channel::ChannelError result) { 362 void CastChannelOpenFunction::OnOpen(cast_channel::ChannelError result) {
360 DCHECK_CURRENTLY_ON(BrowserThread::IO); 363 DCHECK_CURRENTLY_ON(BrowserThread::IO);
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
562 std::string& signature = params_->signature; 565 std::string& signature = params_->signature;
563 if (signature.empty() || keys.empty() || 566 if (signature.empty() || keys.empty() ||
564 !cast_channel::SetTrustedCertificateAuthorities(keys, signature)) { 567 !cast_channel::SetTrustedCertificateAuthorities(keys, signature)) {
565 SetError("Unable to set authority keys."); 568 SetError("Unable to set authority keys.");
566 } 569 }
567 570
568 AsyncWorkCompleted(); 571 AsyncWorkCompleted();
569 } 572 }
570 573
571 } // namespace extensions 574 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/browser/api/cast_channel/cast_auth_util.cc ('k') | extensions/browser/api/cast_channel/cast_socket.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698