| Index: chrome/browser/extensions/api/history/history_api.h
|
| diff --git a/chrome/browser/extensions/api/history/history_api.h b/chrome/browser/extensions/api/history/history_api.h
|
| index bfbb014049e802dc750f75907971f36cc989c6d0..f6b74f78d0195a28b5c19b781dfa6ecd8f4a9170 100644
|
| --- a/chrome/browser/extensions/api/history/history_api.h
|
| +++ b/chrome/browser/extensions/api/history/history_api.h
|
| @@ -12,11 +12,13 @@
|
| #include "base/macros.h"
|
| #include "base/scoped_observer.h"
|
| #include "base/task/cancelable_task_tracker.h"
|
| -#include "chrome/browser/extensions/chrome_extension_function.h"
|
| #include "chrome/common/extensions/api/history.h"
|
| #include "components/history/core/browser/history_service_observer.h"
|
| #include "extensions/browser/browser_context_keyed_api_factory.h"
|
| #include "extensions/browser/event_router.h"
|
| +#include "extensions/browser/extension_function.h"
|
| +
|
| +class Profile;
|
|
|
| namespace base {
|
| class ListValue;
|
| @@ -94,13 +96,16 @@ template <>
|
| void BrowserContextKeyedAPIFactory<HistoryAPI>::DeclareFactoryDependencies();
|
|
|
| // Base class for history function APIs.
|
| -class HistoryFunction : public ChromeAsyncExtensionFunction {
|
| +class HistoryFunction : public UIThreadExtensionFunction {
|
| protected:
|
| ~HistoryFunction() override {}
|
|
|
| - bool ValidateUrl(const std::string& url_string, GURL* url);
|
| - bool VerifyDeleteAllowed();
|
| + bool ValidateUrl(const std::string& url_string,
|
| + GURL* url,
|
| + std::string* error);
|
| + bool VerifyDeleteAllowed(std::string* error);
|
| base::Time GetTime(double ms_from_epoch);
|
| + Profile* GetProfile() const;
|
| };
|
|
|
| // Base class for history funciton APIs which require async interaction with
|
| @@ -112,23 +117,8 @@ class HistoryFunctionWithCallback : public HistoryFunction {
|
| protected:
|
| ~HistoryFunctionWithCallback() override;
|
|
|
| - // ExtensionFunction:
|
| - bool RunAsync() override;
|
| -
|
| - // Return true if the async call was completed, false otherwise.
|
| - virtual bool RunAsyncImpl() = 0;
|
| -
|
| - // Call this method to report the results of the async method to the caller.
|
| - // This method calls Release().
|
| - virtual void SendAsyncResponse();
|
| -
|
| // The task tracker for the HistoryService callbacks.
|
| base::CancelableTaskTracker task_tracker_;
|
| -
|
| - private:
|
| - // The actual call to SendResponse. This is required since the semantics for
|
| - // CancelableRequestConsumerT require it to be accessed after the call.
|
| - void SendResponseToCallback();
|
| };
|
|
|
| class HistoryGetVisitsFunction : public HistoryFunctionWithCallback {
|
| @@ -138,8 +128,8 @@ class HistoryGetVisitsFunction : public HistoryFunctionWithCallback {
|
| protected:
|
| ~HistoryGetVisitsFunction() override {}
|
|
|
| - // HistoryFunctionWithCallback:
|
| - bool RunAsyncImpl() override;
|
| + // ExtensionFunction:
|
| + ResponseAction Run() override;
|
|
|
| // Callback for the history function to provide results.
|
| void QueryComplete(bool success,
|
| @@ -154,8 +144,8 @@ class HistorySearchFunction : public HistoryFunctionWithCallback {
|
| protected:
|
| ~HistorySearchFunction() override {}
|
|
|
| - // HistoryFunctionWithCallback:
|
| - bool RunAsyncImpl() override;
|
| + // ExtensionFunction:
|
| + ResponseAction Run() override;
|
|
|
| // Callback for the history function to provide results.
|
| void SearchComplete(history::QueryResults* results);
|
| @@ -168,8 +158,8 @@ class HistoryAddUrlFunction : public HistoryFunction {
|
| protected:
|
| ~HistoryAddUrlFunction() override {}
|
|
|
| - // HistoryFunctionWithCallback:
|
| - bool RunAsync() override;
|
| + // ExtensionFunction:
|
| + ResponseAction Run() override;
|
| };
|
|
|
| class HistoryDeleteAllFunction : public HistoryFunctionWithCallback {
|
| @@ -179,8 +169,8 @@ class HistoryDeleteAllFunction : public HistoryFunctionWithCallback {
|
| protected:
|
| ~HistoryDeleteAllFunction() override {}
|
|
|
| - // HistoryFunctionWithCallback:
|
| - bool RunAsyncImpl() override;
|
| + // ExtensionFunction:
|
| + ResponseAction Run() override;
|
|
|
| // Callback for the history service to acknowledge deletion.
|
| void DeleteComplete();
|
| @@ -194,8 +184,8 @@ class HistoryDeleteUrlFunction : public HistoryFunction {
|
| protected:
|
| ~HistoryDeleteUrlFunction() override {}
|
|
|
| - // HistoryFunctionWithCallback:
|
| - bool RunAsync() override;
|
| + // ExtensionFunction:
|
| + ResponseAction Run() override;
|
| };
|
|
|
| class HistoryDeleteRangeFunction : public HistoryFunctionWithCallback {
|
| @@ -205,8 +195,8 @@ class HistoryDeleteRangeFunction : public HistoryFunctionWithCallback {
|
| protected:
|
| ~HistoryDeleteRangeFunction() override {}
|
|
|
| - // HistoryFunctionWithCallback:
|
| - bool RunAsyncImpl() override;
|
| + // ExtensionFunction:
|
| + ResponseAction Run() override;
|
|
|
| // Callback for the history service to acknowledge deletion.
|
| void DeleteComplete();
|
|
|