OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/chromeos/set_time_ui.h" | 5 #include "chrome/browser/ui/webui/chromeos/set_time_ui.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 } | 58 } |
59 | 59 |
60 private: | 60 private: |
61 // system::SystemClockClient::Observer: | 61 // system::SystemClockClient::Observer: |
62 void SystemClockUpdated() override { | 62 void SystemClockUpdated() override { |
63 web_ui()->CallJavascriptFunctionUnsafe("settime.TimeSetter.updateTime"); | 63 web_ui()->CallJavascriptFunctionUnsafe("settime.TimeSetter.updateTime"); |
64 } | 64 } |
65 | 65 |
66 // system::TimezoneSettings::Observer: | 66 // system::TimezoneSettings::Observer: |
67 void TimezoneChanged(const icu::TimeZone& timezone) override { | 67 void TimezoneChanged(const icu::TimeZone& timezone) override { |
68 base::StringValue timezone_id( | 68 base::Value timezone_id(system::TimezoneSettings::GetTimezoneID(timezone)); |
69 system::TimezoneSettings::GetTimezoneID(timezone)); | |
70 web_ui()->CallJavascriptFunctionUnsafe("settime.TimeSetter.setTimezone", | 69 web_ui()->CallJavascriptFunctionUnsafe("settime.TimeSetter.setTimezone", |
71 timezone_id); | 70 timezone_id); |
72 } | 71 } |
73 | 72 |
74 // Handler for Javascript call to set the system clock when the user sets a | 73 // Handler for Javascript call to set the system clock when the user sets a |
75 // new time. Expects the time as the number of seconds since the Unix | 74 // new time. Expects the time as the number of seconds since the Unix |
76 // epoch, treated as a double. | 75 // epoch, treated as a double. |
77 void OnSetTime(const base::ListValue* args) { | 76 void OnSetTime(const base::ListValue* args) { |
78 double seconds; | 77 double seconds; |
79 if (!args->GetDouble(0, &seconds)) { | 78 if (!args->GetDouble(0, &seconds)) { |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 source->AddResourcePath("set_time.js", IDR_SET_TIME_JS); | 135 source->AddResourcePath("set_time.js", IDR_SET_TIME_JS); |
137 source->SetDefaultResource(IDR_SET_TIME_HTML); | 136 source->SetDefaultResource(IDR_SET_TIME_HTML); |
138 | 137 |
139 content::WebUIDataSource::Add(Profile::FromWebUI(web_ui), source); | 138 content::WebUIDataSource::Add(Profile::FromWebUI(web_ui), source); |
140 } | 139 } |
141 | 140 |
142 SetTimeUI::~SetTimeUI() { | 141 SetTimeUI::~SetTimeUI() { |
143 } | 142 } |
144 | 143 |
145 } // namespace chromeos | 144 } // namespace chromeos |
OLD | NEW |