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/file_util.h" | 10 #include "base/file_util.h" |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 results_ = echo_api::GetOfferInfo::Results::Create(result); | 143 results_ = echo_api::GetOfferInfo::Results::Create(result); |
144 return true; | 144 return true; |
145 } | 145 } |
146 | 146 |
147 EchoPrivateGetOobeTimestampFunction::EchoPrivateGetOobeTimestampFunction() { | 147 EchoPrivateGetOobeTimestampFunction::EchoPrivateGetOobeTimestampFunction() { |
148 } | 148 } |
149 | 149 |
150 EchoPrivateGetOobeTimestampFunction::~EchoPrivateGetOobeTimestampFunction() { | 150 EchoPrivateGetOobeTimestampFunction::~EchoPrivateGetOobeTimestampFunction() { |
151 } | 151 } |
152 | 152 |
153 bool EchoPrivateGetOobeTimestampFunction::RunImpl() { | 153 bool EchoPrivateGetOobeTimestampFunction::RunAsync() { |
154 BrowserThread::PostTaskAndReplyWithResult( | 154 BrowserThread::PostTaskAndReplyWithResult( |
155 BrowserThread::FILE, FROM_HERE, | 155 BrowserThread::FILE, FROM_HERE, |
156 base::Bind( | 156 base::Bind( |
157 &EchoPrivateGetOobeTimestampFunction::GetOobeTimestampOnFileThread, | 157 &EchoPrivateGetOobeTimestampFunction::GetOobeTimestampOnFileThread, |
158 this), | 158 this), |
159 base::Bind( | 159 base::Bind( |
160 &EchoPrivateGetOobeTimestampFunction::SendResponse, this)); | 160 &EchoPrivateGetOobeTimestampFunction::SendResponse, this)); |
161 return true; | 161 return true; |
162 } | 162 } |
163 | 163 |
(...skipping 28 matching lines...) Expand all Loading... |
192 EchoPrivateGetUserConsentFunction::CreateForTest( | 192 EchoPrivateGetUserConsentFunction::CreateForTest( |
193 const DialogShownTestCallback& dialog_shown_callback) { | 193 const DialogShownTestCallback& dialog_shown_callback) { |
194 scoped_refptr<EchoPrivateGetUserConsentFunction> function( | 194 scoped_refptr<EchoPrivateGetUserConsentFunction> function( |
195 new EchoPrivateGetUserConsentFunction()); | 195 new EchoPrivateGetUserConsentFunction()); |
196 function->dialog_shown_callback_ = dialog_shown_callback; | 196 function->dialog_shown_callback_ = dialog_shown_callback; |
197 return function; | 197 return function; |
198 } | 198 } |
199 | 199 |
200 EchoPrivateGetUserConsentFunction::~EchoPrivateGetUserConsentFunction() {} | 200 EchoPrivateGetUserConsentFunction::~EchoPrivateGetUserConsentFunction() {} |
201 | 201 |
202 bool EchoPrivateGetUserConsentFunction::RunImpl() { | 202 bool EchoPrivateGetUserConsentFunction::RunAsync() { |
203 CheckRedeemOffersAllowed(); | 203 CheckRedeemOffersAllowed(); |
204 return true; | 204 return true; |
205 } | 205 } |
206 | 206 |
207 void EchoPrivateGetUserConsentFunction::OnAccept() { | 207 void EchoPrivateGetUserConsentFunction::OnAccept() { |
208 Finalize(true); | 208 Finalize(true); |
209 } | 209 } |
210 | 210 |
211 void EchoPrivateGetUserConsentFunction::OnCancel() { | 211 void EchoPrivateGetUserConsentFunction::OnCancel() { |
212 Finalize(false); | 212 Finalize(false); |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 void EchoPrivateGetUserConsentFunction::Finalize(bool consent) { | 274 void EchoPrivateGetUserConsentFunction::Finalize(bool consent) { |
275 // Consent should not be true if offers redeeming is disabled. | 275 // Consent should not be true if offers redeeming is disabled. |
276 CHECK(redeem_offers_allowed_ || !consent); | 276 CHECK(redeem_offers_allowed_ || !consent); |
277 results_ = echo_api::GetUserConsent::Results::Create(consent); | 277 results_ = echo_api::GetUserConsent::Results::Create(consent); |
278 SendResponse(true); | 278 SendResponse(true); |
279 | 279 |
280 // Release the reference added in |OnRedeemOffersAllowedChecked|, before | 280 // Release the reference added in |OnRedeemOffersAllowedChecked|, before |
281 // showing the dialog. | 281 // showing the dialog. |
282 Release(); | 282 Release(); |
283 } | 283 } |
OLD | NEW |