| OLD | NEW |
| 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/extensions/echo_private_api.h" | 5 #include "chrome/browser/chromeos/extensions/echo_private_api.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 std::string result; | 71 std::string result; |
| 72 if (type == kCouponType) { | 72 if (type == kCouponType) { |
| 73 provider->GetMachineStatistic(chromeos::system::kOffersCouponCodeKey, | 73 provider->GetMachineStatistic(chromeos::system::kOffersCouponCodeKey, |
| 74 &result); | 74 &result); |
| 75 } else if (type == kGroupType) { | 75 } else if (type == kGroupType) { |
| 76 provider->GetMachineStatistic(chromeos::system::kOffersGroupCodeKey, | 76 provider->GetMachineStatistic(chromeos::system::kOffersGroupCodeKey, |
| 77 &result); | 77 &result); |
| 78 } | 78 } |
| 79 | 79 |
| 80 results_ = echo_api::GetRegistrationCode::Results::Create(result); | 80 results_ = echo_api::GetRegistrationCode::Results::Create(result); |
| 81 SendResponse(true); | |
| 82 } | 81 } |
| 83 | 82 |
| 84 bool EchoPrivateGetRegistrationCodeFunction::RunSync() { | 83 bool EchoPrivateGetRegistrationCodeFunction::RunSync() { |
| 85 std::unique_ptr<echo_api::GetRegistrationCode::Params> params = | 84 std::unique_ptr<echo_api::GetRegistrationCode::Params> params = |
| 86 echo_api::GetRegistrationCode::Params::Create(*args_); | 85 echo_api::GetRegistrationCode::Params::Create(*args_); |
| 87 EXTENSION_FUNCTION_VALIDATE(params); | 86 EXTENSION_FUNCTION_VALIDATE(params); |
| 88 GetRegistrationCode(params->type); | 87 GetRegistrationCode(params->type); |
| 89 return true; | 88 return true; |
| 90 } | 89 } |
| 91 | 90 |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 272 void EchoPrivateGetUserConsentFunction::Finalize(bool consent) { | 271 void EchoPrivateGetUserConsentFunction::Finalize(bool consent) { |
| 273 // Consent should not be true if offers redeeming is disabled. | 272 // Consent should not be true if offers redeeming is disabled. |
| 274 CHECK(redeem_offers_allowed_ || !consent); | 273 CHECK(redeem_offers_allowed_ || !consent); |
| 275 results_ = echo_api::GetUserConsent::Results::Create(consent); | 274 results_ = echo_api::GetUserConsent::Results::Create(consent); |
| 276 SendResponse(true); | 275 SendResponse(true); |
| 277 | 276 |
| 278 // Release the reference added in |OnRedeemOffersAllowedChecked|, before | 277 // Release the reference added in |OnRedeemOffersAllowedChecked|, before |
| 279 // showing the dialog. | 278 // showing the dialog. |
| 280 Release(); | 279 Release(); |
| 281 } | 280 } |
| OLD | NEW |