| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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_remover.h" | 5 #include "chrome/browser/browsing_data_remover.h" |
| 6 | 6 |
| 7 #include "chrome/browser/chrome_thread.h" | 7 #include "chrome/browser/chrome_thread.h" |
| 8 #include "chrome/browser/browser_process.h" | 8 #include "chrome/browser/browser_process.h" |
| 9 #include "chrome/browser/download/download_manager.h" | 9 #include "chrome/browser/download/download_manager.h" |
| 10 #include "chrome/browser/history/history.h" | 10 #include "chrome/browser/history/history.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 // BrowsingDataRemover implement RefCounted. | 27 // BrowsingDataRemover implement RefCounted. |
| 28 template<> | 28 template<> |
| 29 void RunnableMethodTraits<BrowsingDataRemover>::RetainCallee( | 29 void RunnableMethodTraits<BrowsingDataRemover>::RetainCallee( |
| 30 BrowsingDataRemover* remover) { | 30 BrowsingDataRemover* remover) { |
| 31 } | 31 } |
| 32 template<> | 32 template<> |
| 33 void RunnableMethodTraits<BrowsingDataRemover>::ReleaseCallee( | 33 void RunnableMethodTraits<BrowsingDataRemover>::ReleaseCallee( |
| 34 BrowsingDataRemover* remover) { | 34 BrowsingDataRemover* remover) { |
| 35 } | 35 } |
| 36 | 36 |
| 37 bool BrowsingDataRemover::removing_ = false; |
| 38 |
| 37 BrowsingDataRemover::BrowsingDataRemover(Profile* profile, Time delete_begin, | 39 BrowsingDataRemover::BrowsingDataRemover(Profile* profile, Time delete_begin, |
| 38 Time delete_end) | 40 Time delete_end) |
| 39 : profile_(profile), | 41 : profile_(profile), |
| 40 delete_begin_(delete_begin), | 42 delete_begin_(delete_begin), |
| 41 delete_end_(delete_end), | 43 delete_end_(delete_end), |
| 42 removing_(false), | |
| 43 waiting_for_keywords_(false), | 44 waiting_for_keywords_(false), |
| 44 waiting_for_clear_history_(false), | 45 waiting_for_clear_history_(false), |
| 45 waiting_for_clear_cache_(false) { | 46 waiting_for_clear_cache_(false) { |
| 46 DCHECK(profile); | 47 DCHECK(profile); |
| 47 } | 48 } |
| 48 | 49 |
| 49 BrowsingDataRemover::~BrowsingDataRemover() { | 50 BrowsingDataRemover::~BrowsingDataRemover() { |
| 50 DCHECK(all_done()); | 51 DCHECK(all_done()); |
| 51 } | 52 } |
| 52 | 53 |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 | 174 |
| 174 NotifyAndDeleteIfDone(); | 175 NotifyAndDeleteIfDone(); |
| 175 } | 176 } |
| 176 } | 177 } |
| 177 | 178 |
| 178 void BrowsingDataRemover::NotifyAndDeleteIfDone() { | 179 void BrowsingDataRemover::NotifyAndDeleteIfDone() { |
| 179 // TODO(brettw) bug 1139736: see TODO in Observe() above. | 180 // TODO(brettw) bug 1139736: see TODO in Observe() above. |
| 180 if (!all_done()) | 181 if (!all_done()) |
| 181 return; | 182 return; |
| 182 | 183 |
| 184 removing_ = false; |
| 183 FOR_EACH_OBSERVER(Observer, observer_list_, OnBrowsingDataRemoverDone()); | 185 FOR_EACH_OBSERVER(Observer, observer_list_, OnBrowsingDataRemoverDone()); |
| 184 | 186 |
| 185 // History requests aren't happy if you delete yourself from the callback. | 187 // History requests aren't happy if you delete yourself from the callback. |
| 186 // As such, we do a delete later. | 188 // As such, we do a delete later. |
| 187 MessageLoop::current()->DeleteSoon(FROM_HERE, this); | 189 MessageLoop::current()->DeleteSoon(FROM_HERE, this); |
| 188 } | 190 } |
| 189 | 191 |
| 190 void BrowsingDataRemover::ClearedCache() { | 192 void BrowsingDataRemover::ClearedCache() { |
| 191 waiting_for_clear_cache_ = false; | 193 waiting_for_clear_cache_ = false; |
| 192 | 194 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 211 if (delete_begin.is_null()) | 213 if (delete_begin.is_null()) |
| 212 cache->DoomAllEntries(); | 214 cache->DoomAllEntries(); |
| 213 else | 215 else |
| 214 cache->DoomEntriesBetween(delete_begin, delete_end); | 216 cache->DoomEntriesBetween(delete_begin, delete_end); |
| 215 } | 217 } |
| 216 | 218 |
| 217 // Notify the UI thread that we are done. | 219 // Notify the UI thread that we are done. |
| 218 ui_loop->PostTask(FROM_HERE, NewRunnableMethod( | 220 ui_loop->PostTask(FROM_HERE, NewRunnableMethod( |
| 219 this, &BrowsingDataRemover::ClearedCache)); | 221 this, &BrowsingDataRemover::ClearedCache)); |
| 220 } | 222 } |
| OLD | NEW |