| 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_local_storage_helper.h" | 5 #include "chrome/browser/browsing_data_local_storage_helper.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
| 9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 } | 85 } |
| 86 | 86 |
| 87 void BrowsingDataLocalStorageHelper::FetchLocalStorageInfo( | 87 void BrowsingDataLocalStorageHelper::FetchLocalStorageInfo( |
| 88 const std::vector<FilePath>& files) { | 88 const std::vector<FilePath>& files) { |
| 89 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); | 89 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); |
| 90 for (size_t i = 0; i < files.size(); ++i) { | 90 for (size_t i = 0; i < files.size(); ++i) { |
| 91 FilePath file_path = files[i]; | 91 FilePath file_path = files[i]; |
| 92 WebSecurityOrigin web_security_origin = | 92 WebSecurityOrigin web_security_origin = |
| 93 WebSecurityOrigin::createFromDatabaseIdentifier( | 93 WebSecurityOrigin::createFromDatabaseIdentifier( |
| 94 webkit_glue::FilePathToWebString(file_path.BaseName())); | 94 webkit_glue::FilePathToWebString(file_path.BaseName())); |
| 95 if (!BrowsingDataHelper::IsValidScheme(web_security_origin.protocol())) | 95 if (!BrowsingDataHelper::IsWebScheme(web_security_origin.protocol())) |
| 96 continue; // Non-websafe state is not considered browsing data. | 96 continue; // Non-websafe state is not considered browsing data. |
| 97 | 97 |
| 98 base::PlatformFileInfo file_info; | 98 base::PlatformFileInfo file_info; |
| 99 bool ret = file_util::GetFileInfo(file_path, &file_info); | 99 bool ret = file_util::GetFileInfo(file_path, &file_info); |
| 100 if (ret) { | 100 if (ret) { |
| 101 local_storage_info_.push_back(LocalStorageInfo( | 101 local_storage_info_.push_back(LocalStorageInfo( |
| 102 web_security_origin.protocol().utf8(), | 102 web_security_origin.protocol().utf8(), |
| 103 web_security_origin.host().utf8(), | 103 web_security_origin.host().utf8(), |
| 104 web_security_origin.port(), | 104 web_security_origin.port(), |
| 105 web_security_origin.databaseIdentifier().utf8(), | 105 web_security_origin.databaseIdentifier().utf8(), |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 138 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 139 CannedBrowsingDataLocalStorageHelper* clone = | 139 CannedBrowsingDataLocalStorageHelper* clone = |
| 140 new CannedBrowsingDataLocalStorageHelper(profile_); | 140 new CannedBrowsingDataLocalStorageHelper(profile_); |
| 141 | 141 |
| 142 clone->pending_local_storage_info_ = pending_local_storage_info_; | 142 clone->pending_local_storage_info_ = pending_local_storage_info_; |
| 143 return clone; | 143 return clone; |
| 144 } | 144 } |
| 145 | 145 |
| 146 void CannedBrowsingDataLocalStorageHelper::AddLocalStorage( | 146 void CannedBrowsingDataLocalStorageHelper::AddLocalStorage( |
| 147 const GURL& origin) { | 147 const GURL& origin) { |
| 148 if (BrowsingDataHelper::HasValidScheme(origin)) | 148 if (BrowsingDataHelper::HasWebScheme(origin)) |
| 149 pending_local_storage_info_.insert(origin); | 149 pending_local_storage_info_.insert(origin); |
| 150 } | 150 } |
| 151 | 151 |
| 152 void CannedBrowsingDataLocalStorageHelper::Reset() { | 152 void CannedBrowsingDataLocalStorageHelper::Reset() { |
| 153 pending_local_storage_info_.clear(); | 153 pending_local_storage_info_.clear(); |
| 154 } | 154 } |
| 155 | 155 |
| 156 bool CannedBrowsingDataLocalStorageHelper::empty() const { | 156 bool CannedBrowsingDataLocalStorageHelper::empty() const { |
| 157 return pending_local_storage_info_.empty(); | 157 return pending_local_storage_info_.empty(); |
| 158 } | 158 } |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 GetFilePath(web_security_origin.databaseIdentifier()), | 204 GetFilePath(web_security_origin.databaseIdentifier()), |
| 205 0, | 205 0, |
| 206 base::Time())); | 206 base::Time())); |
| 207 } | 207 } |
| 208 | 208 |
| 209 BrowserThread::PostTask( | 209 BrowserThread::PostTask( |
| 210 BrowserThread::UI, FROM_HERE, | 210 BrowserThread::UI, FROM_HERE, |
| 211 base::Bind(&CannedBrowsingDataLocalStorageHelper::NotifyInUIThread, | 211 base::Bind(&CannedBrowsingDataLocalStorageHelper::NotifyInUIThread, |
| 212 this)); | 212 this)); |
| 213 } | 213 } |
| OLD | NEW |