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

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

Issue 2438443005: MD Settings: Date and Time page, part 2/3 (Closed)
Patch Set: rebase Created 4 years, 1 month 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
1 // Copyright 2016 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_UI_WEBUI_SETTINGS_CHROMEOS_DATE_TIME_HANDLER_H_ 5 #ifndef CHROME_BROWSER_UI_WEBUI_SETTINGS_CHROMEOS_DATE_TIME_HANDLER_H_
6 #define CHROME_BROWSER_UI_WEBUI_SETTINGS_CHROMEOS_DATE_TIME_HANDLER_H_ 6 #define CHROME_BROWSER_UI_WEBUI_SETTINGS_CHROMEOS_DATE_TIME_HANDLER_H_
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/memory/weak_ptr.h"
10 #include "chrome/browser/chromeos/settings/cros_settings.h"
9 #include "chrome/browser/ui/webui/settings/settings_page_ui_handler.h" 11 #include "chrome/browser/ui/webui/settings/settings_page_ui_handler.h"
12 #include "components/prefs/pref_change_registrar.h"
13
14 namespace base {
15 class ListValue;
16 }
10 17
11 namespace content { 18 namespace content {
12 class WebUIDataSource; 19 class WebUIDataSource;
13 } 20 }
14 21
15 namespace chromeos { 22 namespace chromeos {
16 namespace settings { 23 namespace settings {
17 24
18 // Chrome OS date and time settings page UI handler. 25 // Chrome OS date and time settings page UI handler.
19 class DateTimeHandler : public ::settings::SettingsPageUIHandler { 26 class DateTimeHandler : public ::settings::SettingsPageUIHandler {
20 public: 27 public:
21 ~DateTimeHandler() override; 28 ~DateTimeHandler() override;
22 29
23 // Adds load-time values to html_source before creating the handler. 30 // Adds load-time values to html_source before creating the handler.
24 static DateTimeHandler* Create(content::WebUIDataSource* html_source); 31 static DateTimeHandler* Create(content::WebUIDataSource* html_source);
25 32
26 // SettingsPageUIHandler implementation. 33 // SettingsPageUIHandler implementation.
27 void RegisterMessages() override; 34 void RegisterMessages() override;
28 void OnJavascriptAllowed() override; 35 void OnJavascriptAllowed() override;
29 void OnJavascriptDisallowed() override; 36 void OnJavascriptDisallowed() override;
30 37
31 private: 38 private:
32 DateTimeHandler(); 39 DateTimeHandler();
33 40
41 // Called when the page is ready.
42 void HandleDateTimePageReady(const base::ListValue* args);
43
44 // Handler to fetch the list of time zones.
45 void HandleGetTimeZones(const base::ListValue* args);
46
47 // Updates the UI, enabling or disabling the time zone automatic detection
48 // setting according to policy.
49 void NotifyTimezoneAutomaticDetectionPolicy();
50
51 std::unique_ptr<chromeos::CrosSettings::ObserverSubscription>
52 system_timezone_policy_subscription_;
53
54 // Used to listen to changes to the system time zone detection policy.
55 PrefChangeRegistrar local_state_pref_change_registrar_;
56
57 base::WeakPtrFactory<DateTimeHandler> weak_ptr_factory_;
58
34 DISALLOW_COPY_AND_ASSIGN(DateTimeHandler); 59 DISALLOW_COPY_AND_ASSIGN(DateTimeHandler);
35 }; 60 };
36 61
37 } // namespace settings 62 } // namespace settings
38 } // namespace chromeos 63 } // namespace chromeos
39 64
40 #endif // CHROME_BROWSER_UI_WEBUI_SETTINGS_CHROMEOS_DATE_TIME_HANDLER_H_ 65 #endif // CHROME_BROWSER_UI_WEBUI_SETTINGS_CHROMEOS_DATE_TIME_HANDLER_H_
OLDNEW
« no previous file with comments | « chrome/browser/resources/settings/md_select_css.html ('k') | chrome/browser/ui/webui/settings/chromeos/date_time_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698