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

Side by Side Diff: chrome/browser/policy/device_policy_cache.cc

Issue 10097007: Make device-level proxy policy mandatory in KIOSK mode. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/policy/device_policy_cache.h ('k') | no next file » | 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/policy/device_policy_cache.h" 5 #include "chrome/browser/policy/device_policy_cache.h"
6 6
7 #include <limits> 7 #include <limits>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after
340 SetReady(); 340 SetReady();
341 } 341 }
342 342
343 void DevicePolicyCache::CheckFetchingDone() { 343 void DevicePolicyCache::CheckFetchingDone() {
344 if (policy_fetch_pending_) { 344 if (policy_fetch_pending_) {
345 CloudPolicyCacheBase::SetFetchingDone(); 345 CloudPolicyCacheBase::SetFetchingDone();
346 policy_fetch_pending_ = false; 346 policy_fetch_pending_ = false;
347 } 347 }
348 } 348 }
349 349
350 void DevicePolicyCache::DecodeDevicePolicy(
351 const em::ChromeDeviceSettingsProto& policy,
352 PolicyMap* policies) {
353 // Decode the various groups of policies.
354 DecodeLoginPolicies(policy, policies);
355 DecodeKioskPolicies(policy, policies);
356 DecodeNetworkPolicies(policy, policies, install_attributes_);
357 DecodeReportingPolicies(policy, policies);
358 DecodeGenericPolicies(policy, policies);
359 }
360
350 // static 361 // static
351 void DevicePolicyCache::DecodeLoginPolicies( 362 void DevicePolicyCache::DecodeLoginPolicies(
352 const em::ChromeDeviceSettingsProto& policy, 363 const em::ChromeDeviceSettingsProto& policy,
353 PolicyMap* policies) { 364 PolicyMap* policies) {
354 if (policy.has_guest_mode_enabled()) { 365 if (policy.has_guest_mode_enabled()) {
355 const em::GuestModeEnabledProto& container(policy.guest_mode_enabled()); 366 const em::GuestModeEnabledProto& container(policy.guest_mode_enabled());
356 if (container.has_guest_mode_enabled()) { 367 if (container.has_guest_mode_enabled()) {
357 policies->Set(key::kDeviceGuestModeEnabled, 368 policies->Set(key::kDeviceGuestModeEnabled,
358 POLICY_LEVEL_MANDATORY, 369 POLICY_LEVEL_MANDATORY,
359 POLICY_SCOPE_MACHINE, 370 POLICY_SCOPE_MACHINE,
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
466 policies->Set(key::kDeviceAppPack, 477 policies->Set(key::kDeviceAppPack,
467 POLICY_LEVEL_MANDATORY, 478 POLICY_LEVEL_MANDATORY,
468 POLICY_SCOPE_MACHINE, 479 POLICY_SCOPE_MACHINE,
469 app_pack_list); 480 app_pack_list);
470 } 481 }
471 } 482 }
472 483
473 // static 484 // static
474 void DevicePolicyCache::DecodeNetworkPolicies( 485 void DevicePolicyCache::DecodeNetworkPolicies(
475 const em::ChromeDeviceSettingsProto& policy, 486 const em::ChromeDeviceSettingsProto& policy,
476 PolicyMap* policies) { 487 PolicyMap* policies,
488 EnterpriseInstallAttributes* install_attributes) {
477 if (policy.has_device_proxy_settings()) { 489 if (policy.has_device_proxy_settings()) {
478 const em::DeviceProxySettingsProto& container( 490 const em::DeviceProxySettingsProto& container(
479 policy.device_proxy_settings()); 491 policy.device_proxy_settings());
480 scoped_ptr<DictionaryValue> proxy_settings(new DictionaryValue); 492 scoped_ptr<DictionaryValue> proxy_settings(new DictionaryValue);
481 if (container.has_proxy_mode()) 493 if (container.has_proxy_mode())
482 proxy_settings->SetString(key::kProxyMode, container.proxy_mode()); 494 proxy_settings->SetString(key::kProxyMode, container.proxy_mode());
483 if (container.has_proxy_server()) 495 if (container.has_proxy_server())
484 proxy_settings->SetString(key::kProxyServer, container.proxy_server()); 496 proxy_settings->SetString(key::kProxyServer, container.proxy_server());
485 if (container.has_proxy_pac_url()) 497 if (container.has_proxy_pac_url())
486 proxy_settings->SetString(key::kProxyPacUrl, container.proxy_pac_url()); 498 proxy_settings->SetString(key::kProxyPacUrl, container.proxy_pac_url());
487 if (container.has_proxy_bypass_list()) { 499 if (container.has_proxy_bypass_list()) {
488 proxy_settings->SetString(key::kProxyBypassList, 500 proxy_settings->SetString(key::kProxyBypassList,
489 container.proxy_bypass_list()); 501 container.proxy_bypass_list());
490 } 502 }
503
504 // Figure out the level. Proxy policy is mandatory in kiosk mode.
505 PolicyLevel level = POLICY_LEVEL_RECOMMENDED;
506 if (install_attributes->GetMode() == DEVICE_MODE_KIOSK)
507 level = POLICY_LEVEL_MANDATORY;
508
491 if (!proxy_settings->empty()) { 509 if (!proxy_settings->empty()) {
492 policies->Set(key::kProxySettings, 510 policies->Set(key::kProxySettings,
493 POLICY_LEVEL_RECOMMENDED, 511 level,
494 POLICY_SCOPE_MACHINE, 512 POLICY_SCOPE_MACHINE,
495 proxy_settings.release()); 513 proxy_settings.release());
496 } 514 }
497 } 515 }
498 516
499 if (policy.has_data_roaming_enabled()) { 517 if (policy.has_data_roaming_enabled()) {
500 const em::DataRoamingEnabledProto& container(policy.data_roaming_enabled()); 518 const em::DataRoamingEnabledProto& container(policy.data_roaming_enabled());
501 if (container.has_data_roaming_enabled()) { 519 if (container.has_data_roaming_enabled()) {
502 policies->Set(key::kDeviceDataRoamingEnabled, 520 policies->Set(key::kDeviceDataRoamingEnabled,
503 POLICY_LEVEL_MANDATORY, 521 POLICY_LEVEL_MANDATORY,
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
629 urls->Append(Value::CreateStringValue(*entry)); 647 urls->Append(Value::CreateStringValue(*entry));
630 } 648 }
631 policies->Set(key::kDeviceStartUpUrls, 649 policies->Set(key::kDeviceStartUpUrls,
632 POLICY_LEVEL_MANDATORY, 650 POLICY_LEVEL_MANDATORY,
633 POLICY_SCOPE_MACHINE, 651 POLICY_SCOPE_MACHINE,
634 urls); 652 urls);
635 } 653 }
636 } 654 }
637 } 655 }
638 656
639 // static
640 void DevicePolicyCache::DecodeDevicePolicy(
641 const em::ChromeDeviceSettingsProto& policy,
642 PolicyMap* policies) {
643 // Decode the various groups of policies.
644 DecodeLoginPolicies(policy, policies);
645 DecodeKioskPolicies(policy, policies);
646 DecodeNetworkPolicies(policy, policies);
647 DecodeReportingPolicies(policy, policies);
648 DecodeGenericPolicies(policy, policies);
649 }
650
651 } // namespace policy 657 } // namespace policy
OLDNEW
« no previous file with comments | « chrome/browser/policy/device_policy_cache.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698