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

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

Issue 2336843002: Decompose //extensions/browser/BUILD.gn (Closed)
Patch Set: fix moar dependencies. Created 4 years, 3 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/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 338 matching lines...) Expand 10 before | Expand all | Expand 10 after
349 } 349 }
350 350
351 void SocketsTcpSendFunction::AsyncWorkStart() { 351 void SocketsTcpSendFunction::AsyncWorkStart() {
352 ResumableTCPSocket* socket = GetTcpSocket(params_->socket_id); 352 ResumableTCPSocket* socket = GetTcpSocket(params_->socket_id);
353 if (!socket) { 353 if (!socket) {
354 error_ = kSocketNotFoundError; 354 error_ = kSocketNotFoundError;
355 AsyncWorkCompleted(); 355 AsyncWorkCompleted();
356 return; 356 return;
357 } 357 }
358 358
359 socket->Write(io_buffer_, 359 socket->Write(io_buffer_, static_cast<int>(io_buffer_size_),
360 io_buffer_size_,
361 base::Bind(&SocketsTcpSendFunction::OnCompleted, this)); 360 base::Bind(&SocketsTcpSendFunction::OnCompleted, this));
362 } 361 }
363 362
364 void SocketsTcpSendFunction::OnCompleted(int net_result) { 363 void SocketsTcpSendFunction::OnCompleted(int net_result) {
365 if (net_result >= net::OK) { 364 if (net_result >= net::OK) {
366 SetSendResult(net::OK, net_result); 365 SetSendResult(net::OK, net_result);
367 } else { 366 } else {
368 SetSendResult(net_result, -1); 367 SetSendResult(net_result, -1);
369 } 368 }
370 } 369 }
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
538 RemoveSocket(params_->socket_id); 537 RemoveSocket(params_->socket_id);
539 error_ = net::ErrorToString(result); 538 error_ = net::ErrorToString(result);
540 } 539 }
541 540
542 results_ = api::sockets_tcp::Secure::Results::Create(result); 541 results_ = api::sockets_tcp::Secure::Results::Create(result);
543 AsyncWorkCompleted(); 542 AsyncWorkCompleted();
544 } 543 }
545 544
546 } // namespace api 545 } // namespace api
547 } // namespace extensions 546 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698