OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/policy_ui.h" | 5 #include "chrome/browser/ui/webui/policy_ui.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 base::Time last_refresh_time = refresh_scheduler ? | 181 base::Time last_refresh_time = refresh_scheduler ? |
182 refresh_scheduler->last_refresh() : base::Time(); | 182 refresh_scheduler->last_refresh() : base::Time(); |
183 | 183 |
184 bool no_error = store->status() == policy::CloudPolicyStore::STATUS_OK && | 184 bool no_error = store->status() == policy::CloudPolicyStore::STATUS_OK && |
185 client && client->status() == policy::DM_STATUS_SUCCESS; | 185 client && client->status() == policy::DM_STATUS_SUCCESS; |
186 dict->SetBoolean("error", !no_error); | 186 dict->SetBoolean("error", !no_error); |
187 dict->SetString("status", status); | 187 dict->SetString("status", status); |
188 dict->SetString("clientId", client_id); | 188 dict->SetString("clientId", client_id); |
189 dict->SetString("username", username); | 189 dict->SetString("username", username); |
190 dict->SetString("refreshInterval", | 190 dict->SetString("refreshInterval", |
191 ui::TimeFormat::TimeDurationShort(refresh_interval)); | 191 ui::TimeFormat::Simple(ui::TimeFormat::kDuration, |
| 192 ui::TimeFormat::kShort, |
| 193 refresh_interval)); |
192 dict->SetString("timeSinceLastRefresh", last_refresh_time.is_null() ? | 194 dict->SetString("timeSinceLastRefresh", last_refresh_time.is_null() ? |
193 l10n_util::GetStringUTF16(IDS_POLICY_NEVER_FETCHED) : | 195 l10n_util::GetStringUTF16(IDS_POLICY_NEVER_FETCHED) : |
194 ui::TimeFormat::TimeElapsed(base::Time::NowFromSystemTime() - | 196 ui::TimeFormat::Simple(ui::TimeFormat::kElapsed, ui::TimeFormat::kShort, |
195 last_refresh_time)); | 197 base::Time::NowFromSystemTime() - |
| 198 last_refresh_time)); |
196 } | 199 } |
197 | 200 |
198 void ExtractDomainFromUsername(base::DictionaryValue* dict) { | 201 void ExtractDomainFromUsername(base::DictionaryValue* dict) { |
199 std::string username; | 202 std::string username; |
200 dict->GetString("username", &username); | 203 dict->GetString("username", &username); |
201 if (!username.empty()) | 204 if (!username.empty()) |
202 dict->SetString("domain", gaia::ExtractDomainName(username)); | 205 dict->SetString("domain", gaia::ExtractDomainName(username)); |
203 } | 206 } |
204 | 207 |
205 // Utility function that returns a JSON serialization of the given |dict|. | 208 // Utility function that returns a JSON serialization of the given |dict|. |
(...skipping 578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
784 } | 787 } |
785 | 788 |
786 PolicyUI::PolicyUI(content::WebUI* web_ui) : WebUIController(web_ui) { | 789 PolicyUI::PolicyUI(content::WebUI* web_ui) : WebUIController(web_ui) { |
787 web_ui->AddMessageHandler(new PolicyUIHandler); | 790 web_ui->AddMessageHandler(new PolicyUIHandler); |
788 content::WebUIDataSource::Add(Profile::FromWebUI(web_ui), | 791 content::WebUIDataSource::Add(Profile::FromWebUI(web_ui), |
789 CreatePolicyUIHTMLSource()); | 792 CreatePolicyUIHTMLSource()); |
790 } | 793 } |
791 | 794 |
792 PolicyUI::~PolicyUI() { | 795 PolicyUI::~PolicyUI() { |
793 } | 796 } |
OLD | NEW |