From edad1b22c6c42fe72971a44dcb4ca147a1514201 Mon Sep 17 00:00:00 2001 From: Anthony Tseng Date: Sun, 4 Feb 2018 19:29:35 -0800 Subject: [PATCH] Add Session::IsOffTheRecord --- atom/browser/api/atom_api_session.cc | 11 +++++++++++ atom/browser/api/atom_api_session.h | 1 + 2 files changed, 12 insertions(+) diff --git a/atom/browser/api/atom_api_session.cc b/atom/browser/api/atom_api_session.cc index 115fc87a94..51c363b238 100644 --- a/atom/browser/api/atom_api_session.cc +++ b/atom/browser/api/atom_api_session.cc @@ -592,6 +592,16 @@ 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; +} + // static mate::Handle Session::CreateFrom( v8::Isolate* isolate, content::BrowserContext* browser_context) { @@ -649,6 +659,7 @@ void Session::BuildPrototype(v8::Isolate* isolate, &Session::AllowNTLMCredentialsForDomains) .SetMethod("setEnableBrotli", &Session::SetEnableBrotli) .SetMethod("equal", &Session::Equal) + .SetMethod("isOffTheRecord", &Session::IsOffTheRecord) .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..207caec241 100644 --- a/atom/browser/api/atom_api_session.h +++ b/atom/browser/api/atom_api_session.h @@ -92,6 +92,7 @@ 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; protected: Session(v8::Isolate* isolate, Profile* browser_context);