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

Side by Side Diff: chrome/browser/io_thread.cc

Issue 1403863002: Enable exporting SSLKEYLOGFILE on Android w/ command line arguments (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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/common/chrome_switches.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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "chrome/browser/io_thread.h" 5 #include "chrome/browser/io_thread.h"
6 6
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"
11 #include "base/bind_helpers.h" 11 #include "base/bind_helpers.h"
12 #include "base/command_line.h" 12 #include "base/command_line.h"
13 #include "base/compiler_specific.h" 13 #include "base/compiler_specific.h"
14 #include "base/debug/leak_tracker.h" 14 #include "base/debug/leak_tracker.h"
15 #include "base/environment.h"
15 #include "base/logging.h" 16 #include "base/logging.h"
16 #include "base/metrics/field_trial.h" 17 #include "base/metrics/field_trial.h"
17 #include "base/prefs/pref_registry_simple.h" 18 #include "base/prefs/pref_registry_simple.h"
18 #include "base/prefs/pref_service.h" 19 #include "base/prefs/pref_service.h"
19 #include "base/profiler/scoped_tracker.h" 20 #include "base/profiler/scoped_tracker.h"
20 #include "base/stl_util.h" 21 #include "base/stl_util.h"
21 #include "base/strings/string_number_conversions.h" 22 #include "base/strings/string_number_conversions.h"
22 #include "base/strings/string_piece.h" 23 #include "base/strings/string_piece.h"
23 #include "base/strings/string_split.h" 24 #include "base/strings/string_split.h"
24 #include "base/strings/string_util.h" 25 #include "base/strings/string_util.h"
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 #include "net/http/http_auth_filter.h" 74 #include "net/http/http_auth_filter.h"
74 #include "net/http/http_auth_handler_factory.h" 75 #include "net/http/http_auth_handler_factory.h"
75 #include "net/http/http_network_layer.h" 76 #include "net/http/http_network_layer.h"
76 #include "net/http/http_server_properties_impl.h" 77 #include "net/http/http_server_properties_impl.h"
77 #include "net/proxy/proxy_config_service.h" 78 #include "net/proxy/proxy_config_service.h"
78 #include "net/proxy/proxy_script_fetcher_impl.h" 79 #include "net/proxy/proxy_script_fetcher_impl.h"
79 #include "net/proxy/proxy_service.h" 80 #include "net/proxy/proxy_service.h"
80 #include "net/quic/crypto/crypto_protocol.h" 81 #include "net/quic/crypto/crypto_protocol.h"
81 #include "net/quic/quic_protocol.h" 82 #include "net/quic/quic_protocol.h"
82 #include "net/quic/quic_utils.h" 83 #include "net/quic/quic_utils.h"
84 #include "net/socket/ssl_client_socket.h"
83 #include "net/socket/tcp_client_socket.h" 85 #include "net/socket/tcp_client_socket.h"
84 #include "net/spdy/spdy_session.h" 86 #include "net/spdy/spdy_session.h"
85 #include "net/ssl/channel_id_service.h" 87 #include "net/ssl/channel_id_service.h"
86 #include "net/ssl/default_channel_id_store.h" 88 #include "net/ssl/default_channel_id_store.h"
87 #include "net/url_request/data_protocol_handler.h" 89 #include "net/url_request/data_protocol_handler.h"
88 #include "net/url_request/file_protocol_handler.h" 90 #include "net/url_request/file_protocol_handler.h"
89 #include "net/url_request/ftp_protocol_handler.h" 91 #include "net/url_request/ftp_protocol_handler.h"
90 #include "net/url_request/static_http_user_agent_settings.h" 92 #include "net/url_request/static_http_user_agent_settings.h"
91 #include "net/url_request/url_fetcher.h" 93 #include "net/url_request/url_fetcher.h"
92 #include "net/url_request/url_request_backoff_manager.h" 94 #include "net/url_request/url_request_backoff_manager.h"
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 // determined by the operating system. 154 // determined by the operating system.
153 const char kNetworkQualityEstimatorFieldTrialName[] = "NetworkQualityEstimator"; 155 const char kNetworkQualityEstimatorFieldTrialName[] = "NetworkQualityEstimator";
154 156
155 #if defined(OS_MACOSX) && !defined(OS_IOS) 157 #if defined(OS_MACOSX) && !defined(OS_IOS)
156 void ObserveKeychainEvents() { 158 void ObserveKeychainEvents() {
157 DCHECK_CURRENTLY_ON(BrowserThread::UI); 159 DCHECK_CURRENTLY_ON(BrowserThread::UI);
158 net::CertDatabase::GetInstance()->SetMessageLoopForKeychainEvents(); 160 net::CertDatabase::GetInstance()->SetMessageLoopForKeychainEvents();
159 } 161 }
160 #endif 162 #endif
161 163
164 // Gets file path into ssl_keylog_file from command line argument or
165 // environment variable. Command line argument has priority when
166 // both specified.
167 std::string GetSSLKeyLogFile(const base::CommandLine& command_line) {
168 if (command_line.HasSwitch(switches::kSSLKeyLogFile)) {
169 std::string file =
170 command_line.GetSwitchValueASCII(switches::kSSLKeyLogFile);
171 if (!file.empty()) {
172 return file;
173 }
174
175 LOG(WARNING) << "ssl-key-log-file argument missing";
176 }
177 scoped_ptr<base::Environment> env(base::Environment::Create());
178 std::string file;
179 env->GetVar("SSLKEYLOGFILE", &file);
180 return file;
181 }
182
162 // Used for the "system" URLRequestContext. 183 // Used for the "system" URLRequestContext.
163 class SystemURLRequestContext : public net::URLRequestContext { 184 class SystemURLRequestContext : public net::URLRequestContext {
164 public: 185 public:
165 SystemURLRequestContext() { 186 SystemURLRequestContext() {
166 #if defined(USE_NSS_CERTS) || defined(OS_IOS) 187 #if defined(USE_NSS_CERTS) || defined(OS_IOS)
167 net::SetURLRequestContextForNSSHttpIO(this); 188 net::SetURLRequestContextForNSSHttpIO(this);
168 #endif 189 #endif
169 } 190 }
170 191
171 private: 192 private:
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after
546 #endif 567 #endif
547 568
548 // TODO(erikchen): Remove ScopedTracker below once http://crbug.com/466432 569 // TODO(erikchen): Remove ScopedTracker below once http://crbug.com/466432
549 // is fixed. 570 // is fixed.
550 tracked_objects::ScopedTracker tracking_profile2( 571 tracked_objects::ScopedTracker tracking_profile2(
551 FROM_HERE_WITH_EXPLICIT_FUNCTION( 572 FROM_HERE_WITH_EXPLICIT_FUNCTION(
552 "466432 IOThread::InitAsync::CommandLineForCurrentProcess")); 573 "466432 IOThread::InitAsync::CommandLineForCurrentProcess"));
553 const base::CommandLine& command_line = 574 const base::CommandLine& command_line =
554 *base::CommandLine::ForCurrentProcess(); 575 *base::CommandLine::ForCurrentProcess();
555 576
577 // Export ssl keys if log file specified.
578 std::string ssl_keylog_file = GetSSLKeyLogFile(command_line);
579 if (!ssl_keylog_file.empty()) {
580 net::SSLClientSocket::SetSSLKeyLogFile(ssl_keylog_file);
581 }
582
556 DCHECK(!globals_); 583 DCHECK(!globals_);
557 globals_ = new Globals; 584 globals_ = new Globals;
558 585
559 // Add an observer that will emit network change events to the ChromeNetLog. 586 // Add an observer that will emit network change events to the ChromeNetLog.
560 // Assuming NetworkChangeNotifier dispatches in FIFO order, we should be 587 // Assuming NetworkChangeNotifier dispatches in FIFO order, we should be
561 // logging the network change before other IO thread consumers respond to it. 588 // logging the network change before other IO thread consumers respond to it.
562 network_change_observer_.reset( 589 network_change_observer_.reset(
563 new LoggingNetworkChangeObserver(net_log_)); 590 new LoggingNetworkChangeObserver(net_log_));
564 591
565 // Setup the HistogramWatcher to run on the IO thread. 592 // Setup the HistogramWatcher to run on the IO thread.
(...skipping 1026 matching lines...) Expand 10 before | Expand all | Expand 10 after
1592 globals->proxy_script_fetcher_url_request_job_factory = job_factory.Pass(); 1619 globals->proxy_script_fetcher_url_request_job_factory = job_factory.Pass();
1593 1620
1594 context->set_job_factory( 1621 context->set_job_factory(
1595 globals->proxy_script_fetcher_url_request_job_factory.get()); 1622 globals->proxy_script_fetcher_url_request_job_factory.get());
1596 1623
1597 // TODO(rtenneti): We should probably use HttpServerPropertiesManager for the 1624 // TODO(rtenneti): We should probably use HttpServerPropertiesManager for the
1598 // system URLRequestContext too. There's no reason this should be tied to a 1625 // system URLRequestContext too. There's no reason this should be tied to a
1599 // profile. 1626 // profile.
1600 return context; 1627 return context;
1601 } 1628 }
OLDNEW
« no previous file with comments | « no previous file | chrome/common/chrome_switches.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698