| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/history/history_extension_api.h" | 5 #include "chrome/browser/history/history_extension_api.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/json/json_writer.h" | 10 #include "base/json/json_writer.h" |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 214 AddRef(); // Balanced in SendAysncRepose() and below. | 214 AddRef(); // Balanced in SendAysncRepose() and below. |
| 215 bool retval = RunAsyncImpl(); | 215 bool retval = RunAsyncImpl(); |
| 216 if (false == retval) | 216 if (false == retval) |
| 217 Release(); | 217 Release(); |
| 218 return retval; | 218 return retval; |
| 219 } | 219 } |
| 220 | 220 |
| 221 void HistoryFunctionWithCallback::SendAsyncResponse() { | 221 void HistoryFunctionWithCallback::SendAsyncResponse() { |
| 222 MessageLoop::current()->PostTask( | 222 MessageLoop::current()->PostTask( |
| 223 FROM_HERE, | 223 FROM_HERE, |
| 224 NewRunnableMethod( | 224 base::Bind(&HistoryFunctionWithCallback::SendResponseToCallback, this)); |
| 225 this, | |
| 226 &HistoryFunctionWithCallback::SendResponseToCallback)); | |
| 227 } | 225 } |
| 228 | 226 |
| 229 void HistoryFunctionWithCallback::SendResponseToCallback() { | 227 void HistoryFunctionWithCallback::SendResponseToCallback() { |
| 230 SendResponse(true); | 228 SendResponse(true); |
| 231 Release(); // Balanced in RunImpl(). | 229 Release(); // Balanced in RunImpl(). |
| 232 } | 230 } |
| 233 | 231 |
| 234 bool GetVisitsHistoryFunction::RunAsyncImpl() { | 232 bool GetVisitsHistoryFunction::RunAsyncImpl() { |
| 235 DictionaryValue* json; | 233 DictionaryValue* json; |
| 236 EXTENSION_FUNCTION_VALIDATE(args_->GetDictionary(0, &json)); | 234 EXTENSION_FUNCTION_VALIDATE(args_->GetDictionary(0, &json)); |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 396 &cancelable_consumer_, | 394 &cancelable_consumer_, |
| 397 base::Bind(&DeleteAllHistoryFunction::DeleteComplete, | 395 base::Bind(&DeleteAllHistoryFunction::DeleteComplete, |
| 398 base::Unretained(this))); | 396 base::Unretained(this))); |
| 399 | 397 |
| 400 return true; | 398 return true; |
| 401 } | 399 } |
| 402 | 400 |
| 403 void DeleteAllHistoryFunction::DeleteComplete() { | 401 void DeleteAllHistoryFunction::DeleteComplete() { |
| 404 SendAsyncResponse(); | 402 SendAsyncResponse(); |
| 405 } | 403 } |
| OLD | NEW |