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

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

Issue 9704092: Adds a device policy to specify the set of initial urls for the demo user account. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 9 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
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/device_settings_provider.h" 5 #include "chrome/browser/chromeos/device_settings_provider.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/file_util.h" 10 #include "base/file_util.h"
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 kIdleLogoutWarningDuration, 48 kIdleLogoutWarningDuration,
49 kReleaseChannel, 49 kReleaseChannel,
50 kReleaseChannelDelegated, 50 kReleaseChannelDelegated,
51 kReportDeviceActivityTimes, 51 kReportDeviceActivityTimes,
52 kReportDeviceBootMode, 52 kReportDeviceBootMode,
53 kReportDeviceVersionInfo, 53 kReportDeviceVersionInfo,
54 kScreenSaverExtensionId, 54 kScreenSaverExtensionId,
55 kScreenSaverTimeout, 55 kScreenSaverTimeout,
56 kSettingProxyEverywhere, 56 kSettingProxyEverywhere,
57 kSignedDataRoamingEnabled, 57 kSignedDataRoamingEnabled,
58 kStartUpUrls,
58 kStatsReportingPref, 59 kStatsReportingPref,
59 }; 60 };
60 61
61 // Upper bound for number of retries to fetch a signed setting. 62 // Upper bound for number of retries to fetch a signed setting.
62 static const int kNumRetriesLimit = 9; 63 static const int kNumRetriesLimit = 9;
63 64
64 // Legacy policy file location. Used to detect migration from pre v12 ChromeOS. 65 // Legacy policy file location. Used to detect migration from pre v12 ChromeOS.
65 const char kLegacyPolicyFile[] = "/var/lib/whitelist/preferences"; 66 const char kLegacyPolicyFile[] = "/var/lib/whitelist/preferences";
66 67
67 bool IsControlledSetting(const std::string& pref_path) { 68 bool IsControlledSetting(const std::string& pref_path) {
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 // intended to be customizable by the user: 283 // intended to be customizable by the user:
283 // kAppPack 284 // kAppPack
284 // kIdleLogoutTimeout, 285 // kIdleLogoutTimeout,
285 // kIdleLogoutWarningDuration, 286 // kIdleLogoutWarningDuration,
286 // kReleaseChannelDelegated, 287 // kReleaseChannelDelegated,
287 // kReportDeviceVersionInfo 288 // kReportDeviceVersionInfo
288 // kReportDeviceActivityTimes 289 // kReportDeviceActivityTimes
289 // kReportDeviceBootMode 290 // kReportDeviceBootMode
290 // kScreenSaverExtensionId, 291 // kScreenSaverExtensionId,
291 // kScreenSaverTimeout, 292 // kScreenSaverTimeout,
293 // kStartUpUrls
292 294
293 NOTREACHED(); 295 NOTREACHED();
294 } 296 }
295 data.set_policy_value(pol.SerializeAsString()); 297 data.set_policy_value(pol.SerializeAsString());
296 // Set the cache to the updated value. 298 // Set the cache to the updated value.
297 policy_ = data; 299 policy_ = data;
298 UpdateValuesCache(); 300 UpdateValuesCache();
299 301
300 if (!signed_settings_cache::Store(data, g_browser_process->local_state())) 302 if (!signed_settings_cache::Store(data, g_browser_process->local_state()))
301 LOG(ERROR) << "Couldn't store to the temp storage."; 303 LOG(ERROR) << "Couldn't store to the temp storage.";
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
431 if (it->has_update_url()) 433 if (it->has_update_url())
432 entry->SetString(policy::AppPackUpdater::kUpdateUrl, it->update_url()); 434 entry->SetString(policy::AppPackUpdater::kUpdateUrl, it->update_url());
433 if (it->has_online_only()) { 435 if (it->has_online_only()) {
434 entry->SetBoolean(policy::AppPackUpdater::kOnlineOnly, 436 entry->SetBoolean(policy::AppPackUpdater::kOnlineOnly,
435 it->online_only()); 437 it->online_only());
436 } 438 }
437 list->Append(entry); 439 list->Append(entry);
438 } 440 }
439 new_values_cache->SetValue(kAppPack, list); 441 new_values_cache->SetValue(kAppPack, list);
440 } 442 }
443
444 base::ListValue* list = new base::ListValue();
445 const em::StartUpUrlsProto& urls_proto = policy.start_up_urls();
446 const RepeatedPtrField<std::string>& urls = urls_proto.start_up_urls();
447 for (RepeatedPtrField<std::string>::const_iterator it = urls.begin();
448 it != urls.end(); ++it) {
449 list->Append(base::Value::CreateStringValue(*it));
450 }
451 new_values_cache->SetValue(kStartUpUrls, list);
Joao da Silva 2012/03/16 15:55:18 Wrap this block with if (policy.has_start_up_urls(
pastarmovj 2012/03/19 14:20:49 Done.
441 } 452 }
442 453
443 void DeviceSettingsProvider::DecodeNetworkPolicies( 454 void DeviceSettingsProvider::DecodeNetworkPolicies(
444 const em::ChromeDeviceSettingsProto& policy, 455 const em::ChromeDeviceSettingsProto& policy,
445 PrefValueMap* new_values_cache) const { 456 PrefValueMap* new_values_cache) const {
446 new_values_cache->SetBoolean( 457 new_values_cache->SetBoolean(
447 kSignedDataRoamingEnabled, 458 kSignedDataRoamingEnabled,
448 policy.has_data_roaming_enabled() && 459 policy.has_data_roaming_enabled() &&
449 policy.data_roaming_enabled().has_data_roaming_enabled() && 460 policy.data_roaming_enabled().has_data_roaming_enabled() &&
450 policy.data_roaming_enabled().data_roaming_enabled()); 461 policy.data_roaming_enabled().data_roaming_enabled());
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
722 Reload(); 733 Reload();
723 return; 734 return;
724 } 735 }
725 LOG(ERROR) << "No retries left"; 736 LOG(ERROR) << "No retries left";
726 break; 737 break;
727 } 738 }
728 } 739 }
729 } 740 }
730 741
731 } // namespace chromeos 742 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698