Commit ed74c1dd authored by Christian Dullweber's avatar Christian Dullweber Committed by Commit Bot

Track sync changes and update cookie notice

Dynamically update the cookie notice on the advanced tab when sync state
changes.

Bug: 894848
Change-Id: I62d507d41a1bd91d37738f2d68d00427bd2bb386
Reviewed-on: https://chromium-review.googlesource.com/c/1293451Reviewed-by: default avatarMartin Šrámek <msramek@chromium.org>
Commit-Queue: Christian Dullweber <dullweber@chromium.org>
Cr-Commit-Position: refs/heads/master@{#602306}
parent e12fcfe0
......@@ -4,17 +4,33 @@
#include "chrome/browser/browsing_data/counters/site_data_counter.h"
#include "chrome/browser/browsing_data/counters/browsing_data_counter_utils.h"
#include "chrome/browser/browsing_data/counters/site_data_counting_helper.h"
#include "chrome/browser/sync/profile_sync_service_factory.h"
#include "components/browser_sync/profile_sync_service.h"
#include "components/browsing_data/core/pref_names.h"
#include "content/public/browser/browser_thread.h"
using content::BrowserThread;
namespace {
bool CheckSyncState(Profile* profile, const syncer::SyncService* sync_service) {
return ShouldShowCookieException(profile);
}
} // namespace
SiteDataCounter::SiteDataCounter(Profile* profile)
: profile_(profile), weak_ptr_factory_(this) {}
: profile_(profile),
sync_tracker_(this, ProfileSyncServiceFactory::GetForProfile(profile)),
weak_ptr_factory_(this) {}
SiteDataCounter::~SiteDataCounter() {}
void SiteDataCounter::OnInitialized() {
sync_tracker_.OnInitialized(
base::BindRepeating(&CheckSyncState, base::Unretained(profile_)));
}
const char* SiteDataCounter::GetPrefName() const {
return browsing_data::prefs::kDeleteCookies;
}
......
......@@ -7,6 +7,7 @@
#include "base/memory/weak_ptr.h"
#include "components/browsing_data/core/counters/browsing_data_counter.h"
#include "components/browsing_data/core/counters/sync_tracker.h"
class Profile;
......@@ -18,10 +19,12 @@ class SiteDataCounter : public browsing_data::BrowsingDataCounter {
const char* GetPrefName() const override;
private:
void OnInitialized() override;
void Count() override;
void Done(int origin_count);
Profile* profile_;
browsing_data::SyncTracker sync_tracker_;
base::WeakPtrFactory<SiteDataCounter> weak_ptr_factory_;
};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment