summaryrefslogtreecommitdiffstats
path: root/components/power
diff options
context:
space:
mode:
authordhnishi <dhnishi@chromium.org>2014-09-18 14:40:40 -0700
committerCommit bot <commit-bot@chromium.org>2014-09-18 21:41:17 +0000
commite9c6f1e14435841021cce8f2aa3c201e64576fb6 (patch)
tree2d6fe626b281abb07355e4b93642d83b252ed41f /components/power
parent7b2042ea269f22b22b9ba180518314d621f8dc44 (diff)
downloadchromium_src-e9c6f1e14435841021cce8f2aa3c201e64576fb6.zip
chromium_src-e9c6f1e14435841021cce8f2aa3c201e64576fb6.tar.gz
chromium_src-e9c6f1e14435841021cce8f2aa3c201e64576fb6.tar.bz2
Clear power consumption auditing data when you clear history.
This prevents the power consumption data from accidentally leaking visited websites after clearing browser history. Review URL: https://codereview.chromium.org/514433002 Cr-Commit-Position: refs/heads/master@{#295558}
Diffstat (limited to 'components/power')
-rw-r--r--components/power/origin_power_map.cc5
-rw-r--r--components/power/origin_power_map.h3
2 files changed, 8 insertions, 0 deletions
diff --git a/components/power/origin_power_map.cc b/components/power/origin_power_map.cc
index 4ce32e2..69d9fbd 100644
--- a/components/power/origin_power_map.cc
+++ b/components/power/origin_power_map.cc
@@ -59,4 +59,9 @@ void OriginPowerMap::OnAllOriginsUpdated() {
callback_list_.Notify();
}
+void OriginPowerMap::ClearOriginMap() {
+ origin_map_.clear();
+ total_consumed_ = 0;
+}
+
} // namespace power
diff --git a/components/power/origin_power_map.h b/components/power/origin_power_map.h
index 36caa02..3d664da 100644
--- a/components/power/origin_power_map.h
+++ b/components/power/origin_power_map.h
@@ -43,6 +43,9 @@ class OriginPowerMap : public KeyedService {
// updating for all origins this cycle.
void OnAllOriginsUpdated();
+ // Clears all URLs out of the map.
+ void ClearOriginMap();
+
private:
// OriginMap maps a URL to the amount of power consumed by the URL using the
// same units as |total_consumed_|.