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/public/browser/browser_context.h" | 5 #include "content/public/browser/browser_context.h" |
6 | 6 |
7 #include "content/browser/appcache/chrome_appcache_service.h" | 7 #include "content/browser/appcache/chrome_appcache_service.h" |
8 #include "content/browser/file_system/browser_file_system_helper.h" | 8 #include "content/browser/file_system/browser_file_system_helper.h" |
9 #include "content/browser/in_process_webkit/webkit_context.h" | 9 #include "content/browser/in_process_webkit/webkit_context.h" |
10 #include "content/browser/resource_context_impl.h" | 10 #include "content/browser/resource_context_impl.h" |
11 #include "content/public/browser/browser_thread.h" | 11 #include "content/public/browser/browser_thread.h" |
12 #include "content/public/common/content_constants.h" | 12 #include "content/public/common/content_constants.h" |
13 #include "webkit/database/database_tracker.h" | 13 #include "webkit/database/database_tracker.h" |
14 #include "webkit/quota/quota_manager.h" | 14 #include "webkit/quota/quota_manager.h" |
15 | 15 |
16 using appcache::AppCacheService; | 16 using appcache::AppCacheService; |
17 using base::UserDataAdapter; | 17 using base::UserDataAdapter; |
18 using content::BrowserThread; | 18 using content::BrowserThread; |
19 using fileapi::FileSystemContext; | 19 using fileapi::FileSystemContext; |
20 using quota::QuotaManager; | 20 using quota::QuotaManager; |
21 using webkit_database::DatabaseTracker; | 21 using webkit_database::DatabaseTracker; |
22 | 22 |
23 // Key names on BrowserContext. | 23 // Key names on BrowserContext. |
erikwright (departed)
2012/02/23 22:16:00
Note that these keys are sent to SupportsUserData:
jam
2012/02/23 23:11:36
these aren't meant to be shared. the map on Resour
| |
24 static const char* kAppCacheServicKeyName = "content_appcache_service_tracker"; | 24 static const char* kAppCacheServicKeyName = "content_appcache_service_tracker"; |
25 static const char* kDatabaseTrackerKeyName = "content_database_tracker"; | 25 static const char* kDatabaseTrackerKeyName = "content_database_tracker"; |
26 static const char* kFileSystemContextKeyName = "content_file_system_context"; | 26 static const char* kFileSystemContextKeyName = "content_file_system_context"; |
27 static const char* kQuotaManagerKeyName = "content_quota_manager"; | 27 static const char* kQuotaManagerKeyName = "content_quota_manager"; |
28 static const char* kWebKitContextKeyName = "content_webkit_context"; | 28 static const char* kWebKitContextKeyName = "content_webkit_context"; |
29 | 29 |
30 namespace content { | 30 namespace content { |
31 | 31 |
32 void CreateQuotaManagerAndClients(BrowserContext* context) { | 32 void CreateQuotaManagerAndClients(BrowserContext* context) { |
33 if (context->GetUserData(kQuotaManagerKeyName)) { | 33 if (context->GetUserData(kQuotaManagerKeyName)) { |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
118 } | 118 } |
119 | 119 |
120 FileSystemContext* BrowserContext::GetFileSystemContext( | 120 FileSystemContext* BrowserContext::GetFileSystemContext( |
121 BrowserContext* browser_context) { | 121 BrowserContext* browser_context) { |
122 CreateQuotaManagerAndClients(browser_context); | 122 CreateQuotaManagerAndClients(browser_context); |
123 return UserDataAdapter<FileSystemContext>::Get( | 123 return UserDataAdapter<FileSystemContext>::Get( |
124 browser_context, kFileSystemContextKeyName); | 124 browser_context, kFileSystemContextKeyName); |
125 } | 125 } |
126 | 126 |
127 void BrowserContext::EnsureResourceContextInitialized(BrowserContext* context) { | 127 void BrowserContext::EnsureResourceContextInitialized(BrowserContext* context) { |
128 if (context->GetResourceContext()->GetUserData(kWebKitContextKeyName)) | |
129 return; | |
130 InitializeResourceContext(context); | 128 InitializeResourceContext(context); |
131 } | 129 } |
132 | 130 |
133 BrowserContext::~BrowserContext() { | 131 BrowserContext::~BrowserContext() { |
134 if (GetUserData(kDatabaseTrackerKeyName) && | 132 if (GetUserData(kDatabaseTrackerKeyName) && |
135 BrowserThread::IsMessageLoopValid(BrowserThread::FILE)) { | 133 BrowserThread::IsMessageLoopValid(BrowserThread::FILE)) { |
136 BrowserThread::PostTask( | 134 BrowserThread::PostTask( |
137 BrowserThread::FILE, FROM_HERE, | 135 BrowserThread::FILE, FROM_HERE, |
138 base::Bind(&webkit_database::DatabaseTracker::Shutdown, | 136 base::Bind(&webkit_database::DatabaseTracker::Shutdown, |
139 GetDatabaseTracker(this))); | 137 GetDatabaseTracker(this))); |
140 } | 138 } |
141 } | 139 } |
142 | 140 |
143 } // namespace content | 141 } // namespace content |
OLD | NEW |