diff --git a/atom/browser/api/atom_api_session.cc b/atom/browser/api/atom_api_session.cc index 2b38b1e099..303602f12d 100644 --- a/atom/browser/api/atom_api_session.cc +++ b/atom/browser/api/atom_api_session.cc @@ -293,18 +293,6 @@ void DoCacheActionInIO( on_get_backend.Run(net::OK); } -void SetProxyInIO(scoped_refptr getter, - const net::ProxyConfig& config, - const base::Closure& callback) { - auto proxy_service = getter->GetURLRequestContext()->proxy_service(); - proxy_service->ResetConfigService(base::WrapUnique( - new net::ProxyConfigServiceFixed(config))); - // Refetches and applies the new pac script if provided. - proxy_service->ForceReloadProxyConfig(); - BrowserThread::PostTask( - BrowserThread::UI, FROM_HERE, callback); -} - void SetCertVerifyProcInIO( const scoped_refptr& context_getter, const AtomCertVerifier::VerifyProc& proc) { @@ -457,8 +445,14 @@ void Session::FlushStorageData() { void Session::SetProxy(const net::ProxyConfig& config, const base::Closure& callback) { - BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, - base::Bind(&SetProxyInIO, request_context_getter_, config, callback)); + auto proxy_service = + request_context_getter_->GetURLRequestContext()->proxy_service(); + proxy_service->ResetConfigService(base::WrapUnique( + new net::ProxyConfigServiceFixed(config))); + // Refetches and applies the new pac script if provided. + proxy_service->ForceReloadProxyConfig(); + if (callback) + callback.Run(); } void Session::SetDownloadPath(const base::FilePath& path) { @@ -592,6 +586,25 @@ bool Session::Equal(Session* session) const { #endif } +bool Session::IsOffTheRecord() const { + brave::BraveBrowserContext* brave_browser_context = + brave::BraveBrowserContext::FromBrowserContext(profile_); + if (brave_browser_context->IsOffTheRecord()) + return true; + if (brave_browser_context->IsIsolatedStorage()) + return true; + return false; +} + +void Session::SetTorNewIdentity(const GURL& url, + const base::Closure& callback) const { + brave::BraveBrowserContext* brave_browser_context = + brave::BraveBrowserContext::FromBrowserContext(profile_); + if (!brave_browser_context->IsIsolatedStorage()) + return; + brave_browser_context->SetTorNewIdentity(url, callback); +} + // static mate::Handle Session::CreateFrom( v8::Isolate* isolate, content::BrowserContext* browser_context) { @@ -649,6 +662,8 @@ void Session::BuildPrototype(v8::Isolate* isolate, &Session::AllowNTLMCredentialsForDomains) .SetMethod("setEnableBrotli", &Session::SetEnableBrotli) .SetMethod("equal", &Session::Equal) + .SetMethod("isOffTheRecord", &Session::IsOffTheRecord) + .SetMethod("setTorNewIdentity", &Session::SetTorNewIdentity) .SetProperty("partition", &Session::Partition) .SetProperty("contentSettings", &Session::ContentSettings) .SetProperty("userPrefs", &Session::UserPrefs) diff --git a/atom/browser/api/atom_api_session.h b/atom/browser/api/atom_api_session.h index ac0d579fe1..467cb137ac 100644 --- a/atom/browser/api/atom_api_session.h +++ b/atom/browser/api/atom_api_session.h @@ -92,6 +92,9 @@ class Session: public mate::TrackableObject, v8::Local SpellChecker(v8::Isolate* isolate); v8::Local Extensions(v8::Isolate* isolate); bool Equal(Session* session) const; + bool IsOffTheRecord() const; + void SetTorNewIdentity(const GURL& url, + const base::Closure& callback) const; protected: Session(v8::Isolate* isolate, Profile* browser_context); diff --git a/atom/browser/api/atom_api_web_contents.cc b/atom/browser/api/atom_api_web_contents.cc index 0d22805aa3..e4abd242b7 100644 --- a/atom/browser/api/atom_api_web_contents.cc +++ b/atom/browser/api/atom_api_web_contents.cc @@ -411,6 +411,14 @@ mate::Handle SessionFromOptions(v8::Isolate* isolate, if (options.Get("parent_partition", &parent_partition)) { session_options.SetString("parent_partition", parent_partition); } + bool isolated_storage; + if (options.Get("isolated_storage", &isolated_storage)) { + session_options.SetBoolean("isolated_storage", isolated_storage); + } + std::string tor_proxy; + if (options.Get("tor_proxy", &tor_proxy)) { + session_options.SetString("tor_proxy", tor_proxy); + } session = Session::FromPartition(isolate, partition, session_options); } else { // Use the default session if not specified. diff --git a/brave/browser/BUILD.gn b/brave/browser/BUILD.gn index 31dc6411ac..a15356604a 100644 --- a/brave/browser/BUILD.gn +++ b/brave/browser/BUILD.gn @@ -43,6 +43,7 @@ source_set("browser") { deps = [ ":apis", + ":proxy", "//electron/atom/browser", "//electron:common", "//electron/muon/app", @@ -152,3 +153,18 @@ source_set("apis") { "component_updater", ] } + +source_set("proxy") { + configs += [ + "//electron/build:electron_config", + ] + + sources = [ + "net/proxy/proxy_config_service_tor.cc", + "net/proxy/proxy_config_service_tor.h", + ] + + deps = [ + "//net", + ] +} diff --git a/brave/browser/brave_browser_context.cc b/brave/browser/brave_browser_context.cc index be847b7deb..48ef700925 100644 --- a/brave/browser/brave_browser_context.cc +++ b/brave/browser/brave_browser_context.cc @@ -10,8 +10,10 @@ #include "base/path_service.h" #include "base/files/file_path.h" #include "base/files/file_util.h" +#include "base/process/launch.h" #include "base/trace_event/trace_event.h" #include "brave/browser/brave_permission_manager.h" +#include "brave/browser/net/proxy/proxy_config_service_tor.h" #include "chrome/browser/background_fetch/background_fetch_delegate_factory.h" #include "chrome/browser/background_fetch/background_fetch_delegate_impl.h" #include "chrome/browser/browser_process.h" @@ -41,17 +43,23 @@ #include "components/user_prefs/user_prefs.h" #include "components/zoom/zoom_event_manager.h" #include "components/webdata/common/webdata_constants.h" +#include "content/browser/storage_partition_impl_map.h" #include "content/public/browser/notification_service.h" #include "content/public/browser/notification_source.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/dom_storage_context.h" +#include "content/public/browser/site_instance.h" #include "content/public/browser/storage_partition.h" #include "extensions/browser/pref_names.h" #include "extensions/features/features.h" #include "net/base/escape.h" #include "net/cookies/cookie_store.h" +#include "net/proxy/proxy_service.h" #include "net/url_request/url_request_context.h" +#include "net/url_request/url_request_context_getter.h" #include "net/url_request/url_request_job_factory_impl.h" +#include "vendor/brightray/browser/browser_client.h" +#include "vendor/brightray/browser/net_log.h" #if BUILDFLAG(ENABLE_EXTENSIONS) #include "atom/browser/extensions/atom_browser_client_extensions_part.h" @@ -153,6 +161,8 @@ BraveBrowserContext::BraveBrowserContext( ready_(new base::WaitableEvent( base::WaitableEvent::ResetPolicy::MANUAL, base::WaitableEvent::InitialState::NOT_SIGNALED)), + isolated_storage_(false), + in_memory_(in_memory), io_task_runner_(std::move(io_task_runner)), delegate_(g_browser_process->profile_manager()) { std::string parent_partition; @@ -162,6 +172,21 @@ BraveBrowserContext::BraveBrowserContext( atom::AtomBrowserContext::From(parent_partition, false)); } + bool isolated_storage; + if (options.GetBoolean("isolated_storage", &isolated_storage)) { + isolated_storage_ = isolated_storage; + } + + std::string tor_proxy; + 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 (in_memory) { original_context_ = static_cast( atom::AtomBrowserContext::From(partition, false)); @@ -185,6 +210,10 @@ BraveBrowserContext::BraveBrowserContext( BraveBrowserContext::~BraveBrowserContext() { MaybeSendDestroyedNotification(); + if (tor_process_.IsValid()) { + base::EnsureProcessTerminated(std::move(tor_process_)); + } + if (track_zoom_subscription_.get()) track_zoom_subscription_.reset(nullptr); @@ -305,6 +334,61 @@ content::BrowserPluginGuestManager* BraveBrowserContext::GetGuestManager() { return guest_view::GuestViewManager::FromBrowserContext(this); } +net::URLRequestContextGetter* +BraveBrowserContext::CreateRequestContextForStoragePartition( + const base::FilePath& partition_path, + bool in_memory, + content::ProtocolHandlerMap* protocol_handlers, + content::URLRequestInterceptorScopedVector request_interceptors) { + if (isolated_storage_) { + scoped_refptr + url_request_context_getter = + new brightray::URLRequestContextGetter( + this, + static_cast(brightray::BrowserClient::Get()-> + GetNetLog()), + partition_path, + in_memory, + BrowserThread::GetTaskRunnerForThread(BrowserThread::IO), + BrowserThread::GetTaskRunnerForThread(BrowserThread::FILE), + protocol_handlers, + std::move(request_interceptors)); + StoragePartitionDescriptor descriptor(partition_path, in_memory); + url_request_context_getter_map_[descriptor] = url_request_context_getter; + BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, + base::Bind(&BraveBrowserContext::TorSetProxy, + base::Unretained(this), + url_request_context_getter, + partition_path)); + return url_request_context_getter.get(); + } else { + return nullptr; + } +} + +net::URLRequestContextGetter* +BraveBrowserContext::CreateMediaRequestContextForStoragePartition( + const base::FilePath& partition_path, + bool in_memory) { + if (isolated_storage_) { + StoragePartitionDescriptor descriptor(partition_path, in_memory); + URLRequestContextGetterMap::iterator iter = + url_request_context_getter_map_.find(descriptor); + if (iter != url_request_context_getter_map_.end()) + return (iter->second).get(); + else + return nullptr; + } else { + return nullptr; + } +} + +bool BraveBrowserContext::IsOffTheRecord() const { + if (isolated_storage_) + return true; + return in_memory_; +} + void BraveBrowserContext::TrackZoomLevelsFromParent() { // Here we only want to use zoom levels stored in the main-context's default // storage partition. We're not interested in zoom levels in special @@ -363,6 +447,26 @@ void BraveBrowserContext::UpdateDefaultZoomLevel() { ->OnDefaultZoomLevelChanged(); } +void BraveBrowserContext::TorSetProxy( + scoped_refptr + url_request_context_getter, + const base::FilePath partition_path) { + DCHECK_CURRENTLY_ON(BrowserThread::UI); + if (!url_request_context_getter || !isolated_storage_) + return; + if (tor_proxy_.is_valid()) { + auto proxy_service = url_request_context_getter->GetURLRequestContext()-> + proxy_service(); + // Notice CreateRequestContextForStoragePartition will only be called once + // per partition_path so there is no need to cache password per origin + std::string origin = partition_path.DirName().BaseName().value(); + std::unique_ptr + config(new net::ProxyConfigServiceTor(tor_proxy_)); + config->SetUsername(origin); + proxy_service->ResetConfigService(std::move(config)); + } +} + content::PermissionManager* BraveBrowserContext::GetPermissionManager() { if (!permission_manager_.get()) permission_manager_.reset(new BravePermissionManager); @@ -402,6 +506,11 @@ BraveBrowserContext::CreateURLRequestJobFactory( extensions::CreateExtensionProtocolHandler(IsOffTheRecord(), info_map_)); #endif + if (!protocol_handler_interceptor_.get()) { + protocol_handler_interceptor_ = + ProtocolHandlerRegistryFactory::GetForBrowserContext(this) + ->CreateJobInterceptorFactory(); + } protocol_handler_interceptor_->Chain(std::move(job_factory)); return std::move(protocol_handler_interceptor_); } @@ -605,7 +714,7 @@ std::string BraveBrowserContext::partition_with_prefix() { if (canonical_partition.empty()) canonical_partition = "default"; - if (IsOffTheRecord()) + if (IsOffTheRecord() && !isolated_storage_) return canonical_partition; return kPersistPrefix + canonical_partition; @@ -643,6 +752,27 @@ void BraveBrowserContext::SetExitType(ExitType exit_type) { } } +void BraveBrowserContext::SetTorNewIdentity(const GURL& url, + const base::Closure& callback) { + GURL site_url(content::SiteInstance::GetSiteForURL(this, url)); + const std::string host = site_url.host(); + base::FilePath partition_path = this->GetPath().Append( + content::StoragePartitionImplMap::GetStoragePartitionPath(host, host)); + scoped_refptr url_request_context_getter; + StoragePartitionDescriptor descriptor(partition_path, true); + URLRequestContextGetterMap::iterator iter = + url_request_context_getter_map_.find(descriptor); + if (iter != url_request_context_getter_map_.end()) + url_request_context_getter = (iter->second); + else + return; + auto proxy_service = url_request_context_getter->GetURLRequestContext()-> + proxy_service(); + proxy_service->ForceReloadProxyConfig(); + if (callback) + callback.Run(); +} + scoped_refptr BraveBrowserContext::GetIOTaskRunner() { return io_task_runner_; diff --git a/brave/browser/brave_browser_context.h b/brave/browser/brave_browser_context.h index 6824e101cf..19a2e68359 100644 --- a/brave/browser/brave_browser_context.h +++ b/brave/browser/brave_browser_context.h @@ -5,6 +5,7 @@ #ifndef BRAVE_BROWSER_BRAVE_BROWSER_CONTEXT_H_ #define BRAVE_BROWSER_BRAVE_BROWSER_CONTEXT_H_ +#include #include #include #include @@ -12,6 +13,7 @@ #include "atom/browser/atom_browser_context.h" #include "content/public/browser/host_zoom_map.h" #include "chrome/browser/custom_handlers/protocol_handler_registry.h" +#include "chrome/browser/profiles/storage_partition_descriptor.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/zoom/chrome_zoom_level_prefs.h" #include "components/autofill/core/browser/webdata/autofill_webdata_service.h" @@ -78,6 +80,15 @@ class BraveBrowserContext : public Profile { override { return nullptr; } + net::URLRequestContextGetter* CreateRequestContextForStoragePartition( + const base::FilePath& partition_path, + bool in_memory, + content::ProtocolHandlerMap* protocol_handlers, + content::URLRequestInterceptorScopedVector request_interceptors) override; + net::URLRequestContextGetter* CreateMediaRequestContextForStoragePartition( + const base::FilePath& partition_path, + bool in_memory) override; + bool IsOffTheRecord() const override; // Profile implementation: scoped_refptr GetIOTaskRunner() override; @@ -129,13 +140,26 @@ class BraveBrowserContext : public Profile { void SetExitType(ExitType exit_type) override; + bool IsIsolatedStorage() const { return isolated_storage_; } + + void SetTorNewIdentity(const GURL& url, const base::Closure& callback); + private: + typedef std::map, + StoragePartitionDescriptorLess> + URLRequestContextGetterMap; void OnPrefsLoaded(bool success); void TrackZoomLevelsFromParent(); void OnParentZoomLevelChanged( const content::HostZoomMap::ZoomLevelChange& change); void UpdateDefaultZoomLevel(); + void TorSetProxy( + scoped_refptr + url_request_context_getter, + const base::FilePath partition_path); + scoped_refptr pref_registry_; std::unique_ptr user_prefs_; std::unique_ptr user_prefs_registrar_; @@ -152,6 +176,12 @@ class BraveBrowserContext : public Profile { BraveBrowserContext* otr_context_; const std::string partition_; std::unique_ptr ready_; + bool isolated_storage_; + GURL tor_proxy_; + bool in_memory_; + base::Process tor_process_; + + URLRequestContextGetterMap url_request_context_getter_map_; scoped_refptr autofill_data_; #if defined(OS_WIN) diff --git a/brave/browser/brave_content_browser_client.cc b/brave/browser/brave_content_browser_client.cc index 063fc0109b..3fc9654792 100644 --- a/brave/browser/brave_content_browser_client.cc +++ b/brave/browser/brave_content_browser_client.cc @@ -14,6 +14,7 @@ #include "base/lazy_instance.h" #include "base/path_service.h" #include "base/strings/utf_string_conversions.h" +#include "brave/browser/brave_browser_context.h" #include "brave/browser/notifications/platform_notification_service_impl.h" #include "brave/browser/password_manager/brave_password_manager_client.h" #include "brave/grit/brave_resources.h" @@ -224,6 +225,12 @@ std::string BraveContentBrowserClient::GetStoragePartitionIdForSite( partition_id = site.spec(); #endif + auto brave_browser_context = + BraveBrowserContext::FromBrowserContext(browser_context); + if (brave_browser_context && brave_browser_context->IsIsolatedStorage()) { + partition_id = site.spec(); + } + DCHECK(IsValidStoragePartitionId(browser_context, partition_id)); return partition_id; } @@ -282,6 +289,17 @@ void BraveContentBrowserClient::GetStoragePartitionConfigForSite( // error about which StoragePartition they expect to be in and it is not // safe to continue. CHECK(can_be_default || !partition_domain->empty()); + + auto brave_browser_context = + BraveBrowserContext::FromBrowserContext(browser_context); + if (brave_browser_context && brave_browser_context->IsIsolatedStorage() && + !site.SchemeIs(extensions::kExtensionScheme)) { + if (!site.is_empty()) { + *partition_domain = site.host(); + *partition_name = site.host(); + } + *in_memory = true; + } } content::WebContentsViewDelegate* @@ -690,6 +708,11 @@ void BraveContentBrowserClient::SiteInstanceDeleting( bool BraveContentBrowserClient::ShouldUseProcessPerSite( content::BrowserContext* browser_context, const GURL& effective_url) { + auto brave_browser_context = + BraveBrowserContext::FromBrowserContext(browser_context); + if (brave_browser_context && brave_browser_context->IsIsolatedStorage()) + return true; + Profile* profile = Profile::FromBrowserContext(browser_context); if (!profile) return false; diff --git a/brave/browser/guest_view/tab_view/tab_view_guest.cc b/brave/browser/guest_view/tab_view/tab_view_guest.cc index 29fc651ec7..40d289ac94 100644 --- a/brave/browser/guest_view/tab_view/tab_view_guest.cc +++ b/brave/browser/guest_view/tab_view/tab_view_guest.cc @@ -264,6 +264,10 @@ void TabViewGuest::CreateWebContents( partition_options.SetString("parent_partition", ""); } } + bool isolated_storage; + if (params.GetBoolean("isolated_storage", &isolated_storage)) { + partition_options.SetBoolean("isolated_storage", isolated_storage); + } atom::AtomBrowserContext* browser_context = brave::BraveBrowserContext::FromPartition(partition, partition_options); diff --git a/brave/browser/net/proxy/proxy_config_service_tor.cc b/brave/browser/net/proxy/proxy_config_service_tor.cc new file mode 100644 index 0000000000..23e787a534 --- /dev/null +++ b/brave/browser/net/proxy/proxy_config_service_tor.cc @@ -0,0 +1,52 @@ +// Copyright (c) 2018 The Brave Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "brave/browser/net/proxy/proxy_config_service_tor.h" + +#include + +#include "base/strings/string_number_conversions.h" +#include "base/strings/string_util.h" +#include "crypto/random.h" +#include "url/gurl.h" + +namespace net { + +const int kTorPasswordLength = 16; + +ProxyConfigServiceTor::ProxyConfigServiceTor(const GURL& url) + : url_(url) { + config_.proxy_rules().ParseFromString(url_.spec()); +} + +ProxyConfigServiceTor::~ProxyConfigServiceTor() {} + +ProxyConfigServiceTor::ConfigAvailability + ProxyConfigServiceTor::GetLatestProxyConfig(ProxyConfig* config) { + if (!url_.is_valid()) + return CONFIG_UNSET; + std::string password = GenerateNewPassword(); + std::string url = url_.spec(); + base::ReplaceFirstSubstringAfterOffset( + &url, 0, "//", "//" + username_ + ":" + password + "@"); + config_.proxy_rules().ParseFromString(url); + *config = config_; + return CONFIG_VALID; +} + +bool ProxyConfigServiceTor::SetUsername(const std::string& username) { + if (username.empty()) + return false; + username_ = username; + return true; +} + + +std::string ProxyConfigServiceTor::GenerateNewPassword() { + std::vector password(kTorPasswordLength); + crypto::RandBytes(password.data(), password.size()); + return base::HexEncode(password.data(), password.size()); +} + +} // namespace net diff --git a/brave/browser/net/proxy/proxy_config_service_tor.h b/brave/browser/net/proxy/proxy_config_service_tor.h new file mode 100644 index 0000000000..04d7a27bd3 --- /dev/null +++ b/brave/browser/net/proxy/proxy_config_service_tor.h @@ -0,0 +1,45 @@ +// Copyright (c) 2018 The Brave Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef BRAVE_BROWSER_NET_PROXY_PROXY_CONFIG_SERVICE_TOR_H_ +#define BRAVE_BROWSER_NET_PROXY_PROXY_CONFIG_SERVICE_TOR_H_ + +#include + +#include "base/compiler_specific.h" +#include "net/base/net_errors.h" +#include "net/base/net_export.h" +#include "net/proxy/proxy_config.h" +#include "net/proxy/proxy_config_service.h" + +class GURL; + +namespace net { + +// Implementation of ProxyConfigService that returns a tor specific result. +class NET_EXPORT ProxyConfigServiceTor : public ProxyConfigService { + public: + explicit ProxyConfigServiceTor(const GURL& url); + ~ProxyConfigServiceTor() override; + + // ProxyConfigService methods: + void AddObserver(Observer* observer) override {} + void RemoveObserver(Observer* observer) override {} + ConfigAvailability GetLatestProxyConfig(ProxyConfig* config) override; + + // Set origin as username + bool SetUsername(const std::string& username); + + private: + // Generate a new 128 bit random tag + std::string GenerateNewPassword(); + + ProxyConfig config_; + GURL url_; + std::string username_; +}; + +} // namespace net + +#endif // BRAVE_BROWSER_NET_PROXY_PROXY_CONFIG_SERVICE_TOR_H_ diff --git a/chromium_src/chrome/browser/profiles/profile_manager.cc b/chromium_src/chrome/browser/profiles/profile_manager.cc index 99243d0769..f70144b38f 100644 --- a/chromium_src/chrome/browser/profiles/profile_manager.cc +++ b/chromium_src/chrome/browser/profiles/profile_manager.cc @@ -23,6 +23,7 @@ #include "base/strings/string_util.h" #include "base/strings/utf_string_conversions.h" #include "base/trace_event/trace_event.h" +#include "brave/browser/brave_browser_context.h" #include "build/build_config.h" #include "atom/browser/atom_browser_context.h" #include "chrome/browser/browser_process.h" @@ -82,7 +83,10 @@ void ProfileManager::OnProfileCreated(Profile* profile, bool success, bool is_new_profile) { DCHECK_CURRENTLY_ON(BrowserThread::UI); - if (!profile->IsOffTheRecord() && + auto brave_browser_context = + brave::BraveBrowserContext::FromBrowserContext(profile); + if ((!profile->IsOffTheRecord() || + brave_browser_context->IsIsolatedStorage())&& !GetProfileByPath(profile->GetPath())) { AddProfile(profile); } diff --git a/lib/browser/api/extensions.js b/lib/browser/api/extensions.js index b158084c41..3394c2307d 100644 --- a/lib/browser/api/extensions.js +++ b/lib/browser/api/extensions.js @@ -225,7 +225,9 @@ const createTab = function (createProperties, cb) { if (!error && createProperties.partition) { // createProperties.partition always takes precendence ses = session.fromPartition(createProperties.partition, { - parent_partition: createProperties.parent_partition + parent_partition: createProperties.parent_partition, + isolated_storage: createProperties.isolated_storage, + tor_proxy: createProperties.tor_proxy }) // don't pass the partition info through delete createProperties.partition diff --git a/patches/master_patch.patch b/patches/master_patch.patch index 246ee0616e..df9165c93b 100644 --- a/patches/master_patch.patch +++ b/patches/master_patch.patch @@ -1446,6 +1446,30 @@ index 7671defd7a2f2d49c38015dfe52cdb18b9eb1d21..e40f51499af760411b29f65eed5ed008 return (renderWidgetHostView_->GetTextInputType() != ui::TEXT_INPUT_TYPE_NONE && [event type] == NSKeyDown && +diff --git a/content/browser/storage_partition_impl_map.h b/content/browser/storage_partition_impl_map.h +index ce0951bacd4dab08db92f6a87087279fcc7e4f09..10c7976815635c945079344e63ecf7f9f9932eaf 100644 +--- a/content/browser/storage_partition_impl_map.h ++++ b/content/browser/storage_partition_impl_map.h +@@ -22,6 +22,10 @@ class FilePath; + class SequencedTaskRunner; + } // namespace base + ++namespace brave { ++class BraveBrowserContext; ++} // namespace brave ++ + namespace content { + + class BrowserContext; +@@ -64,6 +68,8 @@ class CONTENT_EXPORT StoragePartitionImplMap + FRIEND_TEST_ALL_PREFIXES(StoragePartitionConfigTest, OperatorLess); + FRIEND_TEST_ALL_PREFIXES(StoragePartitionImplMapTest, GarbageCollect); + ++ friend class brave::BraveBrowserContext; ++ + // Each StoragePartition is uniquely identified by which partition domain + // it belongs to (such as an app or the browser itself), the user supplied + // partition name and the bit indicating whether it should be persisted on diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc index c1ae2a911735bd1fea7c4b9517f8dfaa362edaab..15b3a67d58136f5e07afa3cc2778a6d60b96e11f 100644 --- a/content/browser/web_contents/web_contents_impl.cc @@ -1844,6 +1868,19 @@ index a433afd0217830b49ddb3381ad55afeae2381840..ddcca749666f956c6317676dbcdd48da DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); } +diff --git a/net/proxy/proxy_service.cc b/net/proxy/proxy_service.cc +index 0503ae963e775bccd3c0241b4ec922ce8a2ecd1a..f29b0c4be5d8ad4032b1361e99c7a0e82f64d9dc 100644 +--- a/net/proxy/proxy_service.cc ++++ b/net/proxy/proxy_service.cc +@@ -1477,7 +1477,7 @@ void ProxyService::ResetConfigService( + + void ProxyService::ForceReloadProxyConfig() { + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); +- ResetProxyConfig(false); ++ ResetProxyConfig(true); + ApplyProxyConfigIfAvailable(); + } + diff --git a/net/url_request/url_request_job.h b/net/url_request/url_request_job.h index 389315a25d7da30d71b59e3803ab795bc4c18e1c..79797fe7e674f9f6d2a65de542f262a945454f16 100644 --- a/net/url_request/url_request_job.h diff --git a/vendor/brightray/browser/browser_context.cc b/vendor/brightray/browser/browser_context.cc index 8d1e7f9f4f..d0c73f47ec 100644 --- a/vendor/brightray/browser/browser_context.cc +++ b/vendor/brightray/browser/browser_context.cc @@ -143,10 +143,6 @@ std::unique_ptr BrowserContext::CreateZoomLevelDeleg return std::unique_ptr(); } -bool BrowserContext::IsOffTheRecord() const { - return in_memory_; -} - content::ResourceContext* BrowserContext::GetResourceContext() { return resource_context_.get(); } @@ -175,25 +171,9 @@ content::BackgroundSyncController* BrowserContext::GetBackgroundSyncController() return nullptr; } -net::URLRequestContextGetter* -BrowserContext::CreateRequestContextForStoragePartition( - const base::FilePath& partition_path, - bool in_memory, - content::ProtocolHandlerMap* protocol_handlers, - content::URLRequestInterceptorScopedVector request_interceptors) { - return nullptr; -} - net::URLRequestContextGetter* BrowserContext::CreateMediaRequestContext() { return url_request_getter_.get(); } -net::URLRequestContextGetter* -BrowserContext::CreateMediaRequestContextForStoragePartition( - const base::FilePath& partition_path, - bool in_memory) { - return nullptr; -} - } // namespace brightray diff --git a/vendor/brightray/browser/browser_context.h b/vendor/brightray/browser/browser_context.h index 0caf81b5f0..4e12ada814 100644 --- a/vendor/brightray/browser/browser_context.h +++ b/vendor/brightray/browser/browser_context.h @@ -36,7 +36,6 @@ class BrowserContext : public content::BrowserContext, // content::BrowserContext: std::unique_ptr CreateZoomLevelDelegate( const base::FilePath& partition_path) override; - bool IsOffTheRecord() const override; content::ResourceContext* GetResourceContext() override; content::DownloadManagerDelegate* GetDownloadManagerDelegate() override; content::BrowserPluginGuestManager* GetGuestManager() override; @@ -47,15 +46,7 @@ class BrowserContext : public content::BrowserContext, net::URLRequestContextGetter* CreateRequestContext( content::ProtocolHandlerMap* protocol_handlers, content::URLRequestInterceptorScopedVector request_interceptors) override; - net::URLRequestContextGetter* CreateRequestContextForStoragePartition( - const base::FilePath& partition_path, - bool in_memory, - content::ProtocolHandlerMap* protocol_handlers, - content::URLRequestInterceptorScopedVector request_interceptors) override; net::URLRequestContextGetter* CreateMediaRequestContext() override; - net::URLRequestContextGetter* CreateMediaRequestContextForStoragePartition( - const base::FilePath& partition_path, - bool in_memory) override; URLRequestContextGetter* url_request_context_getter() const { return url_request_getter_.get();