| 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_indexed_db_helper.h" | 5 #include "chrome/browser/browsing_data_indexed_db_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/compiler_specific.h" | 9 #include "base/compiler_specific.h" | 
| 10 #include "base/file_util.h" | 10 #include "base/file_util.h" | 
| 11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" | 
| 12 #include "base/message_loop.h" | 12 #include "base/message_loop.h" | 
| 13 #include "base/string_util.h" | 13 #include "base/string_util.h" | 
| 14 #include "base/utf_string_conversions.h" | 14 #include "base/utf_string_conversions.h" | 
| 15 #include "chrome/browser/profiles/profile.h" | 15 #include "chrome/browser/profiles/profile.h" | 
| 16 #include "content/browser/in_process_webkit/webkit_context.h" | 16 #include "content/browser/in_process_webkit/webkit_context.h" | 
| 17 #include "content/public/browser/browser_thread.h" | 17 #include "content/public/browser/browser_thread.h" | 
| 18 #include "webkit/database/database_util.h" | 18 #include "webkit/database/database_util.h" | 
| 19 #include "webkit/glue/webkit_glue.h" | 19 #include "webkit/glue/webkit_glue.h" | 
| 20 | 20 | 
|  | 21 using content::BrowserContext; | 
| 21 using content::BrowserThread; | 22 using content::BrowserThread; | 
| 22 using webkit_database::DatabaseUtil; | 23 using webkit_database::DatabaseUtil; | 
| 23 | 24 | 
| 24 namespace { | 25 namespace { | 
| 25 | 26 | 
| 26 class BrowsingDataIndexedDBHelperImpl : public BrowsingDataIndexedDBHelper { | 27 class BrowsingDataIndexedDBHelperImpl : public BrowsingDataIndexedDBHelper { | 
| 27  public: | 28  public: | 
| 28   explicit BrowsingDataIndexedDBHelperImpl(Profile* profile); | 29   explicit BrowsingDataIndexedDBHelperImpl(Profile* profile); | 
| 29 | 30 | 
| 30   virtual void StartFetching( | 31   virtual void StartFetching( | 
| (...skipping 24 matching lines...) Expand all  Loading... | 
| 55   // it's true when StartFetching() is called in the UI thread, and it's reset | 56   // it's true when StartFetching() is called in the UI thread, and it's reset | 
| 56   // after we notified the callback in the UI thread. | 57   // after we notified the callback in the UI thread. | 
| 57   // This only mutates on the UI thread. | 58   // This only mutates on the UI thread. | 
| 58   bool is_fetching_; | 59   bool is_fetching_; | 
| 59 | 60 | 
| 60   DISALLOW_COPY_AND_ASSIGN(BrowsingDataIndexedDBHelperImpl); | 61   DISALLOW_COPY_AND_ASSIGN(BrowsingDataIndexedDBHelperImpl); | 
| 61 }; | 62 }; | 
| 62 | 63 | 
| 63 BrowsingDataIndexedDBHelperImpl::BrowsingDataIndexedDBHelperImpl( | 64 BrowsingDataIndexedDBHelperImpl::BrowsingDataIndexedDBHelperImpl( | 
| 64     Profile* profile) | 65     Profile* profile) | 
| 65     : indexed_db_context_(profile->GetWebKitContext()->indexed_db_context()), | 66     : indexed_db_context_( | 
|  | 67           BrowserContext::GetWebKitContext(profile)->indexed_db_context()), | 
| 66       is_fetching_(false) { | 68       is_fetching_(false) { | 
| 67   DCHECK(indexed_db_context_.get()); | 69   DCHECK(indexed_db_context_.get()); | 
| 68 } | 70 } | 
| 69 | 71 | 
| 70 BrowsingDataIndexedDBHelperImpl::~BrowsingDataIndexedDBHelperImpl() { | 72 BrowsingDataIndexedDBHelperImpl::~BrowsingDataIndexedDBHelperImpl() { | 
| 71 } | 73 } | 
| 72 | 74 | 
| 73 void BrowsingDataIndexedDBHelperImpl::StartFetching( | 75 void BrowsingDataIndexedDBHelperImpl::StartFetching( | 
| 74     const base::Callback<void(const std::list<IndexedDBInfo>&)>& callback) { | 76     const base::Callback<void(const std::list<IndexedDBInfo>&)>& callback) { | 
| 75   DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 77   DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 260     completion_callback_.Run(indexed_db_info_); | 262     completion_callback_.Run(indexed_db_info_); | 
| 261     completion_callback_.Reset(); | 263     completion_callback_.Reset(); | 
| 262   } | 264   } | 
| 263   is_fetching_ = false; | 265   is_fetching_ = false; | 
| 264 } | 266 } | 
| 265 | 267 | 
| 266 void CannedBrowsingDataIndexedDBHelper::CancelNotification() { | 268 void CannedBrowsingDataIndexedDBHelper::CancelNotification() { | 
| 267   DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 269   DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 
| 268   completion_callback_.Reset(); | 270   completion_callback_.Reset(); | 
| 269 } | 271 } | 
| OLD | NEW | 
|---|