REVIEW: Move MediaDeviceIDSalt from ProfileIOData to ProfileImpl.
https://codereview.chromium.org/2820163002
This commit is contained in:
parent
ba6e8b4dff
commit
b81ae1c36f
4 changed files with 7 additions and 22 deletions
|
@ -10,7 +10,6 @@
|
|||
#include "brightray/browser/brightray_paths.h"
|
||||
#include "brightray/browser/browser_client.h"
|
||||
#include "brightray/browser/inspectable_web_contents_impl.h"
|
||||
#include "brightray/browser/media/media_device_id_salt.h"
|
||||
#include "brightray/browser/network_delegate.h"
|
||||
#include "brightray/browser/special_storage_policy.h"
|
||||
#include "brightray/browser/zoom_level_delegate.h"
|
||||
|
@ -54,13 +53,6 @@ class BrowserContext::ResourceContext : public content::ResourceContext {
|
|||
return getter_->GetURLRequestContext();
|
||||
}
|
||||
|
||||
std::string GetMediaDeviceIDSalt() override {
|
||||
auto media_device_id_salt_ = getter_->GetMediaDeviceIDSalt();
|
||||
if (media_device_id_salt_)
|
||||
return media_device_id_salt_->GetSalt();
|
||||
return content::ResourceContext::GetMediaDeviceIDSalt();
|
||||
}
|
||||
|
||||
URLRequestContextGetter* getter_;
|
||||
};
|
||||
|
||||
|
@ -153,12 +145,10 @@ net::NetworkDelegate* BrowserContext::CreateNetworkDelegate() {
|
|||
return new NetworkDelegate;
|
||||
}
|
||||
|
||||
MediaDeviceIDSalt* BrowserContext::GetMediaDeviceIDSalt() {
|
||||
if (IsOffTheRecord())
|
||||
return nullptr;
|
||||
std::string BrowserContext::GetMediaDeviceIDSalt() {
|
||||
if (!media_device_id_salt_.get())
|
||||
media_device_id_salt_.reset(new MediaDeviceIDSalt(prefs_.get()));
|
||||
return media_device_id_salt_.get();
|
||||
return media_device_id_salt_->GetSalt();
|
||||
}
|
||||
|
||||
base::FilePath BrowserContext::GetPath() const {
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
|
||||
#include "base/memory/ref_counted.h"
|
||||
#include "base/memory/weak_ptr.h"
|
||||
#include "brightray/browser/media/media_device_id_salt.h"
|
||||
#include "brightray/browser/net/devtools_network_controller_handle.h"
|
||||
#include "brightray/browser/permission_manager.h"
|
||||
#include "brightray/browser/url_request_context_getter.h"
|
||||
|
@ -24,7 +25,6 @@ class SpecialStoragePolicy;
|
|||
|
||||
namespace brightray {
|
||||
|
||||
class MediaDeviceIDSalt;
|
||||
class PermissionManager;
|
||||
|
||||
class BrowserContext : public base::RefCounted<BrowserContext>,
|
||||
|
@ -67,6 +67,7 @@ class BrowserContext : public base::RefCounted<BrowserContext>,
|
|||
net::URLRequestContextGetter* CreateMediaRequestContextForStoragePartition(
|
||||
const base::FilePath& partition_path,
|
||||
bool in_memory) override;
|
||||
std::string GetMediaDeviceIDSalt() override;
|
||||
|
||||
URLRequestContextGetter* url_request_context_getter() const {
|
||||
return url_request_getter_.get();
|
||||
|
@ -88,7 +89,6 @@ class BrowserContext : public base::RefCounted<BrowserContext>,
|
|||
|
||||
// URLRequestContextGetter::Delegate:
|
||||
net::NetworkDelegate* CreateNetworkDelegate() override;
|
||||
MediaDeviceIDSalt* GetMediaDeviceIDSalt() override;
|
||||
|
||||
base::FilePath GetPath() const override;
|
||||
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
|
||||
#include "components/prefs/pref_registry_simple.h"
|
||||
#include "components/prefs/pref_service.h"
|
||||
#include "content/public/browser/browser_context.h"
|
||||
#include "content/public/browser/browser_thread.h"
|
||||
#include "content/public/browser/resource_context.h"
|
||||
|
||||
using content::BrowserThread;
|
||||
|
||||
|
@ -24,7 +24,7 @@ MediaDeviceIDSalt::MediaDeviceIDSalt(PrefService* pref_service) {
|
|||
media_device_id_salt_.Init(kMediaDeviceIdSalt, pref_service);
|
||||
if (media_device_id_salt_.GetValue().empty()) {
|
||||
media_device_id_salt_.SetValue(
|
||||
content::ResourceContext::CreateRandomMediaDeviceIDSalt());
|
||||
content::BrowserContext::CreateRandomMediaDeviceIDSalt());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -47,7 +47,7 @@ void MediaDeviceIDSalt::RegisterPrefs(PrefRegistrySimple* registry) {
|
|||
void MediaDeviceIDSalt::Reset(PrefService* pref_service) {
|
||||
pref_service->SetString(
|
||||
kMediaDeviceIdSalt,
|
||||
content::ResourceContext::CreateRandomMediaDeviceIDSalt());
|
||||
content::BrowserContext::CreateRandomMediaDeviceIDSalt());
|
||||
}
|
||||
|
||||
} // namespace brightray
|
||||
|
|
|
@ -35,7 +35,6 @@ namespace brightray {
|
|||
|
||||
class RequireCTDelegate;
|
||||
class DevToolsNetworkControllerHandle;
|
||||
class MediaDeviceIDSalt;
|
||||
class NetLog;
|
||||
|
||||
class URLRequestContextGetter : public net::URLRequestContextGetter {
|
||||
|
@ -58,7 +57,6 @@ class URLRequestContextGetter : public net::URLRequestContextGetter {
|
|||
RequireCTDelegate* ct_delegate);
|
||||
virtual net::SSLConfigService* CreateSSLConfigService();
|
||||
virtual std::vector<std::string> GetCookieableSchemes();
|
||||
virtual MediaDeviceIDSalt* GetMediaDeviceIDSalt() { return nullptr; }
|
||||
};
|
||||
|
||||
URLRequestContextGetter(
|
||||
|
@ -80,9 +78,6 @@ class URLRequestContextGetter : public net::URLRequestContextGetter {
|
|||
|
||||
net::HostResolver* host_resolver();
|
||||
net::URLRequestJobFactory* job_factory() const { return job_factory_; }
|
||||
MediaDeviceIDSalt* GetMediaDeviceIDSalt() const {
|
||||
return delegate_->GetMediaDeviceIDSalt();
|
||||
}
|
||||
|
||||
private:
|
||||
Delegate* delegate_;
|
||||
|
|
Loading…
Reference in a new issue