| OLD | NEW | 
|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/bind.h" | 7 #include "base/bind.h" | 
| 8 #include "base/callback.h" | 8 #include "base/callback.h" | 
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" | 
| 10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" | 
| 11 #include "base/utf_string_conversions.h" | 11 #include "base/utf_string_conversions.h" | 
| 12 #include "chrome/browser/profiles/profile.h" | 12 #include "chrome/browser/profiles/profile.h" | 
| 13 #include "content/public/browser/browser_thread.h" | 13 #include "content/public/browser/browser_thread.h" | 
| 14 #include "net/base/completion_callback.h" | 14 #include "net/base/completion_callback.h" | 
| 15 #include "net/base/net_errors.h" | 15 #include "net/base/net_errors.h" | 
| 16 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebCString.h
     " | 16 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebCString.h
     " | 
| 17 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityOrigin.h" | 17 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityOrigin.h" | 
| 18 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" | 18 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" | 
| 19 | 19 | 
|  | 20 using content::BrowserContext; | 
| 20 using content::BrowserThread; | 21 using content::BrowserThread; | 
| 21 using WebKit::WebSecurityOrigin; | 22 using WebKit::WebSecurityOrigin; | 
| 22 | 23 | 
| 23 BrowsingDataDatabaseHelper::DatabaseInfo::DatabaseInfo() | 24 BrowsingDataDatabaseHelper::DatabaseInfo::DatabaseInfo() | 
| 24     : size(0) { | 25     : size(0) { | 
| 25 } | 26 } | 
| 26 | 27 | 
| 27 BrowsingDataDatabaseHelper::DatabaseInfo::DatabaseInfo( | 28 BrowsingDataDatabaseHelper::DatabaseInfo::DatabaseInfo( | 
| 28     const std::string& host, | 29     const std::string& host, | 
| 29     const std::string& database_name, | 30     const std::string& database_name, | 
| (...skipping 14 matching lines...) Expand all  Loading... | 
| 44 BrowsingDataDatabaseHelper::DatabaseInfo::~DatabaseInfo() {} | 45 BrowsingDataDatabaseHelper::DatabaseInfo::~DatabaseInfo() {} | 
| 45 | 46 | 
| 46 bool BrowsingDataDatabaseHelper::DatabaseInfo::IsFileSchemeData() { | 47 bool BrowsingDataDatabaseHelper::DatabaseInfo::IsFileSchemeData() { | 
| 47   return StartsWithASCII(origin_identifier, | 48   return StartsWithASCII(origin_identifier, | 
| 48                          std::string(chrome::kFileScheme), | 49                          std::string(chrome::kFileScheme), | 
| 49                          true); | 50                          true); | 
| 50 } | 51 } | 
| 51 | 52 | 
| 52 BrowsingDataDatabaseHelper::BrowsingDataDatabaseHelper(Profile* profile) | 53 BrowsingDataDatabaseHelper::BrowsingDataDatabaseHelper(Profile* profile) | 
| 53     : is_fetching_(false), | 54     : is_fetching_(false), | 
| 54       tracker_(profile->GetDatabaseTracker()) { | 55       tracker_(BrowserContext::GetDatabaseTracker(profile)) { | 
| 55 } | 56 } | 
| 56 | 57 | 
| 57 BrowsingDataDatabaseHelper::~BrowsingDataDatabaseHelper() { | 58 BrowsingDataDatabaseHelper::~BrowsingDataDatabaseHelper() { | 
| 58 } | 59 } | 
| 59 | 60 | 
| 60 void BrowsingDataDatabaseHelper::StartFetching( | 61 void BrowsingDataDatabaseHelper::StartFetching( | 
| 61     const base::Callback<void(const std::list<DatabaseInfo>&)>& callback) { | 62     const base::Callback<void(const std::list<DatabaseInfo>&)>& callback) { | 
| 62   DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 63   DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 
| 63   DCHECK(!is_fetching_); | 64   DCHECK(!is_fetching_); | 
| 64   DCHECK_EQ(false, callback.is_null()); | 65   DCHECK_EQ(false, callback.is_null()); | 
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 247         web_security_origin.toString().utf8(), | 248         web_security_origin.toString().utf8(), | 
| 248         0, | 249         0, | 
| 249         base::Time())); | 250         base::Time())); | 
| 250   } | 251   } | 
| 251   pending_database_info_.clear(); | 252   pending_database_info_.clear(); | 
| 252 | 253 | 
| 253   BrowserThread::PostTask( | 254   BrowserThread::PostTask( | 
| 254       BrowserThread::UI, FROM_HERE, | 255       BrowserThread::UI, FROM_HERE, | 
| 255       base::Bind(&CannedBrowsingDataDatabaseHelper::NotifyInUIThread, this)); | 256       base::Bind(&CannedBrowsingDataDatabaseHelper::NotifyInUIThread, this)); | 
| 256 } | 257 } | 
| OLD | NEW | 
|---|