| 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..12b165b2d6897423515938361b8e2685a09d2bd9 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,15 +117,9 @@ 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();
|
| + virtual void SendAsyncResponse(ResponseValue response_value);
|
|
|
| // The task tracker for the HistoryService callbacks.
|
| base::CancelableTaskTracker task_tracker_;
|
| @@ -128,7 +127,7 @@ class HistoryFunctionWithCallback : public HistoryFunction {
|
| private:
|
| // The actual call to SendResponse. This is required since the semantics for
|
| // CancelableRequestConsumerT require it to be accessed after the call.
|
| - void SendResponseToCallback();
|
| + void SendResponseToCallback(ResponseValue response_value);
|
| };
|
|
|
| class HistoryGetVisitsFunction : public HistoryFunctionWithCallback {
|
| @@ -138,8 +137,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 +153,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 +167,8 @@ class HistoryAddUrlFunction : public HistoryFunction {
|
| protected:
|
| ~HistoryAddUrlFunction() override {}
|
|
|
| - // HistoryFunctionWithCallback:
|
| - bool RunAsync() override;
|
| + // ExtensionFunction:
|
| + ResponseAction Run() override;
|
| };
|
|
|
| class HistoryDeleteAllFunction : public HistoryFunctionWithCallback {
|
| @@ -179,8 +178,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 +193,8 @@ class HistoryDeleteUrlFunction : public HistoryFunction {
|
| protected:
|
| ~HistoryDeleteUrlFunction() override {}
|
|
|
| - // HistoryFunctionWithCallback:
|
| - bool RunAsync() override;
|
| + // ExtensionFunction:
|
| + ResponseAction Run() override;
|
| };
|
|
|
| class HistoryDeleteRangeFunction : public HistoryFunctionWithCallback {
|
| @@ -205,8 +204,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();
|
|
|