refactor: move SpecialStoragePolicy from brightray to atom (#13944)
This commit is contained in:
parent
fc730cc705
commit
7253c7f843
8 changed files with 25 additions and 23 deletions
|
@ -10,6 +10,7 @@
|
||||||
#include "atom/browser/atom_permission_manager.h"
|
#include "atom/browser/atom_permission_manager.h"
|
||||||
#include "atom/browser/browser.h"
|
#include "atom/browser/browser.h"
|
||||||
#include "atom/browser/request_context_delegate.h"
|
#include "atom/browser/request_context_delegate.h"
|
||||||
|
#include "atom/browser/special_storage_policy.h"
|
||||||
#include "atom/browser/web_view_manager.h"
|
#include "atom/browser/web_view_manager.h"
|
||||||
#include "atom/common/atom_version.h"
|
#include "atom/common/atom_version.h"
|
||||||
#include "atom/common/chrome_version.h"
|
#include "atom/common/chrome_version.h"
|
||||||
|
@ -42,7 +43,8 @@ AtomBrowserContext::AtomBrowserContext(const std::string& partition,
|
||||||
bool in_memory,
|
bool in_memory,
|
||||||
const base::DictionaryValue& options)
|
const base::DictionaryValue& options)
|
||||||
: brightray::BrowserContext(partition, in_memory),
|
: brightray::BrowserContext(partition, in_memory),
|
||||||
url_request_context_getter_(nullptr) {
|
url_request_context_getter_(nullptr),
|
||||||
|
storage_policy_(new SpecialStoragePolicy) {
|
||||||
// Construct user agent string.
|
// Construct user agent string.
|
||||||
Browser* browser = Browser::Get();
|
Browser* browser = Browser::Get();
|
||||||
std::string name = RemoveWhitespace(browser->GetName());
|
std::string name = RemoveWhitespace(browser->GetName());
|
||||||
|
@ -98,6 +100,10 @@ content::PermissionManager* AtomBrowserContext::GetPermissionManager() {
|
||||||
return permission_manager_.get();
|
return permission_manager_.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
storage::SpecialStoragePolicy* AtomBrowserContext::GetSpecialStoragePolicy() {
|
||||||
|
return storage_policy_.get();
|
||||||
|
}
|
||||||
|
|
||||||
void AtomBrowserContext::RegisterPrefs(PrefRegistrySimple* pref_registry) {
|
void AtomBrowserContext::RegisterPrefs(PrefRegistrySimple* pref_registry) {
|
||||||
pref_registry->RegisterFilePathPref(prefs::kSelectFileLastDirectory,
|
pref_registry->RegisterFilePathPref(prefs::kSelectFileLastDirectory,
|
||||||
base::FilePath());
|
base::FilePath());
|
||||||
|
|
|
@ -8,14 +8,20 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
#include "base/memory/scoped_refptr.h"
|
||||||
#include "brightray/browser/browser_context.h"
|
#include "brightray/browser/browser_context.h"
|
||||||
|
|
||||||
|
namespace storage {
|
||||||
|
class SpecialStoragePolicy;
|
||||||
|
}
|
||||||
|
|
||||||
namespace atom {
|
namespace atom {
|
||||||
|
|
||||||
class AtomBlobReader;
|
class AtomBlobReader;
|
||||||
class AtomDownloadManagerDelegate;
|
class AtomDownloadManagerDelegate;
|
||||||
class AtomPermissionManager;
|
class AtomPermissionManager;
|
||||||
class RequestContextDelegate;
|
class RequestContextDelegate;
|
||||||
|
class SpecialStoragePolicy;
|
||||||
class WebViewManager;
|
class WebViewManager;
|
||||||
|
|
||||||
class AtomBrowserContext : public brightray::BrowserContext {
|
class AtomBrowserContext : public brightray::BrowserContext {
|
||||||
|
@ -35,6 +41,7 @@ class AtomBrowserContext : public brightray::BrowserContext {
|
||||||
content::DownloadManagerDelegate* GetDownloadManagerDelegate() override;
|
content::DownloadManagerDelegate* GetDownloadManagerDelegate() override;
|
||||||
content::BrowserPluginGuestManager* GetGuestManager() override;
|
content::BrowserPluginGuestManager* GetGuestManager() override;
|
||||||
content::PermissionManager* GetPermissionManager() override;
|
content::PermissionManager* GetPermissionManager() override;
|
||||||
|
storage::SpecialStoragePolicy* GetSpecialStoragePolicy() override;
|
||||||
|
|
||||||
// brightray::BrowserContext:
|
// brightray::BrowserContext:
|
||||||
void RegisterPrefs(PrefRegistrySimple* pref_registry) override;
|
void RegisterPrefs(PrefRegistrySimple* pref_registry) override;
|
||||||
|
@ -58,6 +65,7 @@ class AtomBrowserContext : public brightray::BrowserContext {
|
||||||
std::unique_ptr<AtomDownloadManagerDelegate> download_manager_delegate_;
|
std::unique_ptr<AtomDownloadManagerDelegate> download_manager_delegate_;
|
||||||
std::unique_ptr<WebViewManager> guest_manager_;
|
std::unique_ptr<WebViewManager> guest_manager_;
|
||||||
std::unique_ptr<AtomPermissionManager> permission_manager_;
|
std::unique_ptr<AtomPermissionManager> permission_manager_;
|
||||||
|
scoped_refptr<storage::SpecialStoragePolicy> storage_policy_;
|
||||||
std::unique_ptr<AtomBlobReader> blob_reader_;
|
std::unique_ptr<AtomBlobReader> blob_reader_;
|
||||||
std::unique_ptr<RequestContextDelegate> request_context_delegate_;
|
std::unique_ptr<RequestContextDelegate> request_context_delegate_;
|
||||||
std::string user_agent_;
|
std::string user_agent_;
|
||||||
|
|
|
@ -2,9 +2,9 @@
|
||||||
// Use of this source code is governed by a BSD-style license that can be
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// 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() {}
|
SpecialStoragePolicy::SpecialStoragePolicy() {}
|
||||||
|
|
||||||
|
@ -38,4 +38,4 @@ bool SpecialStoragePolicy::ShouldDeleteCookieOnExit(const GURL& origin) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace brightray
|
} // namespace atom
|
|
@ -2,12 +2,12 @@
|
||||||
// Use of this source code is governed by a BSD-style license that can be
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
#ifndef BRIGHTRAY_BROWSER_SPECIAL_STORAGE_POLICY_H_
|
#ifndef ATOM_BROWSER_SPECIAL_STORAGE_POLICY_H_
|
||||||
#define BRIGHTRAY_BROWSER_SPECIAL_STORAGE_POLICY_H_
|
#define ATOM_BROWSER_SPECIAL_STORAGE_POLICY_H_
|
||||||
|
|
||||||
#include "storage/browser/quota/special_storage_policy.h"
|
#include "storage/browser/quota/special_storage_policy.h"
|
||||||
|
|
||||||
namespace brightray {
|
namespace atom {
|
||||||
|
|
||||||
class SpecialStoragePolicy : public storage::SpecialStoragePolicy {
|
class SpecialStoragePolicy : public storage::SpecialStoragePolicy {
|
||||||
public:
|
public:
|
||||||
|
@ -26,6 +26,6 @@ class SpecialStoragePolicy : public storage::SpecialStoragePolicy {
|
||||||
~SpecialStoragePolicy() override;
|
~SpecialStoragePolicy() override;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace brightray
|
} // namespace atom
|
||||||
|
|
||||||
#endif // BRIGHTRAY_BROWSER_SPECIAL_STORAGE_POLICY_H_
|
#endif // ATOM_BROWSER_SPECIAL_STORAGE_POLICY_H_
|
|
@ -11,7 +11,6 @@
|
||||||
#include "brightray/browser/brightray_paths.h"
|
#include "brightray/browser/brightray_paths.h"
|
||||||
#include "brightray/browser/browser_client.h"
|
#include "brightray/browser/browser_client.h"
|
||||||
#include "brightray/browser/inspectable_web_contents_impl.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/browser/zoom_level_delegate.h"
|
||||||
#include "brightray/common/application_info.h"
|
#include "brightray/common/application_info.h"
|
||||||
#include "components/prefs/json_pref_store.h"
|
#include "components/prefs/json_pref_store.h"
|
||||||
|
@ -55,7 +54,6 @@ scoped_refptr<BrowserContext> BrowserContext::Get(const std::string& partition,
|
||||||
|
|
||||||
BrowserContext::BrowserContext(const std::string& partition, bool in_memory)
|
BrowserContext::BrowserContext(const std::string& partition, bool in_memory)
|
||||||
: in_memory_(in_memory),
|
: in_memory_(in_memory),
|
||||||
storage_policy_(new SpecialStoragePolicy),
|
|
||||||
weak_factory_(this) {
|
weak_factory_(this) {
|
||||||
if (!PathService::Get(DIR_USER_DATA, &path_)) {
|
if (!PathService::Get(DIR_USER_DATA, &path_)) {
|
||||||
PathService::Get(DIR_APP_DATA, &path_);
|
PathService::Get(DIR_APP_DATA, &path_);
|
||||||
|
@ -160,10 +158,6 @@ content::BrowserPluginGuestManager* BrowserContext::GetGuestManager() {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
storage::SpecialStoragePolicy* BrowserContext::GetSpecialStoragePolicy() {
|
|
||||||
return storage_policy_.get();
|
|
||||||
}
|
|
||||||
|
|
||||||
content::PushMessagingService* BrowserContext::GetPushMessagingService() {
|
content::PushMessagingService* BrowserContext::GetPushMessagingService() {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,10 +17,6 @@
|
||||||
class PrefRegistrySimple;
|
class PrefRegistrySimple;
|
||||||
class PrefService;
|
class PrefService;
|
||||||
|
|
||||||
namespace storage {
|
|
||||||
class SpecialStoragePolicy;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace brightray {
|
namespace brightray {
|
||||||
|
|
||||||
class BrowserContext;
|
class BrowserContext;
|
||||||
|
@ -52,7 +48,6 @@ class BrowserContext
|
||||||
content::ResourceContext* GetResourceContext() override;
|
content::ResourceContext* GetResourceContext() override;
|
||||||
content::DownloadManagerDelegate* GetDownloadManagerDelegate() override;
|
content::DownloadManagerDelegate* GetDownloadManagerDelegate() override;
|
||||||
content::BrowserPluginGuestManager* GetGuestManager() override;
|
content::BrowserPluginGuestManager* GetGuestManager() override;
|
||||||
storage::SpecialStoragePolicy* GetSpecialStoragePolicy() override;
|
|
||||||
content::PushMessagingService* GetPushMessagingService() override;
|
content::PushMessagingService* GetPushMessagingService() override;
|
||||||
content::SSLHostStateDelegate* GetSSLHostStateDelegate() override;
|
content::SSLHostStateDelegate* GetSSLHostStateDelegate() override;
|
||||||
content::BackgroundFetchDelegate* GetBackgroundFetchDelegate() override;
|
content::BackgroundFetchDelegate* GetBackgroundFetchDelegate() override;
|
||||||
|
@ -121,7 +116,6 @@ class BrowserContext
|
||||||
base::FilePath path_;
|
base::FilePath path_;
|
||||||
bool in_memory_;
|
bool in_memory_;
|
||||||
|
|
||||||
scoped_refptr<storage::SpecialStoragePolicy> storage_policy_;
|
|
||||||
std::unique_ptr<PrefService> prefs_;
|
std::unique_ptr<PrefService> prefs_;
|
||||||
std::unique_ptr<MediaDeviceIDSalt> media_device_id_salt_;
|
std::unique_ptr<MediaDeviceIDSalt> media_device_id_salt_;
|
||||||
// Self-destructing class responsible for creating URLRequestContextGetter
|
// Self-destructing class responsible for creating URLRequestContextGetter
|
||||||
|
|
|
@ -81,8 +81,6 @@
|
||||||
'browser/win/win32_notification.h',
|
'browser/win/win32_notification.h',
|
||||||
'browser/win/windows_toast_notification.cc',
|
'browser/win/windows_toast_notification.cc',
|
||||||
'browser/win/windows_toast_notification.h',
|
'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.cc',
|
||||||
'browser/url_request_context_getter.h',
|
'browser/url_request_context_getter.h',
|
||||||
'browser/views/inspectable_web_contents_view_views.h',
|
'browser/views/inspectable_web_contents_view_views.h',
|
||||||
|
|
|
@ -317,6 +317,8 @@
|
||||||
'atom/browser/request_context_delegate.h',
|
'atom/browser/request_context_delegate.h',
|
||||||
'atom/browser/session_preferences.cc',
|
'atom/browser/session_preferences.cc',
|
||||||
'atom/browser/session_preferences.h',
|
'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.cc',
|
||||||
'atom/browser/ui/accelerator_util.h',
|
'atom/browser/ui/accelerator_util.h',
|
||||||
'atom/browser/ui/accelerator_util_mac.mm',
|
'atom/browser/ui/accelerator_util_mac.mm',
|
||||||
|
|
Loading…
Reference in a new issue