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 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 EchoPrivateSetOfferInfoFunction::EchoPrivateSetOfferInfoFunction() {} | 90 EchoPrivateSetOfferInfoFunction::EchoPrivateSetOfferInfoFunction() {} |
91 | 91 |
92 EchoPrivateSetOfferInfoFunction::~EchoPrivateSetOfferInfoFunction() {} | 92 EchoPrivateSetOfferInfoFunction::~EchoPrivateSetOfferInfoFunction() {} |
93 | 93 |
94 bool EchoPrivateSetOfferInfoFunction::RunSync() { | 94 bool EchoPrivateSetOfferInfoFunction::RunSync() { |
95 scoped_ptr<echo_api::SetOfferInfo::Params> params = | 95 scoped_ptr<echo_api::SetOfferInfo::Params> params = |
96 echo_api::SetOfferInfo::Params::Create(*args_); | 96 echo_api::SetOfferInfo::Params::Create(*args_); |
97 EXTENSION_FUNCTION_VALIDATE(params); | 97 EXTENSION_FUNCTION_VALIDATE(params); |
98 | 98 |
99 const std::string& service_id = params->id; | 99 const std::string& service_id = params->id; |
100 base::DictionaryValue* dict = params->offer_info. | 100 scoped_ptr<base::DictionaryValue> dict = |
101 additional_properties.DeepCopyWithoutEmptyChildren(); | 101 params->offer_info.additional_properties.DeepCopyWithoutEmptyChildren(); |
102 | 102 |
103 PrefService* local_state = g_browser_process->local_state(); | 103 PrefService* local_state = g_browser_process->local_state(); |
104 DictionaryPrefUpdate offer_update(local_state, prefs::kEchoCheckedOffers); | 104 DictionaryPrefUpdate offer_update(local_state, prefs::kEchoCheckedOffers); |
105 offer_update->SetWithoutPathExpansion("echo." + service_id, dict); | 105 offer_update->SetWithoutPathExpansion("echo." + service_id, dict.Pass()); |
106 return true; | 106 return true; |
107 } | 107 } |
108 | 108 |
109 EchoPrivateGetOfferInfoFunction::EchoPrivateGetOfferInfoFunction() {} | 109 EchoPrivateGetOfferInfoFunction::EchoPrivateGetOfferInfoFunction() {} |
110 | 110 |
111 EchoPrivateGetOfferInfoFunction::~EchoPrivateGetOfferInfoFunction() {} | 111 EchoPrivateGetOfferInfoFunction::~EchoPrivateGetOfferInfoFunction() {} |
112 | 112 |
113 bool EchoPrivateGetOfferInfoFunction::RunSync() { | 113 bool EchoPrivateGetOfferInfoFunction::RunSync() { |
114 scoped_ptr<echo_api::GetOfferInfo::Params> params = | 114 scoped_ptr<echo_api::GetOfferInfo::Params> params = |
115 echo_api::GetOfferInfo::Params::Create(*args_); | 115 echo_api::GetOfferInfo::Params::Create(*args_); |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 void EchoPrivateGetUserConsentFunction::Finalize(bool consent) { | 270 void EchoPrivateGetUserConsentFunction::Finalize(bool consent) { |
271 // Consent should not be true if offers redeeming is disabled. | 271 // Consent should not be true if offers redeeming is disabled. |
272 CHECK(redeem_offers_allowed_ || !consent); | 272 CHECK(redeem_offers_allowed_ || !consent); |
273 results_ = echo_api::GetUserConsent::Results::Create(consent); | 273 results_ = echo_api::GetUserConsent::Results::Create(consent); |
274 SendResponse(true); | 274 SendResponse(true); |
275 | 275 |
276 // Release the reference added in |OnRedeemOffersAllowedChecked|, before | 276 // Release the reference added in |OnRedeemOffersAllowedChecked|, before |
277 // showing the dialog. | 277 // showing the dialog. |
278 Release(); | 278 Release(); |
279 } | 279 } |
OLD | NEW |