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 "base/logging.h" | 7 #include "base/logging.h" |
8 #include "content/browser/fileapi/chrome_blob_storage_context.h" | 8 #include "content/browser/fileapi/chrome_blob_storage_context.h" |
9 #include "content/browser/host_zoom_map_impl.h" | 9 #include "content/browser/host_zoom_map_impl.h" |
10 #include "content/browser/loader/resource_dispatcher_host_impl.h" | 10 #include "content/browser/loader/resource_dispatcher_host_impl.h" |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 return UserDataAdapter<ChromeBlobStorageContext>::Get( | 58 return UserDataAdapter<ChromeBlobStorageContext>::Get( |
59 resource_context, kBlobStorageContextKeyName); | 59 resource_context, kBlobStorageContextKeyName); |
60 } | 60 } |
61 | 61 |
62 HostZoomMap* GetHostZoomMapForResourceContext(ResourceContext* context) { | 62 HostZoomMap* GetHostZoomMapForResourceContext(ResourceContext* context) { |
63 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 63 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
64 return static_cast<NonOwningZoomData*>( | 64 return static_cast<NonOwningZoomData*>( |
65 context->GetUserData(kHostZoomMapKeyName))->host_zoom_map(); | 65 context->GetUserData(kHostZoomMapKeyName))->host_zoom_map(); |
66 } | 66 } |
67 | 67 |
68 ChromeURLDataManagerBackend* GetURLDataManagerForResourceContext( | 68 URLDataManagerBackend* GetURLDataManagerForResourceContext( |
69 ResourceContext* context) { | 69 ResourceContext* context) { |
70 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 70 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
71 if (!context->GetUserData(kURLDataManagerBackendKeyName)) { | 71 if (!context->GetUserData(kURLDataManagerBackendKeyName)) { |
72 context->SetUserData(kURLDataManagerBackendKeyName, | 72 context->SetUserData(kURLDataManagerBackendKeyName, |
73 new ChromeURLDataManagerBackend()); | 73 new URLDataManagerBackend()); |
74 } | 74 } |
75 return static_cast<ChromeURLDataManagerBackend*>( | 75 return static_cast<URLDataManagerBackend*>( |
76 context->GetUserData(kURLDataManagerBackendKeyName)); | 76 context->GetUserData(kURLDataManagerBackendKeyName)); |
77 } | 77 } |
78 | 78 |
79 void InitializeResourceContext(BrowserContext* browser_context) { | 79 void InitializeResourceContext(BrowserContext* browser_context) { |
80 ResourceContext* resource_context = browser_context->GetResourceContext(); | 80 ResourceContext* resource_context = browser_context->GetResourceContext(); |
81 DCHECK(!resource_context->GetUserData(kHostZoomMapKeyName)); | 81 DCHECK(!resource_context->GetUserData(kHostZoomMapKeyName)); |
82 | 82 |
83 resource_context->SetUserData( | 83 resource_context->SetUserData( |
84 kBlobStorageContextKeyName, | 84 kBlobStorageContextKeyName, |
85 new UserDataAdapter<ChromeBlobStorageContext>( | 85 new UserDataAdapter<ChromeBlobStorageContext>( |
86 ChromeBlobStorageContext::GetFor(browser_context))); | 86 ChromeBlobStorageContext::GetFor(browser_context))); |
87 | 87 |
88 // This object is owned by the BrowserContext and not ResourceContext, so | 88 // This object is owned by the BrowserContext and not ResourceContext, so |
89 // store a non-owning pointer here. | 89 // store a non-owning pointer here. |
90 resource_context->SetUserData( | 90 resource_context->SetUserData( |
91 kHostZoomMapKeyName, | 91 kHostZoomMapKeyName, |
92 new NonOwningZoomData( | 92 new NonOwningZoomData( |
93 HostZoomMap::GetForBrowserContext(browser_context))); | 93 HostZoomMap::GetForBrowserContext(browser_context))); |
94 | 94 |
95 resource_context->DetachUserDataThread(); | 95 resource_context->DetachUserDataThread(); |
96 } | 96 } |
97 | 97 |
98 } // namespace content | 98 } // namespace content |
OLD | NEW |