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" |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 61 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
62 return UserDataAdapter<StreamContext>::Get( | 62 return UserDataAdapter<StreamContext>::Get( |
63 resource_context, kStreamContextKeyName); | 63 resource_context, kStreamContextKeyName); |
64 } | 64 } |
65 | 65 |
66 URLDataManagerBackend* GetURLDataManagerForResourceContext( | 66 URLDataManagerBackend* GetURLDataManagerForResourceContext( |
67 ResourceContext* context) { | 67 ResourceContext* context) { |
68 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 68 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
69 if (!context->GetUserData(kURLDataManagerBackendKeyName)) { | 69 if (!context->GetUserData(kURLDataManagerBackendKeyName)) { |
70 context->SetUserData(kURLDataManagerBackendKeyName, | 70 context->SetUserData(kURLDataManagerBackendKeyName, |
71 new URLDataManagerBackend()); | 71 base::MakeUnique<URLDataManagerBackend>()); |
72 } | 72 } |
73 return static_cast<URLDataManagerBackend*>( | 73 return static_cast<URLDataManagerBackend*>( |
74 context->GetUserData(kURLDataManagerBackendKeyName)); | 74 context->GetUserData(kURLDataManagerBackendKeyName)); |
75 } | 75 } |
76 | 76 |
77 void InitializeResourceContext(BrowserContext* browser_context) { | 77 void InitializeResourceContext(BrowserContext* browser_context) { |
78 ResourceContext* resource_context = browser_context->GetResourceContext(); | 78 ResourceContext* resource_context = browser_context->GetResourceContext(); |
79 | 79 |
80 resource_context->SetUserData( | 80 resource_context->SetUserData( |
81 kBlobStorageContextKeyName, | 81 kBlobStorageContextKeyName, |
82 new UserDataAdapter<ChromeBlobStorageContext>( | 82 base::MakeUnique<UserDataAdapter<ChromeBlobStorageContext>>( |
83 ChromeBlobStorageContext::GetFor(browser_context))); | 83 ChromeBlobStorageContext::GetFor(browser_context))); |
84 | 84 |
85 resource_context->SetUserData( | 85 resource_context->SetUserData( |
86 kStreamContextKeyName, | 86 kStreamContextKeyName, base::MakeUnique<UserDataAdapter<StreamContext>>( |
87 new UserDataAdapter<StreamContext>( | 87 StreamContext::GetFor(browser_context))); |
88 StreamContext::GetFor(browser_context))); | |
89 | 88 |
90 resource_context->DetachFromSequence(); | 89 resource_context->DetachFromSequence(); |
91 } | 90 } |
92 | 91 |
93 } // namespace content | 92 } // namespace content |
OLD | NEW |