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

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

Issue 1878153002: Revert of Simplify BrowserContext by removing redundant methods. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 | « extensions/browser/api/socket/socket_api.cc ('k') | extensions/browser/api_unittest.h » ('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 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 "content/public/browser/browser_context.h" 7 #include "content/public/browser/browser_context.h"
8 #include "content/public/browser/storage_partition.h"
9 #include "content/public/common/socket_permission_request.h" 8 #include "content/public/common/socket_permission_request.h"
10 #include "extensions/browser/api/socket/tcp_socket.h" 9 #include "extensions/browser/api/socket/tcp_socket.h"
11 #include "extensions/browser/api/socket/tls_socket.h" 10 #include "extensions/browser/api/socket/tls_socket.h"
12 #include "extensions/browser/api/sockets_tcp/tcp_socket_event_dispatcher.h" 11 #include "extensions/browser/api/sockets_tcp/tcp_socket_event_dispatcher.h"
13 #include "extensions/common/api/sockets/sockets_manifest_data.h" 12 #include "extensions/common/api/sockets/sockets_manifest_data.h"
14 #include "net/base/net_errors.h" 13 #include "net/base/net_errors.h"
15 #include "net/url_request/url_request_context.h" 14 #include "net/url_request/url_request_context.h"
16 #include "net/url_request/url_request_context_getter.h" 15 #include "net/url_request/url_request_context_getter.h"
17 16
18 using extensions::ResumableTCPSocket; 17 using extensions::ResumableTCPSocket;
(...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after
449 SocketsTcpSecureFunction::SocketsTcpSecureFunction() { 448 SocketsTcpSecureFunction::SocketsTcpSecureFunction() {
450 } 449 }
451 450
452 SocketsTcpSecureFunction::~SocketsTcpSecureFunction() { 451 SocketsTcpSecureFunction::~SocketsTcpSecureFunction() {
453 } 452 }
454 453
455 bool SocketsTcpSecureFunction::Prepare() { 454 bool SocketsTcpSecureFunction::Prepare() {
456 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 455 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
457 params_ = api::sockets_tcp::Secure::Params::Create(*args_); 456 params_ = api::sockets_tcp::Secure::Params::Create(*args_);
458 EXTENSION_FUNCTION_VALIDATE(params_.get()); 457 EXTENSION_FUNCTION_VALIDATE(params_.get());
459 url_request_getter_ = content::BrowserContext::GetDefaultStoragePartition( 458 url_request_getter_ = browser_context()->GetRequestContext();
460 browser_context())->GetURLRequestContext();
461 return true; 459 return true;
462 } 460 }
463 461
464 // Override the regular implementation, which would call AsyncWorkCompleted 462 // Override the regular implementation, which would call AsyncWorkCompleted
465 // immediately after Work(). 463 // immediately after Work().
466 void SocketsTcpSecureFunction::AsyncWorkStart() { 464 void SocketsTcpSecureFunction::AsyncWorkStart() {
467 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); 465 DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
468 466
469 ResumableTCPSocket* socket = GetTcpSocket(params_->socket_id); 467 ResumableTCPSocket* socket = GetTcpSocket(params_->socket_id);
470 if (!socket) { 468 if (!socket) {
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
535 RemoveSocket(params_->socket_id); 533 RemoveSocket(params_->socket_id);
536 error_ = net::ErrorToString(result); 534 error_ = net::ErrorToString(result);
537 } 535 }
538 536
539 results_ = api::sockets_tcp::Secure::Results::Create(result); 537 results_ = api::sockets_tcp::Secure::Results::Create(result);
540 AsyncWorkCompleted(); 538 AsyncWorkCompleted();
541 } 539 }
542 540
543 } // namespace api 541 } // namespace api
544 } // namespace extensions 542 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/browser/api/socket/socket_api.cc ('k') | extensions/browser/api_unittest.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698