OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "android_webview/browser/aw_resource_context.h" | 5 #include "android_webview/browser/aw_resource_context.h" |
6 | 6 #include "components/media_device_id_salt/media_device_id_salt.h" |
| 7 #include "components/prefs/pref_service.h" |
7 #include "content/public/browser/browser_thread.h" | 8 #include "content/public/browser/browser_thread.h" |
8 #include "net/url_request/url_request_context.h" | 9 #include "net/url_request/url_request_context.h" |
9 #include "net/url_request/url_request_context_getter.h" | 10 #include "net/url_request/url_request_context_getter.h" |
10 | 11 |
11 using content::BrowserThread; | 12 using content::BrowserThread; |
| 13 using media_device_id_salt::MediaDeviceIDSalt; |
12 | 14 |
13 namespace android_webview { | 15 namespace android_webview { |
14 | 16 |
15 AwResourceContext::AwResourceContext(net::URLRequestContextGetter* getter) | 17 AwResourceContext::AwResourceContext(net::URLRequestContextGetter* getter, |
16 : getter_(getter) { | 18 PrefService* pref_service, |
| 19 bool incognito) |
| 20 : getter_(getter), |
| 21 media_device_id_salt_(new MediaDeviceIDSalt(pref_service, incognito)) { |
17 DCHECK(getter_); | 22 DCHECK(getter_); |
18 } | 23 } |
19 | 24 |
20 AwResourceContext::~AwResourceContext() { | 25 AwResourceContext::~AwResourceContext() { |
21 } | 26 } |
22 | 27 |
23 void AwResourceContext::SetExtraHeaders( | 28 void AwResourceContext::SetExtraHeaders( |
24 const GURL& url, const std::string& headers) { | 29 const GURL& url, const std::string& headers) { |
25 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 30 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
26 if (!url.is_valid()) return; | 31 if (!url.is_valid()) return; |
(...skipping 16 matching lines...) Expand all Loading... |
43 net::HostResolver* AwResourceContext::GetHostResolver() { | 48 net::HostResolver* AwResourceContext::GetHostResolver() { |
44 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 49 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
45 return getter_->GetURLRequestContext()->host_resolver(); | 50 return getter_->GetURLRequestContext()->host_resolver(); |
46 } | 51 } |
47 | 52 |
48 net::URLRequestContext* AwResourceContext::GetRequestContext() { | 53 net::URLRequestContext* AwResourceContext::GetRequestContext() { |
49 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 54 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
50 return getter_->GetURLRequestContext(); | 55 return getter_->GetURLRequestContext(); |
51 } | 56 } |
52 | 57 |
| 58 content::ResourceContext::SaltCallback |
| 59 AwResourceContext::GetMediaDeviceIDSalt() { |
| 60 return base::Bind(&MediaDeviceIDSalt::GetSalt, media_device_id_salt_); |
| 61 } |
| 62 |
53 } // namespace android_webview | 63 } // namespace android_webview |
OLD | NEW |