Index: chrome/browser/chromeos/extensions/echo_private_api.cc |
diff --git a/chrome/browser/chromeos/extensions/echo_private_api.cc b/chrome/browser/chromeos/extensions/echo_private_api.cc |
index 51f195dbf4e0e44638fb24e52fb98891c716a1bf..665509bd9b8f87e661c83254257faeb31c73a5d1 100644 |
--- a/chrome/browser/chromeos/extensions/echo_private_api.cc |
+++ b/chrome/browser/chromeos/extensions/echo_private_api.cc |
@@ -14,6 +14,7 @@ |
#include "base/time.h" |
#include "base/values.h" |
#include "chrome/browser/chromeos/kiosk_mode/kiosk_mode_settings.h" |
+#include "chrome/browser/chromeos/settings/cros_settings.h" |
#include "chrome/browser/chromeos/system/statistics_provider.h" |
#include "chrome/common/extensions/extension.h" |
#include "content/public/browser/browser_thread.h" |
@@ -34,6 +35,7 @@ base::Value* GetValueForRegistrationCodeType(std::string& type) { |
chromeos::system::StatisticsProvider* provider = |
chromeos::system::StatisticsProvider::GetInstance(); |
std::string result; |
+ // TODO(oscarpan) update to use PrepareTrustedValues. |
Mattias Nissler (ping if slow)
2013/02/07 10:45:57
still missing a policy check here?
oscarpan
2013/02/07 13:10:56
Done.
|
if (!chromeos::KioskModeSettings::Get()->IsKioskModeEnabled()) { |
// In Kiosk mode, we effectively disable the registration API |
// by always returning an empty code. |
@@ -98,3 +100,34 @@ bool GetOobeTimestampFunction::GetOobeTimestampOnFileThread() { |
SetResult(new base::StringValue(timestamp)); |
return true; |
} |
+ |
+AllowRedeemOffersFunction::AllowRedeemOffersFunction() { |
+} |
+ |
+AllowRedeemOffersFunction::~AllowRedeemOffersFunction() { |
+} |
+ |
+void AllowRedeemOffersFunction::AllowRedeemOffersCallback() { |
+ chromeos::CrosSettingsProvider::TrustedStatus status = |
+ chromeos::CrosSettings::Get()->PrepareTrustedValues( |
+ base::Bind(&AllowRedeemOffersFunction::AllowRedeemOffersCallback, |
+ base::Unretained(this))); |
+ if (status == chromeos::CrosSettingsProvider::TEMPORARILY_UNTRUSTED) { |
Mattias Nissler (ping if slow)
2013/02/07 10:45:57
nit: no need for curly braces.
oscarpan
2013/02/07 13:10:56
Done.
|
+ return; |
+ } |
+ bool allow; |
+ if (!chromeos::CrosSettings::Get()->GetBoolean( |
+ chromeos::kAllowRedeemChromeOsRegistrationOffers, &allow)) { |
+ allow = true; |
+ } |
+ SetResult(new base::FundamentalValue(allow)); |
+ SendResponse(true); |
+} |
+ |
+// Check the enterprise policy kAllowRedeemChromeOsRegistrationOffers flag |
+// value. This policy is used to control whether user can redeem offers using |
+// enterprise device. |
+bool AllowRedeemOffersFunction::RunImpl() { |
+ AllowRedeemOffersCallback(); |
+ return true; |
+} |