OLD | NEW |
---|---|
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "blimp/engine/common/blimp_browser_context.h" | 5 #include "blimp/engine/common/blimp_browser_context.h" |
6 | 6 |
7 #include <string> | |
8 | |
7 #include "base/bind.h" | 9 #include "base/bind.h" |
8 #include "base/environment.h" | 10 #include "base/environment.h" |
9 #include "base/files/file_util.h" | 11 #include "base/files/file_util.h" |
10 #include "base/memory/ptr_util.h" | 12 #include "base/memory/ptr_util.h" |
11 #include "base/nix/xdg_util.h" | 13 #include "base/nix/xdg_util.h" |
12 #include "base/path_service.h" | 14 #include "base/path_service.h" |
13 #include "blimp/engine/app/blimp_permission_manager.h" | 15 #include "blimp/engine/app/blimp_permission_manager.h" |
14 #include "components/metrics/metrics_service.h" | 16 #include "components/metrics/metrics_service.h" |
15 #include "components/pref_registry/pref_registry_syncable.h" | 17 #include "components/pref_registry/pref_registry_syncable.h" |
16 #include "components/prefs/in_memory_pref_store.h" | 18 #include "components/prefs/in_memory_pref_store.h" |
(...skipping 10 matching lines...) Expand all Loading... | |
27 // store only. | 29 // store only. |
28 void IgnoreReadError(PersistentPrefStore::PrefReadError error) {} | 30 void IgnoreReadError(PersistentPrefStore::PrefReadError error) {} |
29 } // namespace | 31 } // namespace |
30 | 32 |
31 namespace blimp { | 33 namespace blimp { |
32 namespace engine { | 34 namespace engine { |
33 | 35 |
34 // Contains URLRequestContextGetter required for resource loading. | 36 // Contains URLRequestContextGetter required for resource loading. |
35 class BlimpResourceContext : public content::ResourceContext { | 37 class BlimpResourceContext : public content::ResourceContext { |
36 public: | 38 public: |
37 BlimpResourceContext() {} | 39 BlimpResourceContext() |
40 : media_device_id_salt_(CreateRandomMediaDeviceIDSalt()) {} | |
38 ~BlimpResourceContext() override {} | 41 ~BlimpResourceContext() override {} |
39 | 42 |
40 void set_url_request_context_getter( | 43 void set_url_request_context_getter( |
41 const scoped_refptr<BlimpURLRequestContextGetter>& getter) { | 44 const scoped_refptr<BlimpURLRequestContextGetter>& getter) { |
42 getter_ = getter; | 45 getter_ = getter; |
43 } | 46 } |
44 | 47 |
45 const scoped_refptr<BlimpURLRequestContextGetter>& | 48 const scoped_refptr<BlimpURLRequestContextGetter>& |
46 url_request_context_getter() { | 49 url_request_context_getter() { |
47 return getter_; | 50 return getter_; |
48 } | 51 } |
49 | 52 |
50 // content::ResourceContext implementation. | 53 // content::ResourceContext implementation. |
51 net::HostResolver* GetHostResolver() override; | 54 net::HostResolver* GetHostResolver() override; |
52 net::URLRequestContext* GetRequestContext() override; | 55 net::URLRequestContext* GetRequestContext() override; |
56 SaltCallback GetMediaDeviceIDSalt() override; | |
53 | 57 |
54 private: | 58 private: |
55 scoped_refptr<BlimpURLRequestContextGetter> getter_; | 59 scoped_refptr<BlimpURLRequestContextGetter> getter_; |
60 std::string media_device_id_salt_; | |
tommi (sloooow) - chröme
2016/05/17 12:27:20
const?
Guido Urdaneta
2016/05/18 09:40:19
Done.
| |
56 | 61 |
57 DISALLOW_COPY_AND_ASSIGN(BlimpResourceContext); | 62 DISALLOW_COPY_AND_ASSIGN(BlimpResourceContext); |
58 }; | 63 }; |
59 | 64 |
60 net::HostResolver* BlimpResourceContext::GetHostResolver() { | 65 net::HostResolver* BlimpResourceContext::GetHostResolver() { |
61 return getter_->host_resolver(); | 66 return getter_->host_resolver(); |
62 } | 67 } |
63 | 68 |
64 net::URLRequestContext* BlimpResourceContext::GetRequestContext() { | 69 net::URLRequestContext* BlimpResourceContext::GetRequestContext() { |
65 return getter_->GetURLRequestContext(); | 70 return getter_->GetURLRequestContext(); |
66 } | 71 } |
67 | 72 |
73 content::ResourceContext::SaltCallback | |
74 BlimpResourceContext::GetMediaDeviceIDSalt() { | |
75 return CreateSaltCallback(media_device_id_salt_); | |
76 } | |
77 | |
68 BlimpBrowserContext::BlimpBrowserContext(bool off_the_record, | 78 BlimpBrowserContext::BlimpBrowserContext(bool off_the_record, |
69 net::NetLog* net_log) | 79 net::NetLog* net_log) |
70 : resource_context_(new BlimpResourceContext), | 80 : resource_context_(new BlimpResourceContext), |
71 ignore_certificate_errors_(false), | 81 ignore_certificate_errors_(false), |
72 off_the_record_(off_the_record), | 82 off_the_record_(off_the_record), |
73 net_log_(net_log) { | 83 net_log_(net_log) { |
74 InitWhileIOAllowed(); | 84 InitWhileIOAllowed(); |
75 InitPrefService(); | 85 InitPrefService(); |
76 metrics_service_client_.reset( | 86 metrics_service_client_.reset( |
77 new BlimpMetricsServiceClient(pref_service_.get(), | 87 new BlimpMetricsServiceClient(pref_service_.get(), |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
201 | 211 |
202 net::URLRequestContextGetter* | 212 net::URLRequestContextGetter* |
203 BlimpBrowserContext::CreateMediaRequestContextForStoragePartition( | 213 BlimpBrowserContext::CreateMediaRequestContextForStoragePartition( |
204 const base::FilePath& partition_path, | 214 const base::FilePath& partition_path, |
205 bool in_memory) { | 215 bool in_memory) { |
206 return nullptr; | 216 return nullptr; |
207 } | 217 } |
208 | 218 |
209 } // namespace engine | 219 } // namespace engine |
210 } // namespace blimp | 220 } // namespace blimp |
OLD | NEW |