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/extensions/api/history/history_api.h" | 5 #include "chrome/browser/extensions/api/history/history_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 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
273 | 273 |
274 bool HistoryFunctionWithCallback::RunImpl() { | 274 bool HistoryFunctionWithCallback::RunImpl() { |
275 AddRef(); // Balanced in SendAysncRepose() and below. | 275 AddRef(); // Balanced in SendAysncRepose() and below. |
276 bool retval = RunAsyncImpl(); | 276 bool retval = RunAsyncImpl(); |
277 if (false == retval) | 277 if (false == retval) |
278 Release(); | 278 Release(); |
279 return retval; | 279 return retval; |
280 } | 280 } |
281 | 281 |
282 void HistoryFunctionWithCallback::SendAsyncResponse() { | 282 void HistoryFunctionWithCallback::SendAsyncResponse() { |
283 MessageLoop::current()->PostTask( | 283 base::MessageLoop::current()->PostTask( |
284 FROM_HERE, | 284 FROM_HERE, |
285 base::Bind(&HistoryFunctionWithCallback::SendResponseToCallback, this)); | 285 base::Bind(&HistoryFunctionWithCallback::SendResponseToCallback, this)); |
286 } | 286 } |
287 | 287 |
288 void HistoryFunctionWithCallback::SendResponseToCallback() { | 288 void HistoryFunctionWithCallback::SendResponseToCallback() { |
289 SendResponse(true); | 289 SendResponse(true); |
290 Release(); // Balanced in RunImpl(). | 290 Release(); // Balanced in RunImpl(). |
291 } | 291 } |
292 | 292 |
293 bool HistoryGetMostVisitedFunction::RunAsyncImpl() { | 293 bool HistoryGetMostVisitedFunction::RunAsyncImpl() { |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
496 &task_tracker_); | 496 &task_tracker_); |
497 | 497 |
498 return true; | 498 return true; |
499 } | 499 } |
500 | 500 |
501 void HistoryDeleteAllFunction::DeleteComplete() { | 501 void HistoryDeleteAllFunction::DeleteComplete() { |
502 SendAsyncResponse(); | 502 SendAsyncResponse(); |
503 } | 503 } |
504 | 504 |
505 } // namespace extensions | 505 } // namespace extensions |
OLD | NEW |