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

Side by Side Diff: chrome/browser/ui/webui/settings/metrics_reporting_handler.h

Issue 2233443002: MD Settings: implement metrics reporting checkbox on desktop (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@desktop-uma
Patch Set: remove 2 using Created 4 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_UI_WEBUI_SETTINGS_METRICS_REPORTING_HANDLER_H_
6 #define CHROME_BROWSER_UI_WEBUI_SETTINGS_METRICS_REPORTING_HANDLER_H_
7
8 #if defined(GOOGLE_CHROME_BUILD) && !defined(OS_CHROMEOS)
9
10 #include <memory>
11
12 #include "base/macros.h"
13 #include "chrome/browser/ui/webui/settings/settings_page_ui_handler.h"
14 #include "components/policy/core/common/policy_service.h"
15 #include "components/prefs/pref_member.h"
16
17 namespace base {
18 class DictionaryValue;
19 }
20
21 namespace settings {
22
23 class MetricsReportingHandler : public SettingsPageUIHandler {
24 public:
25 MetricsReportingHandler();
26 ~MetricsReportingHandler() override;
27
28 // SettingsPageUIHandler:
29 void RegisterMessages() override;
30 void OnJavascriptAllowed() override;
31 void OnJavascriptDisallowed() override;
32
33 protected:
34 // Handler for "getMetricsReporting" message. No arguments. Protected for
35 // testing.
36 void HandleGetMetricsReporting(const base::ListValue* args);
37
38 private:
39 // Describes the state of metrics reporting in a base::DictionaryValue.
40 // Friends with ChromeMetricsServiceAccessor.
41 std::unique_ptr<base::DictionaryValue> CreateMetricsReportingDict();
42
43 // Handler for "setMetricsReportingEnabled" message. Passed a single,
44 // |enabled| boolean argument.
45 void HandleSetMetricsReportingEnabled(const base::ListValue* args);
46
47 // Called when the policies that affect whether metrics reporting is managed
48 // change.
49 void OnPolicyChanged(const base::Value* current_policy,
50 const base::Value* previous_policy);
51
52 // Called when the local state pref controlling metrics reporting changes.
53 void OnPrefChanged(const std::string& pref_name);
54
55 // Sends a "metrics-reporting-change" WebUI listener event to the page.
56 void SendMetricsReportingChange();
57
58 // Used to track pref changes that affect whether metrics reporting is
59 // enabled.
60 std::unique_ptr<BooleanPrefMember> pref_member_;
61
62 // Used to track policy changes that affect whether metrics reporting is
63 // enabled or managed.
64 std::unique_ptr<policy::PolicyChangeRegistrar> policy_registrar_;
65
66 DISALLOW_COPY_AND_ASSIGN(MetricsReportingHandler);
67 };
68
69 } // namespace settings
70
71 #endif // defined(GOOGLE_CHROME_BUILD) && !defined(OS_CHROMEOS)
72
73 #endif // CHROME_BROWSER_UI_WEBUI_SETTINGS_METRICS_REPORTING_HANDLER_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/settings/md_settings_ui.cc ('k') | chrome/browser/ui/webui/settings/metrics_reporting_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698