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

Side by Side Diff: chrome/browser/chromeos/settings/device_settings_provider.cc

Issue 2544693002: [Chrome OS] Add a chrome os device wallpaper policy. (Closed)
Patch Set: Address pastarmovj@'s comments. Created 4 years 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/settings/device_settings_provider.h" 5 #include "chrome/browser/chromeos/settings/device_settings_provider.h"
6 6
7 #include <memory.h> 7 #include <memory.h>
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <utility> 9 #include <utility>
10 10
11 #include "base/bind.h" 11 #include "base/bind.h"
12 #include "base/bind_helpers.h" 12 #include "base/bind_helpers.h"
13 #include "base/callback.h" 13 #include "base/callback.h"
14 #include "base/json/json_reader.h"
14 #include "base/logging.h" 15 #include "base/logging.h"
15 #include "base/macros.h" 16 #include "base/macros.h"
16 #include "base/metrics/histogram_macros.h" 17 #include "base/metrics/histogram_macros.h"
17 #include "base/threading/thread_restrictions.h" 18 #include "base/threading/thread_restrictions.h"
18 #include "base/values.h" 19 #include "base/values.h"
19 #include "chrome/browser/browser_process.h" 20 #include "chrome/browser/browser_process.h"
20 #include "chrome/browser/chromeos/ownership/owner_settings_service_chromeos.h" 21 #include "chrome/browser/chromeos/ownership/owner_settings_service_chromeos.h"
21 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" 22 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h"
22 #include "chrome/browser/chromeos/policy/device_local_account.h" 23 #include "chrome/browser/chromeos/policy/device_local_account.h"
23 #include "chrome/browser/chromeos/settings/cros_settings.h" 24 #include "chrome/browser/chromeos/settings/cros_settings.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 kAccountsPrefLoginScreenDomainAutoComplete, 58 kAccountsPrefLoginScreenDomainAutoComplete,
58 kAllowBluetooth, 59 kAllowBluetooth,
59 kAllowRedeemChromeOsRegistrationOffers, 60 kAllowRedeemChromeOsRegistrationOffers,
60 kAllowedConnectionTypesForUpdate, 61 kAllowedConnectionTypesForUpdate,
61 kAttestationForContentProtectionEnabled, 62 kAttestationForContentProtectionEnabled,
62 kDeviceAttestationEnabled, 63 kDeviceAttestationEnabled,
63 kDeviceDisabled, 64 kDeviceDisabled,
64 kDeviceDisabledMessage, 65 kDeviceDisabledMessage,
65 kDeviceOwner, 66 kDeviceOwner,
66 kDeviceQuirksDownloadEnabled, 67 kDeviceQuirksDownloadEnabled,
68 kDeviceWallpaperImage,
67 kDisplayRotationDefault, 69 kDisplayRotationDefault,
68 kExtensionCacheSize, 70 kExtensionCacheSize,
69 kHeartbeatEnabled, 71 kHeartbeatEnabled,
70 kHeartbeatFrequency, 72 kHeartbeatFrequency,
71 kLoginApps, 73 kLoginApps,
72 kLoginAuthenticationBehavior, 74 kLoginAuthenticationBehavior,
73 kLoginVideoCaptureAllowedUrls, 75 kLoginVideoCaptureAllowedUrls,
74 kPolicyMissingMitigationMode, 76 kPolicyMissingMitigationMode,
75 kRebootOnShutdown, 77 kRebootOnShutdown,
76 kReleaseChannel, 78 kReleaseChannel,
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after
516 } else { 518 } else {
517 new_values_cache->SetBoolean(kAllowBluetooth, true); 519 new_values_cache->SetBoolean(kAllowBluetooth, true);
518 } 520 }
519 521
520 if (policy.has_quirks_download_enabled() && 522 if (policy.has_quirks_download_enabled() &&
521 policy.quirks_download_enabled().has_quirks_download_enabled()) { 523 policy.quirks_download_enabled().has_quirks_download_enabled()) {
522 new_values_cache->SetBoolean( 524 new_values_cache->SetBoolean(
523 kDeviceQuirksDownloadEnabled, 525 kDeviceQuirksDownloadEnabled,
524 policy.quirks_download_enabled().quirks_download_enabled()); 526 policy.quirks_download_enabled().quirks_download_enabled());
525 } 527 }
528
529 if (policy.has_device_wallpaper_image() &&
530 policy.device_wallpaper_image().has_device_wallpaper_image()) {
531 std::unique_ptr<base::DictionaryValue> dict_val =
532 base::DictionaryValue::From(base::JSONReader::Read(
533 policy.device_wallpaper_image().device_wallpaper_image()));
534 new_values_cache->SetValue(kDeviceWallpaperImage, std::move(dict_val));
535 }
526 } 536 }
527 537
528 void DecodeLogUploadPolicies(const em::ChromeDeviceSettingsProto& policy, 538 void DecodeLogUploadPolicies(const em::ChromeDeviceSettingsProto& policy,
529 PrefValueMap* new_values_cache) { 539 PrefValueMap* new_values_cache) {
530 if (!policy.has_device_log_upload_settings()) 540 if (!policy.has_device_log_upload_settings())
531 return; 541 return;
532 542
533 const em::DeviceLogUploadSettingsProto& log_upload_policy = 543 const em::DeviceLogUploadSettingsProto& log_upload_policy =
534 policy.device_log_upload_settings(); 544 policy.device_log_upload_settings();
535 if (log_upload_policy.has_system_log_upload_enabled()) { 545 if (log_upload_policy.has_system_log_upload_enabled()) {
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
861 // Notify the observers we are done. 871 // Notify the observers we are done.
862 std::vector<base::Closure> callbacks; 872 std::vector<base::Closure> callbacks;
863 callbacks.swap(callbacks_); 873 callbacks.swap(callbacks_);
864 for (size_t i = 0; i < callbacks.size(); ++i) 874 for (size_t i = 0; i < callbacks.size(); ++i)
865 callbacks[i].Run(); 875 callbacks[i].Run();
866 876
867 return settings_loaded; 877 return settings_loaded;
868 } 878 }
869 879
870 } // namespace chromeos 880 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/policy/proto/chrome_device_policy.proto ('k') | chrome/test/data/policy/policy_test_cases.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698