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 "base/guid.h" | 8 #include "base/guid.h" |
9 #include "content/public/browser/blob_handle.h" | 9 #include "content/public/browser/blob_handle.h" |
10 #include "content/public/browser/browser_context.h" | 10 #include "content/public/browser/browser_context.h" |
11 #include "content/public/browser/browser_thread.h" | 11 #include "content/public/browser/browser_thread.h" |
12 #include "storage/browser/blob/blob_data_handle.h" | 12 #include "storage/browser/blob/blob_data_handle.h" |
13 #include "storage/browser/blob/blob_storage_context.h" | 13 #include "storage/browser/blob/blob_storage_context.h" |
14 | 14 |
15 using base::UserDataAdapter; | 15 using base::UserDataAdapter; |
16 using storage::BlobStorageContext; | 16 using storage::BlobStorageContext; |
17 | 17 |
18 namespace content { | 18 namespace content { |
19 | 19 |
20 namespace { | 20 namespace { |
21 | 21 |
22 const char kBlobStorageContextKeyName[] = "content_blob_storage_context"; | 22 const char kBlobStorageContextKeyName[] = "content_blob_storage_context"; |
23 | 23 |
24 class BlobHandleImpl : public BlobHandle { | 24 class BlobHandleImpl : public BlobHandle { |
25 public: | 25 public: |
26 explicit BlobHandleImpl(scoped_ptr<storage::BlobDataHandle> handle) | 26 explicit BlobHandleImpl(scoped_ptr<storage::BlobDataHandle> handle) |
27 : handle_(handle.Pass()) { | 27 : handle_(handle.Pass()) { |
28 } | 28 } |
29 | 29 |
30 virtual ~BlobHandleImpl() {} | 30 ~BlobHandleImpl() override {} |
31 | 31 |
32 virtual std::string GetUUID() override { | 32 std::string GetUUID() override { return handle_->uuid(); } |
33 return handle_->uuid(); | |
34 } | |
35 | 33 |
36 private: | 34 private: |
37 scoped_ptr<storage::BlobDataHandle> handle_; | 35 scoped_ptr<storage::BlobDataHandle> handle_; |
38 }; | 36 }; |
39 | 37 |
40 } // namespace | 38 } // namespace |
41 | 39 |
42 ChromeBlobStorageContext::ChromeBlobStorageContext() {} | 40 ChromeBlobStorageContext::ChromeBlobStorageContext() {} |
43 | 41 |
44 ChromeBlobStorageContext* ChromeBlobStorageContext::GetFor( | 42 ChromeBlobStorageContext* ChromeBlobStorageContext::GetFor( |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 void ChromeBlobStorageContext::DeleteOnCorrectThread() const { | 87 void ChromeBlobStorageContext::DeleteOnCorrectThread() const { |
90 if (BrowserThread::IsMessageLoopValid(BrowserThread::IO) && | 88 if (BrowserThread::IsMessageLoopValid(BrowserThread::IO) && |
91 !BrowserThread::CurrentlyOn(BrowserThread::IO)) { | 89 !BrowserThread::CurrentlyOn(BrowserThread::IO)) { |
92 BrowserThread::DeleteSoon(BrowserThread::IO, FROM_HERE, this); | 90 BrowserThread::DeleteSoon(BrowserThread::IO, FROM_HERE, this); |
93 return; | 91 return; |
94 } | 92 } |
95 delete this; | 93 delete this; |
96 } | 94 } |
97 | 95 |
98 } // namespace content | 96 } // namespace content |
OLD | NEW |