From a51d137a7419182942b96540004d43e9b5bc2e31 Mon Sep 17 00:00:00 2001 From: Pranjal Date: Thu, 15 Mar 2018 09:40:24 -0700 Subject: [PATCH] Get tor path from browser-laptop --- atom/browser/api/atom_api_web_contents.cc | 4 ++++ brave/browser/brave_browser_context.cc | 10 ++++++---- lib/browser/api/extensions.js | 3 ++- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/atom/browser/api/atom_api_web_contents.cc b/atom/browser/api/atom_api_web_contents.cc index e4abd242b7..55d0c426d6 100644 --- a/atom/browser/api/atom_api_web_contents.cc +++ b/atom/browser/api/atom_api_web_contents.cc @@ -419,6 +419,10 @@ mate::Handle SessionFromOptions(v8::Isolate* isolate, if (options.Get("tor_proxy", &tor_proxy)) { session_options.SetString("tor_proxy", tor_proxy); } + std::string tor_path; + if (options.Get("tor_path", &tor_path)) { + session_options.SetString("tor_path", tor_path); + } session = Session::FromPartition(isolate, partition, session_options); } else { // Use the default session if not specified. diff --git a/brave/browser/brave_browser_context.cc b/brave/browser/brave_browser_context.cc index 48ef700925..196d0e86ae 100644 --- a/brave/browser/brave_browser_context.cc +++ b/brave/browser/brave_browser_context.cc @@ -178,12 +178,15 @@ BraveBrowserContext::BraveBrowserContext( } std::string tor_proxy; + std::string tor_path; if (options.GetString("tor_proxy", &tor_proxy)) { tor_proxy_ = GURL(tor_proxy); if (!tor_process_.IsValid()) { - base::FilePath tor("/usr/local/bin/tor"); - base::CommandLine cmdline(tor); - tor_process_ = base::LaunchProcess(cmdline, base::LaunchOptions()); + if (options.GetString("tor_path", &tor_path)) { + base::FilePath tor(tor_path); + base::CommandLine cmdline(tor); + tor_process_ = base::LaunchProcess(cmdline, base::LaunchOptions()); + } } } @@ -858,4 +861,3 @@ AtomBrowserContext* AtomBrowserContext::From( } } // namespace atom - diff --git a/lib/browser/api/extensions.js b/lib/browser/api/extensions.js index 3394c2307d..4aaff42c1a 100644 --- a/lib/browser/api/extensions.js +++ b/lib/browser/api/extensions.js @@ -227,7 +227,8 @@ const createTab = function (createProperties, cb) { ses = session.fromPartition(createProperties.partition, { parent_partition: createProperties.parent_partition, isolated_storage: createProperties.isolated_storage, - tor_proxy: createProperties.tor_proxy + tor_proxy: createProperties.tor_proxy, + tor_path: createProperties.tor_path }) // don't pass the partition info through delete createProperties.partition