Commit 2695fca3 authored by Becca Hughes's avatar Becca Hughes Committed by Commit Bot

[Media History] Fix crash in WebUI

Fix crash in WebUI caused by mojo.

Fixes: 1048314
Change-Id: I642dfd7a427ff32f09c889540fdd3cea62100ffe
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2036653Reviewed-by: default avatarTommy Steimel <steimel@chromium.org>
Commit-Queue: Becca Hughes <beccahughes@chromium.org>
Cr-Commit-Position: refs/heads/master@{#738006}
parent 30329535
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
#include "content/public/browser/web_ui_data_source.h" #include "content/public/browser/web_ui_data_source.h"
MediaHistoryUI::MediaHistoryUI(content::WebUI* web_ui) MediaHistoryUI::MediaHistoryUI(content::WebUI* web_ui)
: ui::MojoWebUIController(web_ui), receiver_(this) { : ui::MojoWebUIController(web_ui) {
// Setup the data source behind chrome://media-history. // Setup the data source behind chrome://media-history.
std::unique_ptr<content::WebUIDataSource> source( std::unique_ptr<content::WebUIDataSource> source(
content::WebUIDataSource::Create(chrome::kChromeUIMediaHistoryHost)); content::WebUIDataSource::Create(chrome::kChromeUIMediaHistoryHost));
...@@ -39,7 +39,7 @@ MediaHistoryUI::~MediaHistoryUI() = default; ...@@ -39,7 +39,7 @@ MediaHistoryUI::~MediaHistoryUI() = default;
void MediaHistoryUI::BindInterface( void MediaHistoryUI::BindInterface(
mojo::PendingReceiver<media_history::mojom::MediaHistoryStore> pending) { mojo::PendingReceiver<media_history::mojom::MediaHistoryStore> pending) {
receiver_.Bind(std::move(pending)); receivers_.Add(this, std::move(pending));
} }
void MediaHistoryUI::GetMediaHistoryStats( void MediaHistoryUI::GetMediaHistoryStats(
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
#include "chrome/browser/media/history/media_history_store.mojom.h" #include "chrome/browser/media/history/media_history_store.mojom.h"
#include "mojo/public/cpp/bindings/pending_receiver.h" #include "mojo/public/cpp/bindings/pending_receiver.h"
#include "mojo/public/cpp/bindings/receiver.h" #include "mojo/public/cpp/bindings/receiver_set.h"
#include "ui/webui/mojo_web_ui_controller.h" #include "ui/webui/mojo_web_ui_controller.h"
namespace media_history { namespace media_history {
...@@ -34,7 +34,7 @@ class MediaHistoryUI : public ui::MojoWebUIController, ...@@ -34,7 +34,7 @@ class MediaHistoryUI : public ui::MojoWebUIController,
private: private:
media_history::MediaHistoryStore* GetMediaHistoryStore(); media_history::MediaHistoryStore* GetMediaHistoryStore();
mojo::Receiver<media_history::mojom::MediaHistoryStore> receiver_; mojo::ReceiverSet<media_history::mojom::MediaHistoryStore> receivers_;
WEB_UI_CONTROLLER_TYPE_DECL(); WEB_UI_CONTROLLER_TYPE_DECL();
}; };
......
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