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/fileapi/chrome_blob_storage_context.h" | 5 #include "content/browser/fileapi/chrome_blob_storage_context.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "content/public/browser/browser_context.h" | 8 #include "content/public/browser/browser_context.h" |
9 #include "webkit/blob/blob_storage_controller.h" | 9 #include "webkit/blob/blob_storage_controller.h" |
10 | 10 |
11 using base::UserDataAdapter; | 11 using base::UserDataAdapter; |
12 using content::BrowserContext; | |
13 using content::BrowserThread; | |
14 using webkit_blob::BlobStorageController; | 12 using webkit_blob::BlobStorageController; |
15 | 13 |
14 namespace content { | |
15 | |
16 static const char* kBlobStorageContextKeyName = "content_blob_storage_context"; | 16 static const char* kBlobStorageContextKeyName = "content_blob_storage_context"; |
tfarina
2012/10/24 21:10:40
nit: const char kBlobStorageContextKeyName[] = "co
jam
2012/10/24 21:19:48
why? i think it's easier to keep all the code (inc
| |
17 | 17 |
18 ChromeBlobStorageContext::ChromeBlobStorageContext() {} | 18 ChromeBlobStorageContext::ChromeBlobStorageContext() {} |
19 | 19 |
20 ChromeBlobStorageContext* ChromeBlobStorageContext::GetFor( | 20 ChromeBlobStorageContext* ChromeBlobStorageContext::GetFor( |
21 BrowserContext* context) { | 21 BrowserContext* context) { |
22 if (!context->GetUserData(kBlobStorageContextKeyName)) { | 22 if (!context->GetUserData(kBlobStorageContextKeyName)) { |
23 scoped_refptr<ChromeBlobStorageContext> blob = | 23 scoped_refptr<ChromeBlobStorageContext> blob = |
24 new ChromeBlobStorageContext(); | 24 new ChromeBlobStorageContext(); |
25 context->SetUserData(kBlobStorageContextKeyName, | 25 context->SetUserData(kBlobStorageContextKeyName, |
26 new UserDataAdapter<ChromeBlobStorageContext>(blob)); | 26 new UserDataAdapter<ChromeBlobStorageContext>(blob)); |
(...skipping 17 matching lines...) Expand all Loading... | |
44 ChromeBlobStorageContext::~ChromeBlobStorageContext() {} | 44 ChromeBlobStorageContext::~ChromeBlobStorageContext() {} |
45 | 45 |
46 void ChromeBlobStorageContext::DeleteOnCorrectThread() const { | 46 void ChromeBlobStorageContext::DeleteOnCorrectThread() const { |
47 if (BrowserThread::IsMessageLoopValid(BrowserThread::IO) && | 47 if (BrowserThread::IsMessageLoopValid(BrowserThread::IO) && |
48 !BrowserThread::CurrentlyOn(BrowserThread::IO)) { | 48 !BrowserThread::CurrentlyOn(BrowserThread::IO)) { |
49 BrowserThread::DeleteSoon(BrowserThread::IO, FROM_HERE, this); | 49 BrowserThread::DeleteSoon(BrowserThread::IO, FROM_HERE, this); |
50 return; | 50 return; |
51 } | 51 } |
52 delete this; | 52 delete this; |
53 } | 53 } |
54 | |
55 } // namespace content | |
OLD | NEW |