| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/browser/resource_context_impl.h" | 5 #include "content/browser/resource_context_impl.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include "base/base64.h" | 9 #include "base/base64.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| 11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "base/memory/ptr_util.h" | 12 #include "base/memory/ptr_util.h" |
| 13 #include "base/rand_util.h" | 13 #include "base/rand_util.h" |
| 14 #include "content/browser/blob_storage/chrome_blob_storage_context.h" | 14 #include "content/browser/blob_storage/chrome_blob_storage_context.h" |
| 15 #include "content/browser/loader/resource_dispatcher_host_impl.h" | 15 #include "content/browser/loader/resource_dispatcher_host_impl.h" |
| 16 #include "content/browser/loader/resource_request_info_impl.h" | 16 #include "content/browser/loader/resource_request_info_impl.h" |
| 17 #include "content/browser/streams/stream_context.h" | 17 #include "content/browser/streams/stream_context.h" |
| 18 #include "content/browser/webui/url_data_manager_backend.h" | 18 #include "content/browser/webui/url_data_manager_backend.h" |
| 19 #include "content/public/browser/browser_context.h" | 19 #include "content/public/browser/browser_context.h" |
| 20 #include "content/public/browser/browser_thread.h" | 20 #include "content/public/browser/browser_thread.h" |
| 21 #include "net/base/keygen_handler.h" | 21 #include "net/base/keygen_handler.h" |
| 22 #include "net/ssl/client_cert_store.h" | |
| 23 | 22 |
| 24 using base::UserDataAdapter; | 23 using base::UserDataAdapter; |
| 25 | 24 |
| 26 namespace content { | 25 namespace content { |
| 27 | 26 |
| 28 // Key names on ResourceContext. | 27 // Key names on ResourceContext. |
| 29 const char kBlobStorageContextKeyName[] = "content_blob_storage_context"; | 28 const char kBlobStorageContextKeyName[] = "content_blob_storage_context"; |
| 30 const char kStreamContextKeyName[] = "content_stream_context"; | 29 const char kStreamContextKeyName[] = "content_stream_context"; |
| 31 const char kURLDataManagerBackendKeyName[] = "url_data_manager_backend"; | 30 const char kURLDataManagerBackendKeyName[] = "url_data_manager_backend"; |
| 32 | 31 |
| 33 ResourceContext::ResourceContext() | 32 ResourceContext::ResourceContext() |
| 34 : media_device_id_salt_(CreateRandomMediaDeviceIDSalt()) { | 33 : media_device_id_salt_(CreateRandomMediaDeviceIDSalt()) { |
| 35 } | 34 } |
| 36 | 35 |
| 37 ResourceContext::~ResourceContext() { | 36 ResourceContext::~ResourceContext() { |
| 38 if (ResourceDispatcherHostImpl::Get()) | 37 if (ResourceDispatcherHostImpl::Get()) |
| 39 ResourceDispatcherHostImpl::Get()->CancelRequestsForContext(this); | 38 ResourceDispatcherHostImpl::Get()->CancelRequestsForContext(this); |
| 40 } | 39 } |
| 41 | 40 |
| 42 std::string ResourceContext::GetMediaDeviceIDSalt() { | 41 std::string ResourceContext::GetMediaDeviceIDSalt() { |
| 43 return media_device_id_salt_; | 42 return media_device_id_salt_; |
| 44 } | 43 } |
| 45 | 44 |
| 46 std::unique_ptr<net::ClientCertStore> ResourceContext::CreateClientCertStore() { | |
| 47 return std::unique_ptr<net::ClientCertStore>(); | |
| 48 } | |
| 49 | |
| 50 void ResourceContext::CreateKeygenHandler( | 45 void ResourceContext::CreateKeygenHandler( |
| 51 uint32_t key_size_in_bits, | 46 uint32_t key_size_in_bits, |
| 52 const std::string& challenge_string, | 47 const std::string& challenge_string, |
| 53 const GURL& url, | 48 const GURL& url, |
| 54 const base::Callback<void(std::unique_ptr<net::KeygenHandler>)>& callback) { | 49 const base::Callback<void(std::unique_ptr<net::KeygenHandler>)>& callback) { |
| 55 callback.Run(base::WrapUnique( | 50 callback.Run(base::WrapUnique( |
| 56 new net::KeygenHandler(key_size_in_bits, challenge_string, url))); | 51 new net::KeygenHandler(key_size_in_bits, challenge_string, url))); |
| 57 } | 52 } |
| 58 | 53 |
| 59 // static | 54 // static |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 | 94 |
| 100 resource_context->SetUserData( | 95 resource_context->SetUserData( |
| 101 kStreamContextKeyName, | 96 kStreamContextKeyName, |
| 102 new UserDataAdapter<StreamContext>( | 97 new UserDataAdapter<StreamContext>( |
| 103 StreamContext::GetFor(browser_context))); | 98 StreamContext::GetFor(browser_context))); |
| 104 | 99 |
| 105 resource_context->DetachUserDataThread(); | 100 resource_context->DetachUserDataThread(); |
| 106 } | 101 } |
| 107 | 102 |
| 108 } // namespace content | 103 } // namespace content |
| OLD | NEW |