Commit e9c6f1e1 authored by dhnishi's avatar dhnishi Committed by Commit bot

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}
parent 7b2042ea
...@@ -51,6 +51,8 @@ ...@@ -51,6 +51,8 @@
#include "components/nacl/browser/nacl_browser.h" #include "components/nacl/browser/nacl_browser.h"
#include "components/nacl/browser/pnacl_host.h" #include "components/nacl/browser/pnacl_host.h"
#include "components/password_manager/core/browser/password_store.h" #include "components/password_manager/core/browser/password_store.h"
#include "components/power/origin_power_map.h"
#include "components/power/origin_power_map_factory.h"
#include "components/search_engines/template_url_service.h" #include "components/search_engines/template_url_service.h"
#include "components/web_cache/browser/web_cache_manager.h" #include "components/web_cache/browser/web_cache_manager.h"
#include "content/public/browser/browser_thread.h" #include "content/public/browser/browser_thread.h"
...@@ -304,6 +306,12 @@ void BrowsingDataRemover::RemoveImpl(int remove_mask, ...@@ -304,6 +306,12 @@ void BrowsingDataRemover::RemoveImpl(int remove_mask,
#endif #endif
} }
// The power consumption history by origin contains details of websites
// that were visited.
power::OriginPowerMap* origin_power_map =
power::OriginPowerMapFactory::GetForBrowserContext(profile_);
origin_power_map->ClearOriginMap();
// Need to clear the host cache and accumulated speculative data, as it also // Need to clear the host cache and accumulated speculative data, as it also
// reveals some history: we have no mechanism to track when these items were // reveals some history: we have no mechanism to track when these items were
// created, so we'll clear them all. Better safe than sorry. // created, so we'll clear them all. Better safe than sorry.
......
...@@ -59,4 +59,9 @@ void OriginPowerMap::OnAllOriginsUpdated() { ...@@ -59,4 +59,9 @@ void OriginPowerMap::OnAllOriginsUpdated() {
callback_list_.Notify(); callback_list_.Notify();
} }
void OriginPowerMap::ClearOriginMap() {
origin_map_.clear();
total_consumed_ = 0;
}
} // namespace power } // namespace power
...@@ -43,6 +43,9 @@ class OriginPowerMap : public KeyedService { ...@@ -43,6 +43,9 @@ class OriginPowerMap : public KeyedService {
// updating for all origins this cycle. // updating for all origins this cycle.
void OnAllOriginsUpdated(); void OnAllOriginsUpdated();
// Clears all URLs out of the map.
void ClearOriginMap();
private: private:
// OriginMap maps a URL to the amount of power consumed by the URL using the // OriginMap maps a URL to the amount of power consumed by the URL using the
// same units as |total_consumed_|. // same units as |total_consumed_|.
......
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