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

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

Issue 2686233006: Add managed device signal (Closed)
Patch Set: Minor changes in comments 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
« no previous file with comments | « no previous file | chrome/browser/chromeos/extensions/info_private_apitest.cc » ('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/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 // Value to which managedDeviceStatus property is set for unmanaged devices.
142 const char kManagedDeviceStatusNotManaged[] = "not managed";
143
144 // Value to which managedDeviceStatus property is set for managed devices.
145 const char kManagedDeviceStatusManaged[] = "managed";
146
138 const struct { 147 const struct {
139 const char* api_name; 148 const char* api_name;
140 const char* preference_name; 149 const char* preference_name;
141 } kPreferencesMap[] = { 150 } kPreferencesMap[] = {
142 {kPropertyLargeCursorEnabled, prefs::kAccessibilityLargeCursorEnabled}, 151 {kPropertyLargeCursorEnabled, prefs::kAccessibilityLargeCursorEnabled},
143 {kPropertyStickyKeysEnabled, prefs::kAccessibilityStickyKeysEnabled}, 152 {kPropertyStickyKeysEnabled, prefs::kAccessibilityStickyKeysEnabled},
144 {kPropertySpokenFeedbackEnabled, 153 {kPropertySpokenFeedbackEnabled,
145 prefs::kAccessibilitySpokenFeedbackEnabled}, 154 prefs::kAccessibilitySpokenFeedbackEnabled},
146 {kPropertyHighContrastEnabled, prefs::kAccessibilityHighContrastEnabled}, 155 {kPropertyHighContrastEnabled, prefs::kAccessibilityHighContrastEnabled},
147 {kPropertyScreenMagnifierEnabled, 156 {kPropertyScreenMagnifierEnabled,
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 } 270 }
262 271
263 if (property_name == kPropertyPlayStoreStatus) { 272 if (property_name == kPropertyPlayStoreStatus) {
264 if (arc::IsArcAllowedForProfile(Profile::FromBrowserContext(context_))) 273 if (arc::IsArcAllowedForProfile(Profile::FromBrowserContext(context_)))
265 return new base::StringValue(kPlayStoreStatusEnabled); 274 return new base::StringValue(kPlayStoreStatusEnabled);
266 if (arc::IsArcAvailable()) 275 if (arc::IsArcAvailable())
267 return new base::StringValue(kPlayStoreStatusAvailable); 276 return new base::StringValue(kPlayStoreStatusAvailable);
268 return new base::StringValue(kPlayStoreStatusNotAvailable); 277 return new base::StringValue(kPlayStoreStatusNotAvailable);
269 } 278 }
270 279
280 if (property_name == kPropertyManagedDeviceStatus) {
281 policy::BrowserPolicyConnectorChromeOS* connector =
282 g_browser_process->platform_part()->browser_policy_connector_chromeos();
283 if (connector->IsEnterpriseManaged()) {
284 return new base::StringValue(kManagedDeviceStatusManaged);
285 }
286 return new base::StringValue(kManagedDeviceStatusNotManaged);
287 }
288
271 if (property_name == kPropertyClientId) { 289 if (property_name == kPropertyClientId) {
272 return new base::StringValue(GetClientId()); 290 return new base::StringValue(GetClientId());
273 } 291 }
274 292
275 if (property_name == kPropertyTimezone) { 293 if (property_name == kPropertyTimezone) {
276 return chromeos::CrosSettings::Get()->GetPref( 294 return chromeos::CrosSettings::Get()->GetPref(
277 chromeos::kSystemTimezone)->DeepCopy(); 295 chromeos::kSystemTimezone)->DeepCopy();
278 } 296 }
279 297
280 if (property_name == kPropertySupportedTimezones) { 298 if (property_name == kPropertySupportedTimezones) {
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 param_value); 336 param_value);
319 } else { 337 } else {
320 return RespondNow(Error(kPropertyNotFound, param_name)); 338 return RespondNow(Error(kPropertyNotFound, param_name));
321 } 339 }
322 } 340 }
323 341
324 return RespondNow(NoArguments()); 342 return RespondNow(NoArguments());
325 } 343 }
326 344
327 } // namespace extensions 345 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/chromeos/extensions/info_private_apitest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698