Revert "[WIP] refactor: (Part I) make the ownership of URLRequestContextGetter more clear (#13956)"
This reverts commit 1c0bb06d4a
.
This commit is contained in:
parent
1c0bb06d4a
commit
b9490177da
34 changed files with 1121 additions and 985 deletions
|
@ -24,7 +24,8 @@ class SpecialStoragePolicy;
|
|||
namespace brightray {
|
||||
|
||||
class BrowserContext : public base::RefCounted<BrowserContext>,
|
||||
public content::BrowserContext {
|
||||
public content::BrowserContext,
|
||||
public brightray::URLRequestContextGetter::Delegate {
|
||||
public:
|
||||
// Get the BrowserContext according to its |partition| and |in_memory|,
|
||||
// empty pointer when be returned when there is no matching BrowserContext.
|
||||
|
@ -66,6 +67,10 @@ class BrowserContext : public base::RefCounted<BrowserContext>,
|
|||
bool in_memory) override;
|
||||
std::string GetMediaDeviceIDSalt() override;
|
||||
|
||||
URLRequestContextGetter* url_request_context_getter() const {
|
||||
return url_request_getter_.get();
|
||||
}
|
||||
|
||||
void InitPrefs();
|
||||
PrefService* prefs() { return prefs_.get(); }
|
||||
|
||||
|
@ -75,14 +80,15 @@ class BrowserContext : public base::RefCounted<BrowserContext>,
|
|||
|
||||
// Subclasses should override this to register custom preferences.
|
||||
virtual void RegisterPrefs(PrefRegistrySimple* pref_registry) {}
|
||||
virtual URLRequestContextGetterFactory* GetFactoryForMainRequestContext(
|
||||
content::ProtocolHandlerMap* protocol_handlers,
|
||||
content::URLRequestInterceptorScopedVector request_interceptors) = 0;
|
||||
|
||||
// URLRequestContextGetter::Delegate:
|
||||
std::unique_ptr<net::NetworkDelegate> CreateNetworkDelegate() override;
|
||||
|
||||
base::FilePath GetPath() const override;
|
||||
|
||||
private:
|
||||
friend class base::RefCounted<BrowserContext>;
|
||||
class ResourceContext;
|
||||
|
||||
void RegisterInternalPrefs(PrefRegistrySimple* pref_registry);
|
||||
|
||||
|
@ -111,10 +117,11 @@ class BrowserContext : public base::RefCounted<BrowserContext>,
|
|||
base::FilePath path_;
|
||||
bool in_memory_;
|
||||
|
||||
std::unique_ptr<ResourceContext> resource_context_;
|
||||
scoped_refptr<URLRequestContextGetter> url_request_getter_;
|
||||
scoped_refptr<storage::SpecialStoragePolicy> storage_policy_;
|
||||
std::unique_ptr<PrefService> prefs_;
|
||||
std::unique_ptr<MediaDeviceIDSalt> media_device_id_salt_;
|
||||
URLRequestContextGetter::Handle* io_handle_;
|
||||
|
||||
base::WeakPtrFactory<BrowserContext> weak_factory_;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue