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" |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 | 121 |
122 void CannedBrowsingDataLocalStorageHelper::StartFetching( | 122 void CannedBrowsingDataLocalStorageHelper::StartFetching( |
123 const base::Callback<void(const std::list<LocalStorageInfo>&)>& callback) { | 123 const base::Callback<void(const std::list<LocalStorageInfo>&)>& callback) { |
124 DCHECK(!is_fetching_); | 124 DCHECK(!is_fetching_); |
125 DCHECK_EQ(false, callback.is_null()); | 125 DCHECK_EQ(false, callback.is_null()); |
126 | 126 |
127 is_fetching_ = true; | 127 is_fetching_ = true; |
128 completion_callback_ = callback; | 128 completion_callback_ = callback; |
129 | 129 |
130 // We post a task to emulate async fetching behavior. | 130 // We post a task to emulate async fetching behavior. |
131 MessageLoop::current()->PostTask( | 131 base::MessageLoop::current()->PostTask( |
132 FROM_HERE, | 132 FROM_HERE, |
133 base::Bind(&CannedBrowsingDataLocalStorageHelper:: | 133 base::Bind(&CannedBrowsingDataLocalStorageHelper::ConvertPendingInfo, |
134 ConvertPendingInfo, this)); | 134 this)); |
135 } | 135 } |
136 | 136 |
137 CannedBrowsingDataLocalStorageHelper::~CannedBrowsingDataLocalStorageHelper() {} | 137 CannedBrowsingDataLocalStorageHelper::~CannedBrowsingDataLocalStorageHelper() {} |
138 | 138 |
139 void CannedBrowsingDataLocalStorageHelper::ConvertPendingInfo() { | 139 void CannedBrowsingDataLocalStorageHelper::ConvertPendingInfo() { |
140 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 140 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
141 local_storage_info_.clear(); | 141 local_storage_info_.clear(); |
142 for (std::set<GURL>::iterator iter = pending_local_storage_info_.begin(); | 142 for (std::set<GURL>::iterator iter = pending_local_storage_info_.begin(); |
143 iter != pending_local_storage_info_.end(); ++iter) { | 143 iter != pending_local_storage_info_.end(); ++iter) { |
144 local_storage_info_.push_back( | 144 local_storage_info_.push_back( |
145 LocalStorageInfo(*iter, 0, base::Time())); | 145 LocalStorageInfo(*iter, 0, base::Time())); |
146 } | 146 } |
147 MessageLoop::current()->PostTask( | 147 base::MessageLoop::current()->PostTask( |
148 FROM_HERE, | 148 FROM_HERE, |
149 base::Bind(&CannedBrowsingDataLocalStorageHelper::CallCompletionCallback, | 149 base::Bind(&CannedBrowsingDataLocalStorageHelper::CallCompletionCallback, |
150 this)); | 150 this)); |
151 } | 151 } |
OLD | NEW |