| 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 |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 // The consumer for the HistoryService callbacks. | 105 // The consumer for the HistoryService callbacks. |
| 106 CancelableRequestConsumer cancelable_consumer_; | 106 CancelableRequestConsumer cancelable_consumer_; |
| 107 CancelableTaskTracker task_tracker_; | 107 CancelableTaskTracker task_tracker_; |
| 108 | 108 |
| 109 private: | 109 private: |
| 110 // The actual call to SendResponse. This is required since the semantics for | 110 // The actual call to SendResponse. This is required since the semantics for |
| 111 // CancelableRequestConsumerT require it to be accessed after the call. | 111 // CancelableRequestConsumerT require it to be accessed after the call. |
| 112 void SendResponseToCallback(); | 112 void SendResponseToCallback(); |
| 113 }; | 113 }; |
| 114 | 114 |
| 115 class GetMostVisitedHistoryFunction : public HistoryFunctionWithCallback { | 115 class HistoryGetMostVisitedFunction : public HistoryFunctionWithCallback { |
| 116 public: | 116 public: |
| 117 DECLARE_EXTENSION_FUNCTION_NAME("experimental.history.getMostVisited"); | 117 DECLARE_EXTENSION_FUNCTION_NAME("experimental.history.getMostVisited"); |
| 118 | 118 |
| 119 protected: | 119 protected: |
| 120 virtual ~GetMostVisitedHistoryFunction() {} | 120 virtual ~HistoryGetMostVisitedFunction() {} |
| 121 | 121 |
| 122 // HistoryFunctionWithCallback: | 122 // HistoryFunctionWithCallback: |
| 123 virtual bool RunAsyncImpl() OVERRIDE; | 123 virtual bool RunAsyncImpl() OVERRIDE; |
| 124 | 124 |
| 125 // Callback for the history function to provide results. | 125 // Callback for the history function to provide results. |
| 126 void QueryComplete(CancelableRequestProvider::Handle handle, | 126 void QueryComplete(CancelableRequestProvider::Handle handle, |
| 127 const history::FilteredURLList& data); | 127 const history::FilteredURLList& data); |
| 128 }; | 128 }; |
| 129 | 129 |
| 130 class GetVisitsHistoryFunction : public HistoryFunctionWithCallback { | 130 class HistoryGetVisitsFunction : public HistoryFunctionWithCallback { |
| 131 public: | 131 public: |
| 132 DECLARE_EXTENSION_FUNCTION_NAME("history.getVisits"); | 132 DECLARE_EXTENSION_FUNCTION_NAME("history.getVisits"); |
| 133 | 133 |
| 134 protected: | 134 protected: |
| 135 virtual ~GetVisitsHistoryFunction() {} | 135 virtual ~HistoryGetVisitsFunction() {} |
| 136 | 136 |
| 137 // HistoryFunctionWithCallback: | 137 // HistoryFunctionWithCallback: |
| 138 virtual bool RunAsyncImpl() OVERRIDE; | 138 virtual bool RunAsyncImpl() OVERRIDE; |
| 139 | 139 |
| 140 // Callback for the history function to provide results. | 140 // Callback for the history function to provide results. |
| 141 void QueryComplete(HistoryService::Handle request_service, | 141 void QueryComplete(HistoryService::Handle request_service, |
| 142 bool success, | 142 bool success, |
| 143 const history::URLRow* url_row, | 143 const history::URLRow* url_row, |
| 144 history::VisitVector* visits); | 144 history::VisitVector* visits); |
| 145 }; | 145 }; |
| 146 | 146 |
| 147 class SearchHistoryFunction : public HistoryFunctionWithCallback { | 147 class HistorySearchFunction : public HistoryFunctionWithCallback { |
| 148 public: | 148 public: |
| 149 DECLARE_EXTENSION_FUNCTION_NAME("history.search"); | 149 DECLARE_EXTENSION_FUNCTION_NAME("history.search"); |
| 150 | 150 |
| 151 protected: | 151 protected: |
| 152 virtual ~SearchHistoryFunction() {} | 152 virtual ~HistorySearchFunction() {} |
| 153 | 153 |
| 154 // HistoryFunctionWithCallback: | 154 // HistoryFunctionWithCallback: |
| 155 virtual bool RunAsyncImpl() OVERRIDE; | 155 virtual bool RunAsyncImpl() OVERRIDE; |
| 156 | 156 |
| 157 // Callback for the history function to provide results. | 157 // Callback for the history function to provide results. |
| 158 void SearchComplete(HistoryService::Handle request_handle, | 158 void SearchComplete(HistoryService::Handle request_handle, |
| 159 history::QueryResults* results); | 159 history::QueryResults* results); |
| 160 }; | 160 }; |
| 161 | 161 |
| 162 class AddUrlHistoryFunction : public HistoryFunction { | 162 class HistoryAddUrlFunction : public HistoryFunction { |
| 163 public: | 163 public: |
| 164 DECLARE_EXTENSION_FUNCTION_NAME("history.addUrl"); | 164 DECLARE_EXTENSION_FUNCTION_NAME("history.addUrl"); |
| 165 | 165 |
| 166 protected: | 166 protected: |
| 167 virtual ~AddUrlHistoryFunction() {} | 167 virtual ~HistoryAddUrlFunction() {} |
| 168 | 168 |
| 169 // HistoryFunctionWithCallback: | 169 // HistoryFunctionWithCallback: |
| 170 virtual bool RunImpl() OVERRIDE; | 170 virtual bool RunImpl() OVERRIDE; |
| 171 }; | 171 }; |
| 172 | 172 |
| 173 class DeleteAllHistoryFunction : public HistoryFunctionWithCallback { | 173 class HistoryDeleteAllFunction : public HistoryFunctionWithCallback { |
| 174 public: | 174 public: |
| 175 DECLARE_EXTENSION_FUNCTION_NAME("history.deleteAll"); | 175 DECLARE_EXTENSION_FUNCTION_NAME("history.deleteAll"); |
| 176 | 176 |
| 177 protected: | 177 protected: |
| 178 virtual ~DeleteAllHistoryFunction() {} | 178 virtual ~HistoryDeleteAllFunction() {} |
| 179 | 179 |
| 180 // HistoryFunctionWithCallback: | 180 // HistoryFunctionWithCallback: |
| 181 virtual bool RunAsyncImpl() OVERRIDE; | 181 virtual bool RunAsyncImpl() OVERRIDE; |
| 182 | 182 |
| 183 // Callback for the history service to acknowledge deletion. | 183 // Callback for the history service to acknowledge deletion. |
| 184 void DeleteComplete(); | 184 void DeleteComplete(); |
| 185 }; | 185 }; |
| 186 | 186 |
| 187 | 187 |
| 188 class DeleteUrlHistoryFunction : public HistoryFunction { | 188 class HistoryDeleteUrlFunction : public HistoryFunction { |
| 189 public: | 189 public: |
| 190 DECLARE_EXTENSION_FUNCTION_NAME("history.deleteUrl"); | 190 DECLARE_EXTENSION_FUNCTION_NAME("history.deleteUrl"); |
| 191 | 191 |
| 192 protected: | 192 protected: |
| 193 virtual ~DeleteUrlHistoryFunction() {} | 193 virtual ~HistoryDeleteUrlFunction() {} |
| 194 | 194 |
| 195 // HistoryFunctionWithCallback: | 195 // HistoryFunctionWithCallback: |
| 196 virtual bool RunImpl() OVERRIDE; | 196 virtual bool RunImpl() OVERRIDE; |
| 197 }; | 197 }; |
| 198 | 198 |
| 199 class DeleteRangeHistoryFunction : public HistoryFunctionWithCallback { | 199 class HistoryDeleteRangeFunction : public HistoryFunctionWithCallback { |
| 200 public: | 200 public: |
| 201 DECLARE_EXTENSION_FUNCTION_NAME("history.deleteRange"); | 201 DECLARE_EXTENSION_FUNCTION_NAME("history.deleteRange"); |
| 202 | 202 |
| 203 protected: | 203 protected: |
| 204 virtual ~DeleteRangeHistoryFunction() {} | 204 virtual ~HistoryDeleteRangeFunction() {} |
| 205 | 205 |
| 206 // HistoryFunctionWithCallback: | 206 // HistoryFunctionWithCallback: |
| 207 virtual bool RunAsyncImpl() OVERRIDE; | 207 virtual bool RunAsyncImpl() OVERRIDE; |
| 208 | 208 |
| 209 // Callback for the history service to acknowledge deletion. | 209 // Callback for the history service to acknowledge deletion. |
| 210 void DeleteComplete(); | 210 void DeleteComplete(); |
| 211 }; | 211 }; |
| 212 | 212 |
| 213 } // namespace extensions | 213 } // namespace extensions |
| 214 | 214 |
| 215 #endif // CHROME_BROWSER_EXTENSIONS_API_HISTORY_HISTORY_API_H_ | 215 #endif // CHROME_BROWSER_EXTENSIONS_API_HISTORY_HISTORY_API_H_ |
| OLD | NEW |