diff --git a/atom/browser/atom_browser_context.cc b/atom/browser/atom_browser_context.cc index ffef00da50a6..e036cbc8103f 100644 --- a/atom/browser/atom_browser_context.cc +++ b/atom/browser/atom_browser_context.cc @@ -10,6 +10,7 @@ #include "atom/browser/atom_permission_manager.h" #include "atom/browser/browser.h" #include "atom/browser/request_context_delegate.h" +#include "atom/browser/special_storage_policy.h" #include "atom/browser/web_view_manager.h" #include "atom/common/atom_version.h" #include "atom/common/chrome_version.h" @@ -42,7 +43,8 @@ AtomBrowserContext::AtomBrowserContext(const std::string& partition, bool in_memory, const base::DictionaryValue& options) : brightray::BrowserContext(partition, in_memory), - url_request_context_getter_(nullptr) { + url_request_context_getter_(nullptr), + storage_policy_(new SpecialStoragePolicy) { // Construct user agent string. Browser* browser = Browser::Get(); std::string name = RemoveWhitespace(browser->GetName()); @@ -98,6 +100,10 @@ content::PermissionManager* AtomBrowserContext::GetPermissionManager() { return permission_manager_.get(); } +storage::SpecialStoragePolicy* AtomBrowserContext::GetSpecialStoragePolicy() { + return storage_policy_.get(); +} + void AtomBrowserContext::RegisterPrefs(PrefRegistrySimple* pref_registry) { pref_registry->RegisterFilePathPref(prefs::kSelectFileLastDirectory, base::FilePath()); diff --git a/atom/browser/atom_browser_context.h b/atom/browser/atom_browser_context.h index 581ecc185f12..9e6a841ceb8d 100644 --- a/atom/browser/atom_browser_context.h +++ b/atom/browser/atom_browser_context.h @@ -8,14 +8,20 @@ #include #include +#include "base/memory/scoped_refptr.h" #include "brightray/browser/browser_context.h" +namespace storage { +class SpecialStoragePolicy; +} + namespace atom { class AtomBlobReader; class AtomDownloadManagerDelegate; class AtomPermissionManager; class RequestContextDelegate; +class SpecialStoragePolicy; class WebViewManager; class AtomBrowserContext : public brightray::BrowserContext { @@ -35,6 +41,7 @@ class AtomBrowserContext : public brightray::BrowserContext { content::DownloadManagerDelegate* GetDownloadManagerDelegate() override; content::BrowserPluginGuestManager* GetGuestManager() override; content::PermissionManager* GetPermissionManager() override; + storage::SpecialStoragePolicy* GetSpecialStoragePolicy() override; // brightray::BrowserContext: void RegisterPrefs(PrefRegistrySimple* pref_registry) override; @@ -58,6 +65,7 @@ class AtomBrowserContext : public brightray::BrowserContext { std::unique_ptr download_manager_delegate_; std::unique_ptr guest_manager_; std::unique_ptr permission_manager_; + scoped_refptr storage_policy_; std::unique_ptr blob_reader_; std::unique_ptr request_context_delegate_; std::string user_agent_; diff --git a/brightray/browser/special_storage_policy.cc b/atom/browser/special_storage_policy.cc similarity index 89% rename from brightray/browser/special_storage_policy.cc rename to atom/browser/special_storage_policy.cc index e662441dedbf..7f94bcd298bc 100644 --- a/brightray/browser/special_storage_policy.cc +++ b/atom/browser/special_storage_policy.cc @@ -2,9 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "brightray/browser/special_storage_policy.h" +#include "atom/browser/special_storage_policy.h" -namespace brightray { +namespace atom { SpecialStoragePolicy::SpecialStoragePolicy() {} @@ -38,4 +38,4 @@ bool SpecialStoragePolicy::ShouldDeleteCookieOnExit(const GURL& origin) { return false; } -} // namespace brightray +} // namespace atom diff --git a/brightray/browser/special_storage_policy.h b/atom/browser/special_storage_policy.h similarity index 79% rename from brightray/browser/special_storage_policy.h rename to atom/browser/special_storage_policy.h index 2d02cdd29343..7182bc38de9c 100644 --- a/brightray/browser/special_storage_policy.h +++ b/atom/browser/special_storage_policy.h @@ -2,12 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef BRIGHTRAY_BROWSER_SPECIAL_STORAGE_POLICY_H_ -#define BRIGHTRAY_BROWSER_SPECIAL_STORAGE_POLICY_H_ +#ifndef ATOM_BROWSER_SPECIAL_STORAGE_POLICY_H_ +#define ATOM_BROWSER_SPECIAL_STORAGE_POLICY_H_ #include "storage/browser/quota/special_storage_policy.h" -namespace brightray { +namespace atom { class SpecialStoragePolicy : public storage::SpecialStoragePolicy { public: @@ -26,6 +26,6 @@ class SpecialStoragePolicy : public storage::SpecialStoragePolicy { ~SpecialStoragePolicy() override; }; -} // namespace brightray +} // namespace atom -#endif // BRIGHTRAY_BROWSER_SPECIAL_STORAGE_POLICY_H_ +#endif // ATOM_BROWSER_SPECIAL_STORAGE_POLICY_H_ diff --git a/brightray/browser/browser_context.cc b/brightray/browser/browser_context.cc index 708a97bddd1e..1eff7344e9ae 100644 --- a/brightray/browser/browser_context.cc +++ b/brightray/browser/browser_context.cc @@ -11,7 +11,6 @@ #include "brightray/browser/brightray_paths.h" #include "brightray/browser/browser_client.h" #include "brightray/browser/inspectable_web_contents_impl.h" -#include "brightray/browser/special_storage_policy.h" #include "brightray/browser/zoom_level_delegate.h" #include "brightray/common/application_info.h" #include "components/prefs/json_pref_store.h" @@ -55,7 +54,6 @@ scoped_refptr BrowserContext::Get(const std::string& partition, BrowserContext::BrowserContext(const std::string& partition, bool in_memory) : in_memory_(in_memory), - storage_policy_(new SpecialStoragePolicy), weak_factory_(this) { if (!PathService::Get(DIR_USER_DATA, &path_)) { PathService::Get(DIR_APP_DATA, &path_); @@ -160,10 +158,6 @@ content::BrowserPluginGuestManager* BrowserContext::GetGuestManager() { return nullptr; } -storage::SpecialStoragePolicy* BrowserContext::GetSpecialStoragePolicy() { - return storage_policy_.get(); -} - content::PushMessagingService* BrowserContext::GetPushMessagingService() { return nullptr; } diff --git a/brightray/browser/browser_context.h b/brightray/browser/browser_context.h index d36ec3bbdff9..1fb1c59b8043 100644 --- a/brightray/browser/browser_context.h +++ b/brightray/browser/browser_context.h @@ -17,10 +17,6 @@ class PrefRegistrySimple; class PrefService; -namespace storage { -class SpecialStoragePolicy; -} - namespace brightray { class BrowserContext; @@ -52,7 +48,6 @@ class BrowserContext content::ResourceContext* GetResourceContext() override; content::DownloadManagerDelegate* GetDownloadManagerDelegate() override; content::BrowserPluginGuestManager* GetGuestManager() override; - storage::SpecialStoragePolicy* GetSpecialStoragePolicy() override; content::PushMessagingService* GetPushMessagingService() override; content::SSLHostStateDelegate* GetSSLHostStateDelegate() override; content::BackgroundFetchDelegate* GetBackgroundFetchDelegate() override; @@ -121,7 +116,6 @@ class BrowserContext base::FilePath path_; bool in_memory_; - scoped_refptr storage_policy_; std::unique_ptr prefs_; std::unique_ptr media_device_id_salt_; // Self-destructing class responsible for creating URLRequestContextGetter diff --git a/brightray/filenames.gypi b/brightray/filenames.gypi index 0d79b5faf74f..3b3d7194cdbe 100644 --- a/brightray/filenames.gypi +++ b/brightray/filenames.gypi @@ -81,8 +81,6 @@ 'browser/win/win32_notification.h', 'browser/win/windows_toast_notification.cc', 'browser/win/windows_toast_notification.h', - 'browser/special_storage_policy.cc', - 'browser/special_storage_policy.h', 'browser/url_request_context_getter.cc', 'browser/url_request_context_getter.h', 'browser/views/inspectable_web_contents_view_views.h', diff --git a/filenames.gypi b/filenames.gypi index 31fb96254ecf..f57860558f06 100644 --- a/filenames.gypi +++ b/filenames.gypi @@ -317,6 +317,8 @@ 'atom/browser/request_context_delegate.h', 'atom/browser/session_preferences.cc', 'atom/browser/session_preferences.h', + 'atom/browser/special_storage_policy.cc', + 'atom/browser/special_storage_policy.h', 'atom/browser/ui/accelerator_util.cc', 'atom/browser/ui/accelerator_util.h', 'atom/browser/ui/accelerator_util_mac.mm',