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

Side by Side Diff: chrome/browser/browsing_data_remover.cc

Issue 10522002: `chrome.browsingData` extension API can now remove data from protected origins. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Tiny docs tweak. Created 8 years, 6 months 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <map> 7 #include <map>
8 #include <set> 8 #include <set>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 using content::BrowserContext; 67 using content::BrowserContext;
68 using content::BrowserThread; 68 using content::BrowserThread;
69 using content::DOMStorageContext; 69 using content::DOMStorageContext;
70 using content::DownloadManager; 70 using content::DownloadManager;
71 using content::UserMetricsAction; 71 using content::UserMetricsAction;
72 72
73 bool BrowsingDataRemover::removing_ = false; 73 bool BrowsingDataRemover::removing_ = false;
74 74
75 BrowsingDataRemover::NotificationDetails::NotificationDetails() 75 BrowsingDataRemover::NotificationDetails::NotificationDetails()
76 : removal_begin(base::Time()), 76 : removal_begin(base::Time()),
77 removal_mask(-1) { 77 removal_mask(-1),
78 origin_set_mask(-1) {
78 } 79 }
79 80
80 BrowsingDataRemover::NotificationDetails::NotificationDetails( 81 BrowsingDataRemover::NotificationDetails::NotificationDetails(
81 const BrowsingDataRemover::NotificationDetails& details) 82 const BrowsingDataRemover::NotificationDetails& details)
82 : removal_begin(details.removal_begin), 83 : removal_begin(details.removal_begin),
83 removal_mask(details.removal_mask) { 84 removal_mask(details.removal_mask),
85 origin_set_mask(details.origin_set_mask) {
84 } 86 }
85 87
86 BrowsingDataRemover::NotificationDetails::NotificationDetails( 88 BrowsingDataRemover::NotificationDetails::NotificationDetails(
87 base::Time removal_begin, 89 base::Time removal_begin,
88 int removal_mask) 90 int removal_mask,
91 int origin_set_mask)
89 : removal_begin(removal_begin), 92 : removal_begin(removal_begin),
90 removal_mask(removal_mask) { 93 removal_mask(removal_mask),
94 origin_set_mask(origin_set_mask) {
91 } 95 }
92 96
93 BrowsingDataRemover::NotificationDetails::~NotificationDetails() {} 97 BrowsingDataRemover::NotificationDetails::~NotificationDetails() {}
94 98
95 // TODO(mkwst): We should have one constructor, not two. http://crbug.com/130732 99 // TODO(mkwst): We should have one constructor, not two. http://crbug.com/130732
96 BrowsingDataRemover::BrowsingDataRemover(Profile* profile, 100 BrowsingDataRemover::BrowsingDataRemover(Profile* profile,
97 base::Time delete_begin, 101 base::Time delete_begin,
98 base::Time delete_end) 102 base::Time delete_end)
99 : profile_(profile), 103 : profile_(profile),
100 quota_manager_(NULL), 104 quota_manager_(NULL),
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after
478 } 482 }
479 483
480 void BrowsingDataRemover::NotifyAndDeleteIfDone() { 484 void BrowsingDataRemover::NotifyAndDeleteIfDone() {
481 // TODO(brettw) bug 1139736: see TODO in Observe() above. 485 // TODO(brettw) bug 1139736: see TODO in Observe() above.
482 if (!all_done()) 486 if (!all_done())
483 return; 487 return;
484 488
485 set_removing(false); 489 set_removing(false);
486 490
487 // Send global notification, then notify any explicit observers. 491 // Send global notification, then notify any explicit observers.
488 BrowsingDataRemover::NotificationDetails details(delete_begin_, remove_mask_); 492 BrowsingDataRemover::NotificationDetails details(delete_begin_, remove_mask_,
493 origin_set_mask_);
489 content::NotificationService::current()->Notify( 494 content::NotificationService::current()->Notify(
490 chrome::NOTIFICATION_BROWSING_DATA_REMOVED, 495 chrome::NOTIFICATION_BROWSING_DATA_REMOVED,
491 content::Source<Profile>(profile_), 496 content::Source<Profile>(profile_),
492 content::Details<BrowsingDataRemover::NotificationDetails>(&details)); 497 content::Details<BrowsingDataRemover::NotificationDetails>(&details));
493 498
494 FOR_EACH_OBSERVER(Observer, observer_list_, OnBrowsingDataRemoverDone()); 499 FOR_EACH_OBSERVER(Observer, observer_list_, OnBrowsingDataRemoverDone());
495 500
496 // History requests aren't happy if you delete yourself from the callback. 501 // History requests aren't happy if you delete yourself from the callback.
497 // As such, we do a delete later. 502 // As such, we do a delete later.
498 MessageLoop::current()->DeleteSoon(FROM_HERE, this); 503 MessageLoop::current()->DeleteSoon(FROM_HERE, this);
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
782 BrowserThread::UI, FROM_HERE, 787 BrowserThread::UI, FROM_HERE,
783 base::Bind(&BrowsingDataRemover::OnClearedServerBoundCerts, 788 base::Bind(&BrowsingDataRemover::OnClearedServerBoundCerts,
784 base::Unretained(this))); 789 base::Unretained(this)));
785 } 790 }
786 791
787 void BrowsingDataRemover::OnClearedServerBoundCerts() { 792 void BrowsingDataRemover::OnClearedServerBoundCerts() {
788 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 793 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
789 waiting_for_clear_server_bound_certs_ = false; 794 waiting_for_clear_server_bound_certs_ = false;
790 NotifyAndDeleteIfDone(); 795 NotifyAndDeleteIfDone();
791 } 796 }
OLDNEW
« 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