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 "chrome/browser/browsing_data/browsing_data_local_storage_helper.h" | 5 #include "chrome/browser/browsing_data/browsing_data_local_storage_helper.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "chrome/browser/browsing_data/browsing_data_helper.h" | 9 #include "chrome/browser/browsing_data/browsing_data_helper.h" |
10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
11 #include "content/public/browser/browser_thread.h" | 11 #include "content/public/browser/browser_thread.h" |
12 #include "content/public/browser/dom_storage_context.h" | 12 #include "content/public/browser/dom_storage_context.h" |
| 13 #include "content/public/browser/storage_partition.h" |
13 | 14 |
14 using content::BrowserContext; | 15 using content::BrowserContext; |
15 using content::BrowserThread; | 16 using content::BrowserThread; |
16 using content::DOMStorageContext; | 17 using content::DOMStorageContext; |
17 using dom_storage::DomStorageContext; | 18 using dom_storage::DomStorageContext; |
18 | 19 |
19 BrowsingDataLocalStorageHelper::LocalStorageInfo::LocalStorageInfo( | 20 BrowsingDataLocalStorageHelper::LocalStorageInfo::LocalStorageInfo( |
20 const GURL& origin_url, int64 size, base::Time last_modified) | 21 const GURL& origin_url, int64 size, base::Time last_modified) |
21 : origin_url(origin_url), size(size), last_modified(last_modified) {} | 22 : origin_url(origin_url), size(size), last_modified(last_modified) {} |
22 | 23 |
23 BrowsingDataLocalStorageHelper::LocalStorageInfo::~LocalStorageInfo() {} | 24 BrowsingDataLocalStorageHelper::LocalStorageInfo::~LocalStorageInfo() {} |
24 | 25 |
25 BrowsingDataLocalStorageHelper::BrowsingDataLocalStorageHelper( | 26 BrowsingDataLocalStorageHelper::BrowsingDataLocalStorageHelper( |
26 Profile* profile) | 27 Profile* profile) |
27 : dom_storage_context_( | 28 : dom_storage_context_( |
28 BrowserContext::GetDefaultDOMStorageContext(profile)), | 29 BrowserContext::GetDefaultStoragePartition(profile)-> |
| 30 GetDOMStorageContext()), |
29 is_fetching_(false) { | 31 is_fetching_(false) { |
30 DCHECK(dom_storage_context_); | 32 DCHECK(dom_storage_context_); |
31 } | 33 } |
32 | 34 |
33 BrowsingDataLocalStorageHelper::~BrowsingDataLocalStorageHelper() { | 35 BrowsingDataLocalStorageHelper::~BrowsingDataLocalStorageHelper() { |
34 } | 36 } |
35 | 37 |
36 void BrowsingDataLocalStorageHelper::StartFetching( | 38 void BrowsingDataLocalStorageHelper::StartFetching( |
37 const base::Callback<void(const std::list<LocalStorageInfo>&)>& callback) { | 39 const base::Callback<void(const std::list<LocalStorageInfo>&)>& callback) { |
38 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 40 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 for (std::set<GURL>::iterator iter = pending_local_storage_info_.begin(); | 143 for (std::set<GURL>::iterator iter = pending_local_storage_info_.begin(); |
142 iter != pending_local_storage_info_.end(); ++iter) { | 144 iter != pending_local_storage_info_.end(); ++iter) { |
143 local_storage_info_.push_back( | 145 local_storage_info_.push_back( |
144 LocalStorageInfo(*iter, 0, base::Time())); | 146 LocalStorageInfo(*iter, 0, base::Time())); |
145 } | 147 } |
146 MessageLoop::current()->PostTask( | 148 MessageLoop::current()->PostTask( |
147 FROM_HERE, | 149 FROM_HERE, |
148 base::Bind(&CannedBrowsingDataLocalStorageHelper::CallCompletionCallback, | 150 base::Bind(&CannedBrowsingDataLocalStorageHelper::CallCompletionCallback, |
149 this)); | 151 this)); |
150 } | 152 } |
OLD | NEW |