Commit edde9ce6 authored by Ella Ge's avatar Ella Ge Committed by Chromium LUCI CQ

Convert c/b/ui/webui/history from base::Bind to Once/Repeating

Bug: 1152282
Change-Id: I73c28fbaccb8d8c82402952730ffa1ac04423d09
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2601223Reviewed-by: default avatarJohn Lee <johntlee@chromium.org>
Commit-Queue: Ella Ge <eirage@chromium.org>
Cr-Commit-Position: refs/heads/master@{#839498}
parent a2db6922
...@@ -155,7 +155,7 @@ class BrowsingHistoryHandlerTest : public ChromeRenderViewHostTestHarness { ...@@ -155,7 +155,7 @@ class BrowsingHistoryHandlerTest : public ChromeRenderViewHostTestHarness {
// Tests that BrowsingHistoryHandler is informed about WebHistoryService // Tests that BrowsingHistoryHandler is informed about WebHistoryService
// deletions. // deletions.
TEST_F(BrowsingHistoryHandlerTest, ObservingWebHistoryDeletions) { TEST_F(BrowsingHistoryHandlerTest, ObservingWebHistoryDeletions) {
base::Callback<void(bool)> callback = base::DoNothing(); base::RepeatingCallback<void(bool)> callback = base::DoNothing();
// BrowsingHistoryHandler is informed about WebHistoryService history // BrowsingHistoryHandler is informed about WebHistoryService history
// deletions. // deletions.
......
...@@ -17,8 +17,8 @@ ...@@ -17,8 +17,8 @@
#include "content/public/browser/web_contents.h" #include "content/public/browser/web_contents.h"
#include "content/public/browser/web_ui.h" #include "content/public/browser/web_ui.h"
HistoryLoginHandler::HistoryLoginHandler(const base::Closure& signin_callback) HistoryLoginHandler::HistoryLoginHandler(base::RepeatingClosure signin_callback)
: signin_callback_(signin_callback) {} : signin_callback_(std::move(signin_callback)) {}
HistoryLoginHandler::~HistoryLoginHandler() {} HistoryLoginHandler::~HistoryLoginHandler() {}
...@@ -37,8 +37,8 @@ void HistoryLoginHandler::RegisterMessages() { ...@@ -37,8 +37,8 @@ void HistoryLoginHandler::RegisterMessages() {
void HistoryLoginHandler::OnJavascriptAllowed() { void HistoryLoginHandler::OnJavascriptAllowed() {
profile_info_watcher_ = std::make_unique<ProfileInfoWatcher>( profile_info_watcher_ = std::make_unique<ProfileInfoWatcher>(
Profile::FromWebUI(web_ui()), Profile::FromWebUI(web_ui()),
base::Bind(&HistoryLoginHandler::ProfileInfoChanged, base::BindRepeating(&HistoryLoginHandler::ProfileInfoChanged,
base::Unretained(this))); base::Unretained(this)));
ProfileInfoChanged(); ProfileInfoChanged();
} }
......
...@@ -16,7 +16,7 @@ class ProfileInfoWatcher; ...@@ -16,7 +16,7 @@ class ProfileInfoWatcher;
// The handler for login-related messages from chrome://history. // The handler for login-related messages from chrome://history.
class HistoryLoginHandler : public content::WebUIMessageHandler { class HistoryLoginHandler : public content::WebUIMessageHandler {
public: public:
explicit HistoryLoginHandler(const base::Closure& signin_callback); explicit HistoryLoginHandler(base::RepeatingClosure signin_callback);
~HistoryLoginHandler() override; ~HistoryLoginHandler() override;
// WebUIMessageHandler implementation. // WebUIMessageHandler implementation.
...@@ -38,7 +38,7 @@ class HistoryLoginHandler : public content::WebUIMessageHandler { ...@@ -38,7 +38,7 @@ class HistoryLoginHandler : public content::WebUIMessageHandler {
// changes). // changes).
std::unique_ptr<ProfileInfoWatcher> profile_info_watcher_; std::unique_ptr<ProfileInfoWatcher> profile_info_watcher_;
base::Closure signin_callback_; base::RepeatingClosure signin_callback_;
DISALLOW_COPY_AND_ASSIGN(HistoryLoginHandler); DISALLOW_COPY_AND_ASSIGN(HistoryLoginHandler);
}; };
......
...@@ -141,9 +141,9 @@ HistoryUI::HistoryUI(content::WebUI* web_ui) : WebUIController(web_ui) { ...@@ -141,9 +141,9 @@ HistoryUI::HistoryUI(content::WebUI* web_ui) : WebUIController(web_ui) {
foreign_session_handler.get(); foreign_session_handler.get();
web_ui->AddMessageHandler(std::move(foreign_session_handler)); web_ui->AddMessageHandler(std::move(foreign_session_handler));
foreign_session_handler_ptr->InitializeForeignSessions(); foreign_session_handler_ptr->InitializeForeignSessions();
web_ui->AddMessageHandler(std::make_unique<HistoryLoginHandler>( web_ui->AddMessageHandler(
base::Bind(&HistoryUI::UpdateDataSource, base::Unretained(this)))); std::make_unique<HistoryLoginHandler>(base::BindRepeating(
&HistoryUI::UpdateDataSource, base::Unretained(this))));
} }
HistoryUI::~HistoryUI() {} HistoryUI::~HistoryUI() {}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment