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

Side by Side Diff: extensions/browser/api/sockets_tcp/sockets_tcp_api.cc

Issue 2476493003: Remove FundamentalValue
Patch Set: Fix Created 4 years, 1 month 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/sockets_tcp/sockets_tcp_api.h" 5 #include "extensions/browser/api/sockets_tcp/sockets_tcp_api.h"
6 6
7 #include "base/memory/ptr_util.h" 7 #include "base/memory/ptr_util.h"
8 #include "content/public/browser/browser_context.h" 8 #include "content/public/browser/browser_context.h"
9 #include "content/public/browser/storage_partition.h" 9 #include "content/public/browser/storage_partition.h"
10 #include "content/public/common/socket_permission_request.h" 10 #include "content/public/common/socket_permission_request.h"
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after
462 return true; 462 return true;
463 } 463 }
464 464
465 // Override the regular implementation, which would call AsyncWorkCompleted 465 // Override the regular implementation, which would call AsyncWorkCompleted
466 // immediately after Work(). 466 // immediately after Work().
467 void SocketsTcpSecureFunction::AsyncWorkStart() { 467 void SocketsTcpSecureFunction::AsyncWorkStart() {
468 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); 468 DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
469 469
470 ResumableTCPSocket* socket = GetTcpSocket(params_->socket_id); 470 ResumableTCPSocket* socket = GetTcpSocket(params_->socket_id);
471 if (!socket) { 471 if (!socket) {
472 SetResult( 472 SetResult(base::MakeUnique<base::Value>(net::ERR_INVALID_ARGUMENT));
473 base::MakeUnique<base::FundamentalValue>(net::ERR_INVALID_ARGUMENT));
474 error_ = kSocketNotFoundError; 473 error_ = kSocketNotFoundError;
475 AsyncWorkCompleted(); 474 AsyncWorkCompleted();
476 return; 475 return;
477 } 476 }
478 477
479 paused_ = socket->paused(); 478 paused_ = socket->paused();
480 persistent_ = socket->persistent(); 479 persistent_ = socket->persistent();
481 480
482 // Make sure it's a connected TCP client socket. Error out if it's already 481 // Make sure it's a connected TCP client socket. Error out if it's already
483 // secure()'d. 482 // secure()'d.
484 if (socket->GetSocketType() != Socket::TYPE_TCP || 483 if (socket->GetSocketType() != Socket::TYPE_TCP ||
485 socket->ClientStream() == NULL) { 484 socket->ClientStream() == NULL) {
486 SetResult( 485 SetResult(base::MakeUnique<base::Value>(net::ERR_INVALID_ARGUMENT));
487 base::MakeUnique<base::FundamentalValue>(net::ERR_INVALID_ARGUMENT));
488 error_ = kInvalidSocketStateError; 486 error_ = kInvalidSocketStateError;
489 AsyncWorkCompleted(); 487 AsyncWorkCompleted();
490 return; 488 return;
491 } 489 }
492 490
493 if (!socket->IsConnected()) { 491 if (!socket->IsConnected()) {
494 SetResult( 492 SetResult(base::MakeUnique<base::Value>(net::ERR_INVALID_ARGUMENT));
495 base::MakeUnique<base::FundamentalValue>(net::ERR_INVALID_ARGUMENT));
496 error_ = kSocketNotConnectedError; 493 error_ = kSocketNotConnectedError;
497 AsyncWorkCompleted(); 494 AsyncWorkCompleted();
498 return; 495 return;
499 } 496 }
500 497
501 net::URLRequestContext* url_request_context = 498 net::URLRequestContext* url_request_context =
502 url_request_getter_->GetURLRequestContext(); 499 url_request_getter_->GetURLRequestContext();
503 500
504 // UpgradeSocketToTLS() uses the older API's SecureOptions. Copy over the 501 // UpgradeSocketToTLS() uses the older API's SecureOptions. Copy over the
505 // only values inside -- TLSVersionConstraints's |min| and |max|, 502 // only values inside -- TLSVersionConstraints's |min| and |max|,
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
538 RemoveSocket(params_->socket_id); 535 RemoveSocket(params_->socket_id);
539 error_ = net::ErrorToString(result); 536 error_ = net::ErrorToString(result);
540 } 537 }
541 538
542 results_ = api::sockets_tcp::Secure::Results::Create(result); 539 results_ = api::sockets_tcp::Secure::Results::Create(result);
543 AsyncWorkCompleted(); 540 AsyncWorkCompleted();
544 } 541 }
545 542
546 } // namespace api 543 } // namespace api
547 } // namespace extensions 544 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/browser/api/socket/socket_api.cc ('k') | extensions/browser/api/storage/settings_quota_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698