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

Side by Side Diff: chrome/browser/chromeos/extensions/info_private_api.cc

Issue 2686233006: Add managed device signal (Closed)
Patch Set: Minor comments change Created 3 years, 10 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
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/chromeos/extensions/info_private_api.h" 5 #include "chrome/browser/chromeos/extensions/info_private_api.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <utility> 9 #include <utility>
10 10
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 const char kPlayStoreStatusNotAvailable[] = "not available"; 128 const char kPlayStoreStatusNotAvailable[] = "not available";
129 129
130 // Key which corresponds to the "available" value of the PlayStoreStatus enum in 130 // Key which corresponds to the "available" value of the PlayStoreStatus enum in
131 // JS. 131 // JS.
132 const char kPlayStoreStatusAvailable[] = "available"; 132 const char kPlayStoreStatusAvailable[] = "available";
133 133
134 // Key which corresponds to the "enabled" value of the PlayStoreStatus enum in 134 // Key which corresponds to the "enabled" value of the PlayStoreStatus enum in
135 // JS. 135 // JS.
136 const char kPlayStoreStatusEnabled[] = "enabled"; 136 const char kPlayStoreStatusEnabled[] = "enabled";
137 137
138 // Key which corresponds to the managedDeviceStatus property in JS.
139 const char kPropertyManagedDeviceStatus[] = "managedDeviceStatus";
140
141 // Key which corresponds to the "not mananged" value of the ManagedDeviceStatus
tbarzic 2017/02/22 02:18:35 nit: This is not really a key - it's a managedDevi
Wenzhao (Colin) Zang 2017/02/22 03:11:06 Done.
142 // enum in JS.
143 const char kManagedDeviceStatusNotManaged[] = "not managed";
144
145 // Key which corresponds to the "managed" value of the ManagedDeviceStatus
tbarzic 2017/02/22 02:18:35 ditto
Wenzhao (Colin) Zang 2017/02/22 03:11:06 Done.
146 // enum in JS.
147 const char kManagedDeviceStatusManaged[] = "managed";
148
138 const struct { 149 const struct {
139 const char* api_name; 150 const char* api_name;
140 const char* preference_name; 151 const char* preference_name;
141 } kPreferencesMap[] = { 152 } kPreferencesMap[] = {
142 {kPropertyLargeCursorEnabled, prefs::kAccessibilityLargeCursorEnabled}, 153 {kPropertyLargeCursorEnabled, prefs::kAccessibilityLargeCursorEnabled},
143 {kPropertyStickyKeysEnabled, prefs::kAccessibilityStickyKeysEnabled}, 154 {kPropertyStickyKeysEnabled, prefs::kAccessibilityStickyKeysEnabled},
144 {kPropertySpokenFeedbackEnabled, 155 {kPropertySpokenFeedbackEnabled,
145 prefs::kAccessibilitySpokenFeedbackEnabled}, 156 prefs::kAccessibilitySpokenFeedbackEnabled},
146 {kPropertyHighContrastEnabled, prefs::kAccessibilityHighContrastEnabled}, 157 {kPropertyHighContrastEnabled, prefs::kAccessibilityHighContrastEnabled},
147 {kPropertyScreenMagnifierEnabled, 158 {kPropertyScreenMagnifierEnabled,
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 } 272 }
262 273
263 if (property_name == kPropertyPlayStoreStatus) { 274 if (property_name == kPropertyPlayStoreStatus) {
264 if (arc::IsArcAllowedForProfile(Profile::FromBrowserContext(context_))) 275 if (arc::IsArcAllowedForProfile(Profile::FromBrowserContext(context_)))
265 return new base::StringValue(kPlayStoreStatusEnabled); 276 return new base::StringValue(kPlayStoreStatusEnabled);
266 if (arc::IsArcAvailable()) 277 if (arc::IsArcAvailable())
267 return new base::StringValue(kPlayStoreStatusAvailable); 278 return new base::StringValue(kPlayStoreStatusAvailable);
268 return new base::StringValue(kPlayStoreStatusNotAvailable); 279 return new base::StringValue(kPlayStoreStatusNotAvailable);
269 } 280 }
270 281
282 if (property_name == kPropertyManagedDeviceStatus) {
283 policy::BrowserPolicyConnectorChromeOS* connector =
284 g_browser_process->platform_part()->browser_policy_connector_chromeos();
285 if (connector->IsEnterpriseManaged()) {
286 return new base::StringValue(kManagedDeviceStatusManaged);
287 } else {
tbarzic 2017/02/22 02:18:35 nit: no else after return, and no {}
Wenzhao (Colin) Zang 2017/02/22 03:11:06 Done.
288 return new base::StringValue(kManagedDeviceStatusNotManaged);
289 }
290 }
291
271 if (property_name == kPropertyClientId) { 292 if (property_name == kPropertyClientId) {
272 return new base::StringValue(GetClientId()); 293 return new base::StringValue(GetClientId());
273 } 294 }
274 295
275 if (property_name == kPropertyTimezone) { 296 if (property_name == kPropertyTimezone) {
276 return chromeos::CrosSettings::Get()->GetPref( 297 return chromeos::CrosSettings::Get()->GetPref(
277 chromeos::kSystemTimezone)->DeepCopy(); 298 chromeos::kSystemTimezone)->DeepCopy();
278 } 299 }
279 300
280 if (property_name == kPropertySupportedTimezones) { 301 if (property_name == kPropertySupportedTimezones) {
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 param_value); 339 param_value);
319 } else { 340 } else {
320 return RespondNow(Error(kPropertyNotFound, param_name)); 341 return RespondNow(Error(kPropertyNotFound, param_name));
321 } 342 }
322 } 343 }
323 344
324 return RespondNow(NoArguments()); 345 return RespondNow(NoArguments());
325 } 346 }
326 347
327 } // namespace extensions 348 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698