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 |
7 #include "content/public/browser/browser_thread.h" | 7 #include "content/public/browser/browser_thread.h" |
8 #include "net/url_request/url_request_context.h" | 8 #include "net/url_request/url_request_context.h" |
9 #include "net/url_request/url_request_context_getter.h" | 9 #include "net/url_request/url_request_context_getter.h" |
10 | 10 |
11 using content::BrowserThread; | 11 using content::BrowserThread; |
12 | 12 |
13 namespace android_webview { | 13 namespace android_webview { |
14 | 14 |
15 AwResourceContext::AwResourceContext(net::URLRequestContextGetter* getter) | 15 AwResourceContext::AwResourceContext(net::URLRequestContextGetter* getter) |
16 : getter_(getter) { | 16 : getter_(getter), media_device_id_salt_(CreateRandomMediaDeviceIDSalt()) { |
17 DCHECK(getter_); | 17 DCHECK(getter_); |
18 } | 18 } |
19 | 19 |
20 AwResourceContext::~AwResourceContext() { | 20 AwResourceContext::~AwResourceContext() { |
21 } | 21 } |
22 | 22 |
23 void AwResourceContext::SetExtraHeaders( | 23 void AwResourceContext::SetExtraHeaders( |
24 const GURL& url, const std::string& headers) { | 24 const GURL& url, const std::string& headers) { |
25 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 25 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
26 if (!url.is_valid()) return; | 26 if (!url.is_valid()) return; |
(...skipping 16 matching lines...) Expand all Loading... |
43 net::HostResolver* AwResourceContext::GetHostResolver() { | 43 net::HostResolver* AwResourceContext::GetHostResolver() { |
44 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 44 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
45 return getter_->GetURLRequestContext()->host_resolver(); | 45 return getter_->GetURLRequestContext()->host_resolver(); |
46 } | 46 } |
47 | 47 |
48 net::URLRequestContext* AwResourceContext::GetRequestContext() { | 48 net::URLRequestContext* AwResourceContext::GetRequestContext() { |
49 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 49 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
50 return getter_->GetURLRequestContext(); | 50 return getter_->GetURLRequestContext(); |
51 } | 51 } |
52 | 52 |
| 53 content::ResourceContext::SaltCallback |
| 54 AwResourceContext::GetMediaDeviceIDSalt() { |
| 55 return CreateSaltCallback(media_device_id_salt_); |
| 56 } |
| 57 |
53 } // namespace android_webview | 58 } // namespace android_webview |
OLD | NEW |