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

Unified Diff: chrome/browser/ui/webui/options/website_settings_handler.h

Issue 519883002: Update the Website Settings page when the power consumption is updated. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/webui/options/website_settings_handler.h
diff --git a/chrome/browser/ui/webui/options/website_settings_handler.h b/chrome/browser/ui/webui/options/website_settings_handler.h
index 2ebf495840f6529979385b174bd8e1e425c99443..717faaa72ee11ea1182f94dba6a94f3907b37399 100644
--- a/chrome/browser/ui/webui/options/website_settings_handler.h
+++ b/chrome/browser/ui/webui/options/website_settings_handler.h
@@ -15,10 +15,13 @@
#include "chrome/browser/content_settings/host_content_settings_map.h"
#include "chrome/browser/content_settings/local_shared_objects_container.h"
#include "chrome/browser/ui/webui/options/options_ui.h"
+#include "components/power/origin_power_map.h"
+#include "components/power/origin_power_map_observer.h"
namespace options {
class WebsiteSettingsHandler : public content_settings::Observer,
+ public power::OriginPowerMapObserver,
public OptionsPageUIHandler {
public:
WebsiteSettingsHandler();
@@ -44,6 +47,9 @@ class WebsiteSettingsHandler : public content_settings::Observer,
const ContentSettingsPattern& secondary_pattern,
ContentSettingsType content_type) OVERRIDE;
+ // power::OriginPowerMapObserver implementation.
+ virtual void OnPowerConsumptionUpdated() OVERRIDE;
+
private:
// Update the page with all origins for a given content setting.
// |args| is the string name of the content setting.
@@ -92,6 +98,10 @@ class WebsiteSettingsHandler : public content_settings::Observer,
// and update the page.
void UpdateLocalStorage();
+ // Get all origins with power consumption, filter them by |last_filter_|,
+ // and update the page.
+ void UpdateBatteryUsage();
+
// Kill all tabs and app windows which have the same origin as |site_url|.
void StopOrigin(const GURL& site_url);
@@ -118,6 +128,9 @@ class WebsiteSettingsHandler : public content_settings::Observer,
// Observer to watch for content settings changes.
ScopedObserver<HostContentSettingsMap, content_settings::Observer> observer_;
+ // Observer to watch for power consumption changes.
+ ScopedObserver<power::OriginPowerMap, OriginPowerMapObserver> power_observer_;
+
base::WeakPtrFactory<WebsiteSettingsHandler> weak_ptr_factory_;
DISALLOW_COPY_AND_ASSIGN(WebsiteSettingsHandler);

Powered by Google App Engine
This is Rietveld 408576698