Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Unified Diff: chrome/browser/browsing_data_remover.cc

Issue 8907015: Adding chrome::NOTIFICATION_BROWSING_DATA_REMOVED. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Jochen's comments. Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/browsing_data_remover.h ('k') | chrome/browser/browsing_data_remover_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/browsing_data_remover.cc
diff --git a/chrome/browser/browsing_data_remover.cc b/chrome/browser/browsing_data_remover.cc
index 8a2a8d069eb03097f7d9616e1a2e31d77b12e97f..84c7c04ed4c4d096b1ac17c39718dfa18352856c 100644
--- a/chrome/browser/browsing_data_remover.cc
+++ b/chrome/browser/browsing_data_remover.cc
@@ -45,7 +45,7 @@
#include "content/browser/in_process_webkit/webkit_context.h"
#include "content/browser/user_metrics.h"
#include "content/public/browser/browser_thread.h"
-#include "content/public/browser/notification_source.h"
+#include "content/public/browser/notification_service.h"
#include "content/public/browser/plugin_data_remover.h"
#include "net/base/cookie_monster.h"
#include "net/base/net_errors.h"
@@ -65,6 +65,26 @@ DISABLE_RUNNABLE_METHOD_REFCOUNT(BrowsingDataRemover);
bool BrowsingDataRemover::removing_ = false;
+BrowsingDataRemover::NotificationDetails::NotificationDetails()
+ : removal_begin(base::Time()),
+ removal_mask(-1) {
+}
+
+BrowsingDataRemover::NotificationDetails::NotificationDetails(
+ const BrowsingDataRemover::NotificationDetails& details)
+ : removal_begin(details.removal_begin),
+ removal_mask(details.removal_mask) {
+}
+
+BrowsingDataRemover::NotificationDetails::NotificationDetails(
+ base::Time removal_begin,
+ int removal_mask)
+ : removal_begin(removal_begin),
+ removal_mask(removal_mask) {
+}
+
+BrowsingDataRemover::NotificationDetails::~NotificationDetails() {}
+
BrowsingDataRemover::BrowsingDataRemover(Profile* profile,
base::Time delete_begin,
base::Time delete_end)
@@ -84,7 +104,8 @@ BrowsingDataRemover::BrowsingDataRemover(Profile* profile,
waiting_for_clear_networking_history_(false),
waiting_for_clear_cookies_(false),
waiting_for_clear_cache_(false),
- waiting_for_clear_lso_data_(false) {
+ waiting_for_clear_lso_data_(false),
+ remove_mask_(0) {
DCHECK(profile);
}
@@ -107,7 +128,8 @@ BrowsingDataRemover::BrowsingDataRemover(Profile* profile,
waiting_for_clear_networking_history_(false),
waiting_for_clear_cookies_(false),
waiting_for_clear_cache_(false),
- waiting_for_clear_lso_data_(false) {
+ waiting_for_clear_lso_data_(false),
+ remove_mask_(0) {
DCHECK(profile);
}
@@ -124,6 +146,7 @@ void BrowsingDataRemover::set_removing(bool removing) {
void BrowsingDataRemover::Remove(int remove_mask) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
set_removing(true);
+ remove_mask_ = remove_mask;
if (remove_mask & REMOVE_HISTORY) {
HistoryService* history_service =
@@ -350,7 +373,7 @@ void BrowsingDataRemover::Observe(int type,
// them to complete before continuing.
DCHECK(type == chrome::NOTIFICATION_TEMPLATE_URL_SERVICE_LOADED);
TemplateURLService* model = content::Source<TemplateURLService>(source).ptr();
- if (model->profile() == profile_->GetOriginalProfile()) {
+ if (model->profile() == profile_) {
registrar_.RemoveAll();
model->RemoveAutoGeneratedBetween(delete_begin_, delete_end_);
NotifyAndDeleteIfDone();
@@ -370,6 +393,14 @@ void BrowsingDataRemover::NotifyAndDeleteIfDone() {
g_browser_process->net_log()->ClearAllPassivelyCapturedEvents();
set_removing(false);
+
+ // Send global notification, then notify any explicit observers.
+ BrowsingDataRemover::NotificationDetails details(delete_begin_, remove_mask_);
+ content::NotificationService::current()->Notify(
+ chrome::NOTIFICATION_BROWSING_DATA_REMOVED,
+ content::Source<Profile>(profile_),
+ content::Details<BrowsingDataRemover::NotificationDetails>(&details));
+
FOR_EACH_OBSERVER(Observer, observer_list_, OnBrowsingDataRemoverDone());
// History requests aren't happy if you delete yourself from the callback.
« no previous file with comments | « chrome/browser/browsing_data_remover.h ('k') | chrome/browser/browsing_data_remover_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698