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

Unified Diff: chrome/browser/chromeos/policy/device_policy_decoder_chromeos.cc

Issue 1304843004: Add source column to chrome://policy showing the origins of policies. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed another test. Created 5 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/policy/device_policy_decoder_chromeos.cc
diff --git a/chrome/browser/chromeos/policy/device_policy_decoder_chromeos.cc b/chrome/browser/chromeos/policy/device_policy_decoder_chromeos.cc
index 98216eb2b1bfac05cd88735953b5326403558d35..3b1570189fc5aaa3d4c0b6070c772e0483b737c0 100644
--- a/chrome/browser/chromeos/policy/device_policy_decoder_chromeos.cc
+++ b/chrome/browser/chromeos/policy/device_policy_decoder_chromeos.cc
@@ -20,6 +20,7 @@
#include "components/policy/core/browser/browser_policy_connector.h"
#include "components/policy/core/common/external_data_fetcher.h"
#include "components/policy/core/common/policy_map.h"
+#include "components/policy/core/common/policy_types.h"
#include "components/policy/core/common/schema.h"
#include "policy/policy_constants.h"
#include "third_party/cros_system_api/dbus/service_constants.h"
@@ -115,6 +116,7 @@ void DecodeLoginPolicies(const em::ChromeDeviceSettingsProto& policy,
policies->Set(key::kDeviceGuestModeEnabled,
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_MACHINE,
+ POLICY_SOURCE_CLOUD,
new base::FundamentalValue(
container.guest_mode_enabled()),
NULL);
@@ -126,6 +128,7 @@ void DecodeLoginPolicies(const em::ChromeDeviceSettingsProto& policy,
if (container.has_reboot_on_shutdown()) {
policies->Set(key::kDeviceRebootOnShutdown, POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_MACHINE,
+ POLICY_SOURCE_CLOUD,
new base::FundamentalValue(container.reboot_on_shutdown()),
NULL);
}
@@ -137,6 +140,7 @@ void DecodeLoginPolicies(const em::ChromeDeviceSettingsProto& policy,
policies->Set(key::kDeviceShowUserNamesOnSignin,
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_MACHINE,
+ POLICY_SOURCE_CLOUD,
new base::FundamentalValue(
container.show_user_names()),
NULL);
@@ -149,6 +153,7 @@ void DecodeLoginPolicies(const em::ChromeDeviceSettingsProto& policy,
policies->Set(key::kDeviceAllowNewUsers,
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_MACHINE,
+ POLICY_SOURCE_CLOUD,
new base::FundamentalValue(
container.allow_new_users()),
NULL);
@@ -167,6 +172,7 @@ void DecodeLoginPolicies(const em::ChromeDeviceSettingsProto& policy,
policies->Set(key::kDeviceUserWhitelist,
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_MACHINE,
+ POLICY_SOURCE_CLOUD,
whitelist,
NULL);
}
@@ -178,6 +184,7 @@ void DecodeLoginPolicies(const em::ChromeDeviceSettingsProto& policy,
policies->Set(key::kDeviceEphemeralUsersEnabled,
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_MACHINE,
+ POLICY_SOURCE_CLOUD,
new base::FundamentalValue(
container.ephemeral_users_enabled()),
NULL);
@@ -226,12 +233,14 @@ void DecodeLoginPolicies(const em::ChromeDeviceSettingsProto& policy,
policies->Set(key::kDeviceLocalAccounts,
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_MACHINE,
+ POLICY_SOURCE_CLOUD,
account_list.release(),
NULL);
if (container.has_auto_login_id()) {
policies->Set(key::kDeviceLocalAccountAutoLoginId,
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_MACHINE,
+ POLICY_SOURCE_CLOUD,
new base::StringValue(container.auto_login_id()),
NULL);
}
@@ -239,6 +248,7 @@ void DecodeLoginPolicies(const em::ChromeDeviceSettingsProto& policy,
policies->Set(key::kDeviceLocalAccountAutoLoginDelay,
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_MACHINE,
+ POLICY_SOURCE_CLOUD,
DecodeIntegerValue(container.auto_login_delay()).release(),
NULL);
}
@@ -246,6 +256,7 @@ void DecodeLoginPolicies(const em::ChromeDeviceSettingsProto& policy,
policies->Set(key::kDeviceLocalAccountAutoLoginBailoutEnabled,
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_MACHINE,
+ POLICY_SOURCE_CLOUD,
new base::FundamentalValue(
container.enable_auto_login_bailout()),
NULL);
@@ -254,6 +265,7 @@ void DecodeLoginPolicies(const em::ChromeDeviceSettingsProto& policy,
policies->Set(key::kDeviceLocalAccountPromptForNetworkWhenOffline,
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_MACHINE,
+ POLICY_SOURCE_CLOUD,
new base::FundamentalValue(
container.prompt_for_network_when_offline()),
NULL);
@@ -269,6 +281,7 @@ void DecodeLoginPolicies(const em::ChromeDeviceSettingsProto& policy,
policies->Set(key::kSupervisedUsersEnabled,
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_MACHINE,
+ POLICY_SOURCE_CLOUD,
value,
NULL);
}
@@ -280,6 +293,7 @@ void DecodeLoginPolicies(const em::ChromeDeviceSettingsProto& policy,
policies->Set(key::kDeviceTransferSAMLCookies,
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_MACHINE,
+ POLICY_SOURCE_CLOUD,
new base::FundamentalValue(
container.transfer_saml_cookies()),
NULL);
@@ -295,6 +309,7 @@ void DecodeNetworkPolicies(const em::ChromeDeviceSettingsProto& policy,
policies->Set(key::kDeviceDataRoamingEnabled,
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_MACHINE,
+ POLICY_SOURCE_CLOUD,
new base::FundamentalValue(
container.data_roaming_enabled()),
NULL);
@@ -308,6 +323,7 @@ void DecodeNetworkPolicies(const em::ChromeDeviceSettingsProto& policy,
policies->Set(key::kDeviceOpenNetworkConfiguration,
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_MACHINE,
+ POLICY_SOURCE_CLOUD,
new base::StringValue(config),
NULL);
}
@@ -321,6 +337,7 @@ void DecodeReportingPolicies(const em::ChromeDeviceSettingsProto& policy,
policies->Set(key::kReportDeviceVersionInfo,
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_MACHINE,
+ POLICY_SOURCE_CLOUD,
new base::FundamentalValue(
container.report_version_info()),
NULL);
@@ -329,6 +346,7 @@ void DecodeReportingPolicies(const em::ChromeDeviceSettingsProto& policy,
policies->Set(key::kReportDeviceActivityTimes,
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_MACHINE,
+ POLICY_SOURCE_CLOUD,
new base::FundamentalValue(
container.report_activity_times()),
NULL);
@@ -337,6 +355,7 @@ void DecodeReportingPolicies(const em::ChromeDeviceSettingsProto& policy,
policies->Set(key::kReportDeviceBootMode,
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_MACHINE,
+ POLICY_SOURCE_CLOUD,
new base::FundamentalValue(
container.report_boot_mode()),
NULL);
@@ -345,6 +364,7 @@ void DecodeReportingPolicies(const em::ChromeDeviceSettingsProto& policy,
policies->Set(key::kReportDeviceLocation,
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_MACHINE,
+ POLICY_SOURCE_CLOUD,
new base::FundamentalValue(
container.report_location()),
NULL);
@@ -353,6 +373,7 @@ void DecodeReportingPolicies(const em::ChromeDeviceSettingsProto& policy,
policies->Set(key::kReportDeviceNetworkInterfaces,
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_MACHINE,
+ POLICY_SOURCE_CLOUD,
new base::FundamentalValue(
container.report_network_interfaces()),
NULL);
@@ -361,6 +382,7 @@ void DecodeReportingPolicies(const em::ChromeDeviceSettingsProto& policy,
policies->Set(key::kReportDeviceUsers,
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_MACHINE,
+ POLICY_SOURCE_CLOUD,
new base::FundamentalValue(container.report_users()),
NULL);
}
@@ -368,6 +390,7 @@ void DecodeReportingPolicies(const em::ChromeDeviceSettingsProto& policy,
policies->Set(key::kReportDeviceHardwareStatus,
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_MACHINE,
+ POLICY_SOURCE_CLOUD,
new base::FundamentalValue(
container.report_hardware_status()),
NULL);
@@ -376,6 +399,7 @@ void DecodeReportingPolicies(const em::ChromeDeviceSettingsProto& policy,
policies->Set(key::kReportDeviceSessionStatus,
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_MACHINE,
+ POLICY_SOURCE_CLOUD,
new base::FundamentalValue(
container.report_session_status()),
NULL);
@@ -384,6 +408,7 @@ void DecodeReportingPolicies(const em::ChromeDeviceSettingsProto& policy,
policies->Set(key::kReportUploadFrequency,
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_MACHINE,
+ POLICY_SOURCE_CLOUD,
DecodeIntegerValue(
container.device_status_frequency()).release(),
NULL);
@@ -397,6 +422,7 @@ void DecodeReportingPolicies(const em::ChromeDeviceSettingsProto& policy,
policies->Set(key::kHeartbeatEnabled,
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_MACHINE,
+ POLICY_SOURCE_CLOUD,
new base::FundamentalValue(
container.heartbeat_enabled()),
NULL);
@@ -405,6 +431,7 @@ void DecodeReportingPolicies(const em::ChromeDeviceSettingsProto& policy,
policies->Set(key::kHeartbeatFrequency,
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_MACHINE,
+ POLICY_SOURCE_CLOUD,
DecodeIntegerValue(
container.heartbeat_frequency()).release(),
NULL);
@@ -417,6 +444,7 @@ void DecodeReportingPolicies(const em::ChromeDeviceSettingsProto& policy,
if (container.has_system_log_upload_enabled()) {
policies->Set(
key::kLogUploadEnabled, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_MACHINE,
+ POLICY_SOURCE_CLOUD,
new base::FundamentalValue(container.system_log_upload_enabled()),
NULL);
}
@@ -432,6 +460,7 @@ void DecodeAutoUpdatePolicies(const em::ChromeDeviceSettingsProto& policy,
policies->Set(key::kChromeOsReleaseChannel,
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_MACHINE,
+ POLICY_SOURCE_CLOUD,
new base::StringValue(channel),
NULL);
// TODO(dubroy): Once http://crosbug.com/17015 is implemented, we won't
@@ -444,6 +473,7 @@ void DecodeAutoUpdatePolicies(const em::ChromeDeviceSettingsProto& policy,
policies->Set(key::kChromeOsReleaseChannelDelegated,
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_MACHINE,
+ POLICY_SOURCE_CLOUD,
new base::FundamentalValue(
container.release_channel_delegated()),
NULL);
@@ -456,6 +486,7 @@ void DecodeAutoUpdatePolicies(const em::ChromeDeviceSettingsProto& policy,
policies->Set(key::kDeviceAutoUpdateDisabled,
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_MACHINE,
+ POLICY_SOURCE_CLOUD,
new base::FundamentalValue(
container.update_disabled()),
NULL);
@@ -465,6 +496,7 @@ void DecodeAutoUpdatePolicies(const em::ChromeDeviceSettingsProto& policy,
policies->Set(key::kDeviceTargetVersionPrefix,
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_MACHINE,
+ POLICY_SOURCE_CLOUD,
new base::StringValue(
container.target_version_prefix()),
NULL);
@@ -477,6 +509,7 @@ void DecodeAutoUpdatePolicies(const em::ChromeDeviceSettingsProto& policy,
policies->Set(key::kDeviceUpdateScatterFactor,
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_MACHINE,
+ POLICY_SOURCE_CLOUD,
new base::FundamentalValue(static_cast<int>(
container.scatter_factor_in_seconds())),
NULL);
@@ -495,6 +528,7 @@ void DecodeAutoUpdatePolicies(const em::ChromeDeviceSettingsProto& policy,
policies->Set(key::kDeviceUpdateAllowedConnectionTypes,
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_MACHINE,
+ POLICY_SOURCE_CLOUD,
allowed_connection_types,
NULL);
}
@@ -504,6 +538,7 @@ void DecodeAutoUpdatePolicies(const em::ChromeDeviceSettingsProto& policy,
key::kDeviceUpdateHttpDownloadsEnabled,
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_MACHINE,
+ POLICY_SOURCE_CLOUD,
new base::FundamentalValue(container.http_downloads_enabled()),
NULL);
}
@@ -512,6 +547,7 @@ void DecodeAutoUpdatePolicies(const em::ChromeDeviceSettingsProto& policy,
policies->Set(key::kRebootAfterUpdate,
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_MACHINE,
+ POLICY_SOURCE_CLOUD,
new base::FundamentalValue(
container.reboot_after_update()),
NULL);
@@ -521,6 +557,7 @@ void DecodeAutoUpdatePolicies(const em::ChromeDeviceSettingsProto& policy,
policies->Set(key::kDeviceAutoUpdateP2PEnabled,
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_MACHINE,
+ POLICY_SOURCE_CLOUD,
new base::FundamentalValue(container.p2p_enabled()),
NULL);
}
@@ -538,6 +575,7 @@ void DecodeAccessibilityPolicies(const em::ChromeDeviceSettingsProto& policy,
key::kDeviceLoginScreenDefaultLargeCursorEnabled,
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_MACHINE,
+ POLICY_SOURCE_CLOUD,
new base::FundamentalValue(
container.login_screen_default_large_cursor_enabled()),
NULL);
@@ -548,6 +586,7 @@ void DecodeAccessibilityPolicies(const em::ChromeDeviceSettingsProto& policy,
key::kDeviceLoginScreenDefaultSpokenFeedbackEnabled,
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_MACHINE,
+ POLICY_SOURCE_CLOUD,
new base::FundamentalValue(
container.login_screen_default_spoken_feedback_enabled()),
NULL);
@@ -558,6 +597,7 @@ void DecodeAccessibilityPolicies(const em::ChromeDeviceSettingsProto& policy,
key::kDeviceLoginScreenDefaultHighContrastEnabled,
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_MACHINE,
+ POLICY_SOURCE_CLOUD,
new base::FundamentalValue(
container.login_screen_default_high_contrast_enabled()),
NULL);
@@ -568,6 +608,7 @@ void DecodeAccessibilityPolicies(const em::ChromeDeviceSettingsProto& policy,
key::kDeviceLoginScreenDefaultScreenMagnifierType,
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_MACHINE,
+ POLICY_SOURCE_CLOUD,
DecodeIntegerValue(
container.login_screen_default_screen_magnifier_type()).release(),
NULL);
@@ -578,6 +619,7 @@ void DecodeAccessibilityPolicies(const em::ChromeDeviceSettingsProto& policy,
key::kDeviceLoginScreenDefaultVirtualKeyboardEnabled,
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_MACHINE,
+ POLICY_SOURCE_CLOUD,
new base::FundamentalValue(
container.login_screen_default_virtual_keyboard_enabled()),
NULL);
@@ -595,6 +637,7 @@ void DecodeGenericPolicies(const em::ChromeDeviceSettingsProto& policy,
key::kDevicePolicyRefreshRate,
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_MACHINE,
+ POLICY_SOURCE_CLOUD,
DecodeIntegerValue(container.device_policy_refresh_rate()).release(),
NULL);
}
@@ -606,6 +649,7 @@ void DecodeGenericPolicies(const em::ChromeDeviceSettingsProto& policy,
policies->Set(key::kDeviceMetricsReportingEnabled,
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_MACHINE,
+ POLICY_SOURCE_CLOUD,
new base::FundamentalValue(
container.metrics_enabled()),
NULL);
@@ -617,6 +661,7 @@ void DecodeGenericPolicies(const em::ChromeDeviceSettingsProto& policy,
policies->Set(key::kSystemTimezone,
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_MACHINE,
+ POLICY_SOURCE_CLOUD,
new base::StringValue(
policy.system_timezone().timezone()),
NULL);
@@ -628,6 +673,7 @@ void DecodeGenericPolicies(const em::ChromeDeviceSettingsProto& policy,
policies->Set(key::kSystemUse24HourClock,
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_MACHINE,
+ POLICY_SOURCE_CLOUD,
new base::FundamentalValue(
policy.use_24hour_clock().use_24hour_clock()),
NULL);
@@ -641,6 +687,7 @@ void DecodeGenericPolicies(const em::ChromeDeviceSettingsProto& policy,
policies->Set(key::kDeviceAllowRedeemChromeOsRegistrationOffers,
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_MACHINE,
+ POLICY_SOURCE_CLOUD,
new base::FundamentalValue(
container.allow_redeem_offers()),
NULL);
@@ -653,6 +700,7 @@ void DecodeGenericPolicies(const em::ChromeDeviceSettingsProto& policy,
policies->Set(key::kUptimeLimit,
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_MACHINE,
+ POLICY_SOURCE_CLOUD,
DecodeIntegerValue(container.uptime_limit()).release(),
NULL);
}
@@ -670,6 +718,7 @@ void DecodeGenericPolicies(const em::ChromeDeviceSettingsProto& policy,
policies->Set(key::kDeviceStartUpFlags,
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_MACHINE,
+ POLICY_SOURCE_CLOUD,
flags,
NULL);
}
@@ -679,6 +728,7 @@ void DecodeGenericPolicies(const em::ChromeDeviceSettingsProto& policy,
policies->Set(key::kDeviceVariationsRestrictParameter,
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_MACHINE,
+ POLICY_SOURCE_CLOUD,
new base::StringValue(
policy.variations_parameter().parameter()),
NULL);
@@ -690,6 +740,7 @@ void DecodeGenericPolicies(const em::ChromeDeviceSettingsProto& policy,
policies->Set(key::kAttestationEnabledForDevice,
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_MACHINE,
+ POLICY_SOURCE_CLOUD,
new base::FundamentalValue(
policy.attestation_settings().attestation_enabled()),
NULL);
@@ -699,6 +750,7 @@ void DecodeGenericPolicies(const em::ChromeDeviceSettingsProto& policy,
key::kAttestationForContentProtectionEnabled,
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_MACHINE,
+ POLICY_SOURCE_CLOUD,
new base::FundamentalValue(
policy.attestation_settings().content_protection_enabled()),
NULL);
@@ -717,6 +769,7 @@ void DecodeGenericPolicies(const em::ChromeDeviceSettingsProto& policy,
policies->Set(key::kDeviceLoginScreenPowerManagement,
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_MACHINE,
+ POLICY_SOURCE_CLOUD,
decoded_json.release(),
NULL);
}
@@ -730,6 +783,7 @@ void DecodeGenericPolicies(const em::ChromeDeviceSettingsProto& policy,
key::kDeviceBlockDevmode,
POLICY_LEVEL_MANDATORY,
POLICY_SCOPE_MACHINE,
+ POLICY_SOURCE_CLOUD,
new base::FundamentalValue(container.block_devmode()),
NULL);
}
@@ -740,7 +794,7 @@ void DecodeGenericPolicies(const em::ChromeDeviceSettingsProto& policy,
if (container.has_extension_cache_size()) {
policies->Set(
key::kExtensionCacheSize, POLICY_LEVEL_MANDATORY,
- POLICY_SCOPE_MACHINE,
+ POLICY_SCOPE_MACHINE, POLICY_SOURCE_CLOUD,
DecodeIntegerValue(container.extension_cache_size()).release(),
nullptr);
}
@@ -751,7 +805,7 @@ void DecodeGenericPolicies(const em::ChromeDeviceSettingsProto& policy,
policy.login_screen_domain_auto_complete());
policies->Set(
key::kDeviceLoginScreenDomainAutoComplete, POLICY_LEVEL_MANDATORY,
- POLICY_SCOPE_MACHINE,
+ POLICY_SCOPE_MACHINE, POLICY_SOURCE_CLOUD,
new base::StringValue(container.login_screen_domain_auto_complete()),
nullptr);
}

Powered by Google App Engine
This is Rietveld 408576698