| OLD | NEW |
| 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 #include "chrome/browser/ui/webui/settings/chromeos/date_time_handler.h" | 5 #include "chrome/browser/ui/webui/settings/chromeos/date_time_handler.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "chrome/browser/browser_process.h" | 8 #include "chrome/browser/browser_process.h" |
| 9 #include "chrome/browser/chromeos/policy/proto/chrome_device_policy.pb.h" | 9 #include "chrome/browser/chromeos/policy/proto/chrome_device_policy.pb.h" |
| 10 #include "chrome/browser/chromeos/system/timezone_util.h" | 10 #include "chrome/browser/chromeos/system/timezone_util.h" |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 DateTimeHandler* DateTimeHandler::Create( | 49 DateTimeHandler* DateTimeHandler::Create( |
| 50 content::WebUIDataSource* html_source) { | 50 content::WebUIDataSource* html_source) { |
| 51 html_source->AddBoolean("systemTimeZoneManaged", | 51 html_source->AddBoolean("systemTimeZoneManaged", |
| 52 chromeos::system::HasSystemTimezonePolicy()); | 52 chromeos::system::HasSystemTimezonePolicy()); |
| 53 | 53 |
| 54 bool system_time_zone_automatic_detection_managed = | 54 bool system_time_zone_automatic_detection_managed = |
| 55 IsSystemTimezoneAutomaticDetectionManaged(); | 55 IsSystemTimezoneAutomaticDetectionManaged(); |
| 56 html_source->AddBoolean("systemTimeZoneDetectionManaged", | 56 html_source->AddBoolean("systemTimeZoneDetectionManaged", |
| 57 system_time_zone_automatic_detection_managed); | 57 system_time_zone_automatic_detection_managed); |
| 58 if (system_time_zone_automatic_detection_managed) { | 58 if (system_time_zone_automatic_detection_managed) { |
| 59 base::DictionaryValue dict; | 59 html_source->AddInteger("systemTimeZoneDetectionPolicyValue", |
| 60 dict.SetInteger("systemTimeZoneDetectionPolicyValue", | |
| 61 GetSystemTimezoneAutomaticDetectionPolicyValue()); | 60 GetSystemTimezoneAutomaticDetectionPolicyValue()); |
| 62 html_source->AddLocalizedStrings(dict); | |
| 63 } | 61 } |
| 64 | 62 |
| 65 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 63 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 66 chromeos::switches::kDisableTimeZoneTrackingOption)) { | 64 chromeos::switches::kDisableTimeZoneTrackingOption)) { |
| 67 html_source->AddBoolean("hideTimeZoneDetection", true); | 65 html_source->AddBoolean("hideTimeZoneDetection", true); |
| 68 } | 66 } |
| 69 | 67 |
| 70 return new DateTimeHandler; | 68 return new DateTimeHandler; |
| 71 } | 69 } |
| 72 | 70 |
| 73 void DateTimeHandler::RegisterMessages() { | 71 void DateTimeHandler::RegisterMessages() { |
| 74 // TODO(michaelpg): Add time zone message handlers. | 72 // TODO(michaelpg): Add time zone message handlers. |
| 75 } | 73 } |
| 76 | 74 |
| 77 void DateTimeHandler::OnJavascriptAllowed() { | 75 void DateTimeHandler::OnJavascriptAllowed() { |
| 78 // TODO(michaelpg): Add policy observers. | 76 // TODO(michaelpg): Add policy observers. |
| 79 } | 77 } |
| 80 | 78 |
| 81 void DateTimeHandler::OnJavascriptDisallowed() { | 79 void DateTimeHandler::OnJavascriptDisallowed() { |
| 82 // TODO(michaelpg): Remove policy observers. | 80 // TODO(michaelpg): Remove policy observers. |
| 83 } | 81 } |
| 84 | 82 |
| 85 } // namespace settings | 83 } // namespace settings |
| 86 } // namespace chromeos | 84 } // namespace chromeos |
| OLD | NEW |