| 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 #ifndef CHROME_BROWSER_EXTENSIONS_API_HISTORY_HISTORY_API_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_HISTORY_HISTORY_API_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_API_HISTORY_HISTORY_API_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_API_HISTORY_HISTORY_API_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
| 12 #include "base/task/cancelable_task_tracker.h" |
| 12 #include "chrome/browser/extensions/api/profile_keyed_api_factory.h" | 13 #include "chrome/browser/extensions/api/profile_keyed_api_factory.h" |
| 13 #include "chrome/browser/extensions/chrome_extension_function.h" | 14 #include "chrome/browser/extensions/chrome_extension_function.h" |
| 14 #include "chrome/browser/history/history_notifications.h" | 15 #include "chrome/browser/history/history_notifications.h" |
| 15 #include "chrome/browser/history/history_service.h" | 16 #include "chrome/browser/history/history_service.h" |
| 16 #include "chrome/common/cancelable_task_tracker.h" | |
| 17 #include "chrome/common/extensions/api/history.h" | 17 #include "chrome/common/extensions/api/history.h" |
| 18 #include "content/public/browser/notification_registrar.h" | 18 #include "content/public/browser/notification_registrar.h" |
| 19 #include "extensions/browser/event_router.h" | 19 #include "extensions/browser/event_router.h" |
| 20 | 20 |
| 21 namespace base { | 21 namespace base { |
| 22 class ListValue; | 22 class ListValue; |
| 23 } | 23 } |
| 24 | 24 |
| 25 namespace extensions { | 25 namespace extensions { |
| 26 | 26 |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 | 111 |
| 112 // Return true if the async call was completed, false otherwise. | 112 // Return true if the async call was completed, false otherwise. |
| 113 virtual bool RunAsyncImpl() = 0; | 113 virtual bool RunAsyncImpl() = 0; |
| 114 | 114 |
| 115 // Call this method to report the results of the async method to the caller. | 115 // Call this method to report the results of the async method to the caller. |
| 116 // This method calls Release(). | 116 // This method calls Release(). |
| 117 virtual void SendAsyncResponse(); | 117 virtual void SendAsyncResponse(); |
| 118 | 118 |
| 119 // The consumer for the HistoryService callbacks. | 119 // The consumer for the HistoryService callbacks. |
| 120 CancelableRequestConsumer cancelable_consumer_; | 120 CancelableRequestConsumer cancelable_consumer_; |
| 121 CancelableTaskTracker task_tracker_; | 121 base::CancelableTaskTracker task_tracker_; |
| 122 | 122 |
| 123 private: | 123 private: |
| 124 // The actual call to SendResponse. This is required since the semantics for | 124 // The actual call to SendResponse. This is required since the semantics for |
| 125 // CancelableRequestConsumerT require it to be accessed after the call. | 125 // CancelableRequestConsumerT require it to be accessed after the call. |
| 126 void SendResponseToCallback(); | 126 void SendResponseToCallback(); |
| 127 }; | 127 }; |
| 128 | 128 |
| 129 class HistoryGetVisitsFunction : public HistoryFunctionWithCallback { | 129 class HistoryGetVisitsFunction : public HistoryFunctionWithCallback { |
| 130 public: | 130 public: |
| 131 DECLARE_EXTENSION_FUNCTION("history.getVisits", HISTORY_GETVISITS) | 131 DECLARE_EXTENSION_FUNCTION("history.getVisits", HISTORY_GETVISITS) |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 // HistoryFunctionWithCallback: | 205 // HistoryFunctionWithCallback: |
| 206 virtual bool RunAsyncImpl() OVERRIDE; | 206 virtual bool RunAsyncImpl() OVERRIDE; |
| 207 | 207 |
| 208 // Callback for the history service to acknowledge deletion. | 208 // Callback for the history service to acknowledge deletion. |
| 209 void DeleteComplete(); | 209 void DeleteComplete(); |
| 210 }; | 210 }; |
| 211 | 211 |
| 212 } // namespace extensions | 212 } // namespace extensions |
| 213 | 213 |
| 214 #endif // CHROME_BROWSER_EXTENSIONS_API_HISTORY_HISTORY_API_H_ | 214 #endif // CHROME_BROWSER_EXTENSIONS_API_HISTORY_HISTORY_API_H_ |
| OLD | NEW |