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

Side by Side Diff: chrome/browser/ui/webui/policy_ui.cc

Issue 1052943002: Added device naming information to chrome://policy (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed IOS whitelist Created 5 years, 8 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
« no previous file with comments | « chrome/browser/resources/policy.js ('k') | components/policy_strings.grdp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 source->AddLocalizedString("title", IDS_POLICY_TITLE); 83 source->AddLocalizedString("title", IDS_POLICY_TITLE);
84 source->AddLocalizedString("filterPlaceholder", 84 source->AddLocalizedString("filterPlaceholder",
85 IDS_POLICY_FILTER_PLACEHOLDER); 85 IDS_POLICY_FILTER_PLACEHOLDER);
86 source->AddLocalizedString("reloadPolicies", IDS_POLICY_RELOAD_POLICIES); 86 source->AddLocalizedString("reloadPolicies", IDS_POLICY_RELOAD_POLICIES);
87 source->AddLocalizedString("status", IDS_POLICY_STATUS); 87 source->AddLocalizedString("status", IDS_POLICY_STATUS);
88 source->AddLocalizedString("statusDevice", IDS_POLICY_STATUS_DEVICE); 88 source->AddLocalizedString("statusDevice", IDS_POLICY_STATUS_DEVICE);
89 source->AddLocalizedString("statusUser", IDS_POLICY_STATUS_USER); 89 source->AddLocalizedString("statusUser", IDS_POLICY_STATUS_USER);
90 source->AddLocalizedString("labelDomain", IDS_POLICY_LABEL_DOMAIN); 90 source->AddLocalizedString("labelDomain", IDS_POLICY_LABEL_DOMAIN);
91 source->AddLocalizedString("labelUsername", IDS_POLICY_LABEL_USERNAME); 91 source->AddLocalizedString("labelUsername", IDS_POLICY_LABEL_USERNAME);
92 source->AddLocalizedString("labelClientId", IDS_POLICY_LABEL_CLIENT_ID); 92 source->AddLocalizedString("labelClientId", IDS_POLICY_LABEL_CLIENT_ID);
93 source->AddLocalizedString("labelAssetId", IDS_POLICY_LABEL_ASSET_ID);
94 source->AddLocalizedString("labelLocation", IDS_POLICY_LABEL_LOCATION);
95 source->AddLocalizedString("labelDirectoryApiId",
96 IDS_POLICY_LABEL_DIRECTORY_API_ID);
93 source->AddLocalizedString("labelTimeSinceLastRefresh", 97 source->AddLocalizedString("labelTimeSinceLastRefresh",
94 IDS_POLICY_LABEL_TIME_SINCE_LAST_REFRESH); 98 IDS_POLICY_LABEL_TIME_SINCE_LAST_REFRESH);
95 source->AddLocalizedString("labelRefreshInterval", 99 source->AddLocalizedString("labelRefreshInterval",
96 IDS_POLICY_LABEL_REFRESH_INTERVAL); 100 IDS_POLICY_LABEL_REFRESH_INTERVAL);
97 source->AddLocalizedString("labelStatus", IDS_POLICY_LABEL_STATUS); 101 source->AddLocalizedString("labelStatus", IDS_POLICY_LABEL_STATUS);
98 source->AddLocalizedString("showUnset", IDS_POLICY_SHOW_UNSET); 102 source->AddLocalizedString("showUnset", IDS_POLICY_SHOW_UNSET);
99 source->AddLocalizedString("noPoliciesSet", IDS_POLICY_NO_POLICIES_SET); 103 source->AddLocalizedString("noPoliciesSet", IDS_POLICY_NO_POLICIES_SET);
100 source->AddLocalizedString("headerScope", IDS_POLICY_HEADER_SCOPE); 104 source->AddLocalizedString("headerScope", IDS_POLICY_HEADER_SCOPE);
101 source->AddLocalizedString("headerLevel", IDS_POLICY_HEADER_LEVEL); 105 source->AddLocalizedString("headerLevel", IDS_POLICY_HEADER_LEVEL);
102 source->AddLocalizedString("headerName", IDS_POLICY_HEADER_NAME); 106 source->AddLocalizedString("headerName", IDS_POLICY_HEADER_NAME);
103 source->AddLocalizedString("headerValue", IDS_POLICY_HEADER_VALUE); 107 source->AddLocalizedString("headerValue", IDS_POLICY_HEADER_VALUE);
104 source->AddLocalizedString("headerStatus", IDS_POLICY_HEADER_STATUS); 108 source->AddLocalizedString("headerStatus", IDS_POLICY_HEADER_STATUS);
105 source->AddLocalizedString("showExpandedValue", 109 source->AddLocalizedString("showExpandedValue",
106 IDS_POLICY_SHOW_EXPANDED_VALUE); 110 IDS_POLICY_SHOW_EXPANDED_VALUE);
107 source->AddLocalizedString("hideExpandedValue", 111 source->AddLocalizedString("hideExpandedValue",
108 IDS_POLICY_HIDE_EXPANDED_VALUE); 112 IDS_POLICY_HIDE_EXPANDED_VALUE);
109 source->AddLocalizedString("scopeUser", IDS_POLICY_SCOPE_USER); 113 source->AddLocalizedString("scopeUser", IDS_POLICY_SCOPE_USER);
110 source->AddLocalizedString("scopeDevice", IDS_POLICY_SCOPE_DEVICE); 114 source->AddLocalizedString("scopeDevice", IDS_POLICY_SCOPE_DEVICE);
111 source->AddLocalizedString("levelRecommended", IDS_POLICY_LEVEL_RECOMMENDED); 115 source->AddLocalizedString("levelRecommended", IDS_POLICY_LEVEL_RECOMMENDED);
112 source->AddLocalizedString("levelMandatory", IDS_POLICY_LEVEL_MANDATORY); 116 source->AddLocalizedString("levelMandatory", IDS_POLICY_LEVEL_MANDATORY);
113 source->AddLocalizedString("ok", IDS_POLICY_OK); 117 source->AddLocalizedString("ok", IDS_POLICY_OK);
114 source->AddLocalizedString("unset", IDS_POLICY_UNSET); 118 source->AddLocalizedString("unset", IDS_POLICY_UNSET);
115 source->AddLocalizedString("unknown", IDS_POLICY_UNKNOWN); 119 source->AddLocalizedString("unknown", IDS_POLICY_UNKNOWN);
120 source->AddLocalizedString("notSpecified", IDS_POLICY_NOT_SPECIFIED);
116 121
117 source->SetJsonPath("strings.js"); 122 source->SetJsonPath("strings.js");
118 123
119 // Add required resources. 124 // Add required resources.
120 source->AddResourcePath("policy.css", IDR_POLICY_CSS); 125 source->AddResourcePath("policy.css", IDR_POLICY_CSS);
121 source->AddResourcePath("policy.js", IDR_POLICY_JS); 126 source->AddResourcePath("policy.js", IDR_POLICY_JS);
122 source->AddResourcePath("uber_utils.js", IDR_UBER_UTILS_JS); 127 source->AddResourcePath("uber_utils.js", IDR_UBER_UTILS_JS);
123 source->SetDefaultResource(IDR_POLICY_HTML); 128 source->SetDefaultResource(IDR_POLICY_HTML);
124 129
125 return source; 130 return source;
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 if (store->status() == policy::CloudPolicyStore::STATUS_OK) { 166 if (store->status() == policy::CloudPolicyStore::STATUS_OK) {
162 if (client && client->status() != policy::DM_STATUS_SUCCESS) 167 if (client && client->status() != policy::DM_STATUS_SUCCESS)
163 status = policy::FormatDeviceManagementStatus(client->status()); 168 status = policy::FormatDeviceManagementStatus(client->status());
164 else if (!store->is_managed()) 169 else if (!store->is_managed())
165 status = FormatAssociationState(store->policy()); 170 status = FormatAssociationState(store->policy());
166 } 171 }
167 172
168 const em::PolicyData* policy = store->policy(); 173 const em::PolicyData* policy = store->policy();
169 std::string client_id = policy ? policy->device_id() : std::string(); 174 std::string client_id = policy ? policy->device_id() : std::string();
170 std::string username = policy ? policy->username() : std::string(); 175 std::string username = policy ? policy->username() : std::string();
176
177 if (policy && policy->has_annotated_asset_id())
178 dict->SetString("assetId", policy->annotated_asset_id());
179 if (policy && policy->has_annotated_location())
180 dict->SetString("location", policy->annotated_location());
181 if (policy && policy->has_directory_api_id())
182 dict->SetString("directoryApiId", policy->directory_api_id());
183
171 base::TimeDelta refresh_interval = 184 base::TimeDelta refresh_interval =
172 base::TimeDelta::FromMilliseconds(refresh_scheduler ? 185 base::TimeDelta::FromMilliseconds(refresh_scheduler ?
173 refresh_scheduler->refresh_delay() : 186 refresh_scheduler->refresh_delay() :
174 policy::CloudPolicyRefreshScheduler::kDefaultRefreshDelayMs); 187 policy::CloudPolicyRefreshScheduler::kDefaultRefreshDelayMs);
175 base::Time last_refresh_time = refresh_scheduler ? 188 base::Time last_refresh_time = refresh_scheduler ?
176 refresh_scheduler->last_refresh() : base::Time(); 189 refresh_scheduler->last_refresh() : base::Time();
177 190
178 bool no_error = store->status() == policy::CloudPolicyStore::STATUS_OK && 191 bool no_error = store->status() == policy::CloudPolicyStore::STATUS_OK &&
179 client && client->status() == policy::DM_STATUS_SUCCESS; 192 client && client->status() == policy::DM_STATUS_SUCCESS;
180 dict->SetBoolean("error", !no_error); 193 dict->SetBoolean("error", !no_error);
(...skipping 633 matching lines...) Expand 10 before | Expand all | Expand 10 after
814 } 827 }
815 828
816 PolicyUI::PolicyUI(content::WebUI* web_ui) : WebUIController(web_ui) { 829 PolicyUI::PolicyUI(content::WebUI* web_ui) : WebUIController(web_ui) {
817 web_ui->AddMessageHandler(new PolicyUIHandler); 830 web_ui->AddMessageHandler(new PolicyUIHandler);
818 content::WebUIDataSource::Add(Profile::FromWebUI(web_ui), 831 content::WebUIDataSource::Add(Profile::FromWebUI(web_ui),
819 CreatePolicyUIHTMLSource()); 832 CreatePolicyUIHTMLSource());
820 } 833 }
821 834
822 PolicyUI::~PolicyUI() { 835 PolicyUI::~PolicyUI() {
823 } 836 }
OLDNEW
« no previous file with comments | « chrome/browser/resources/policy.js ('k') | components/policy_strings.grdp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698