OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_database_helper.h" | 5 #include "chrome/browser/browsing_data_database_helper.h" |
6 | 6 |
7 #include "base/callback.h" | 7 #include "base/callback.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/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
11 #include "chrome/browser/browser_thread.h" | 11 #include "chrome/browser/browser_thread.h" |
12 #include "chrome/browser/profiles/profile.h" | 12 #include "chrome/browser/profiles/profile.h" |
13 #include "net/base/net_errors.h" | 13 #include "net/base/net_errors.h" |
14 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCString.h" | 14 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCString.h" |
15 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityOrigin.h" | 15 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityOrigin.h" |
16 #include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h" | 16 #include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h" |
17 | 17 |
| 18 BrowsingDataDatabaseHelper::DatabaseInfo::DatabaseInfo() {} |
| 19 |
| 20 BrowsingDataDatabaseHelper::DatabaseInfo::DatabaseInfo( |
| 21 const std::string& host, |
| 22 const std::string& database_name, |
| 23 const std::string& origin_identifier, |
| 24 const std::string& description, |
| 25 const std::string& origin, |
| 26 int64 size, |
| 27 base::Time last_modified) |
| 28 : host(host), |
| 29 database_name(database_name), |
| 30 origin_identifier(origin_identifier), |
| 31 description(description), |
| 32 origin(origin), |
| 33 size(size), |
| 34 last_modified(last_modified) { |
| 35 } |
| 36 |
| 37 BrowsingDataDatabaseHelper::DatabaseInfo::~DatabaseInfo() {} |
| 38 |
| 39 bool BrowsingDataDatabaseHelper::DatabaseInfo::IsFileSchemeData() { |
| 40 return StartsWithASCII(origin_identifier, |
| 41 std::string(chrome::kFileScheme), |
| 42 true); |
| 43 } |
| 44 |
18 BrowsingDataDatabaseHelper::BrowsingDataDatabaseHelper(Profile* profile) | 45 BrowsingDataDatabaseHelper::BrowsingDataDatabaseHelper(Profile* profile) |
19 : tracker_(profile->GetDatabaseTracker()), | 46 : tracker_(profile->GetDatabaseTracker()), |
20 completion_callback_(NULL), | 47 completion_callback_(NULL), |
21 is_fetching_(false) { | 48 is_fetching_(false) { |
22 } | 49 } |
23 | 50 |
24 BrowsingDataDatabaseHelper::~BrowsingDataDatabaseHelper() { | 51 BrowsingDataDatabaseHelper::~BrowsingDataDatabaseHelper() { |
25 } | 52 } |
26 | 53 |
27 void BrowsingDataDatabaseHelper::StartFetching( | 54 void BrowsingDataDatabaseHelper::StartFetching( |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 | 176 |
150 bool CannedBrowsingDataDatabaseHelper::empty() const { | 177 bool CannedBrowsingDataDatabaseHelper::empty() const { |
151 return database_info_.empty(); | 178 return database_info_.empty(); |
152 } | 179 } |
153 | 180 |
154 void CannedBrowsingDataDatabaseHelper::StartFetching( | 181 void CannedBrowsingDataDatabaseHelper::StartFetching( |
155 Callback1<const std::vector<DatabaseInfo>& >::Type* callback) { | 182 Callback1<const std::vector<DatabaseInfo>& >::Type* callback) { |
156 callback->Run(database_info_); | 183 callback->Run(database_info_); |
157 delete callback; | 184 delete callback; |
158 } | 185 } |
OLD | NEW |