| Index: chrome/browser/ui/webui/history_ui.cc
|
| diff --git a/chrome/browser/ui/webui/history_ui.cc b/chrome/browser/ui/webui/history_ui.cc
|
| index af647cee1d892e757c1c8f857a9cdca3b71c29c7..17ad4d148a2de2a607193a425c425df88d2e6c94 100644
|
| --- a/chrome/browser/ui/webui/history_ui.cc
|
| +++ b/chrome/browser/ui/webui/history_ui.cc
|
| @@ -180,7 +180,8 @@ HistoryUI::HistoryUI(content::WebUI* web_ui) : WebUIController(web_ui) {
|
| #if !defined(OS_ANDROID)
|
| if (search::IsInstantExtendedAPIEnabled()) {
|
| web_ui->AddMessageHandler(new browser_sync::ForeignSessionHandler());
|
| - web_ui->AddMessageHandler(new HistoryLoginHandler());
|
| + web_ui->AddMessageHandler(new HistoryLoginHandler(
|
| + base::Bind(&HistoryUI::CreateDataSource, base::Unretained(this))));
|
| }
|
| #endif
|
|
|
| @@ -199,8 +200,7 @@ HistoryUI::HistoryUI(content::WebUI* web_ui) : WebUIController(web_ui) {
|
| }
|
|
|
| // Set up the chrome://history-frame/ source.
|
| - Profile* profile = Profile::FromWebUI(web_ui);
|
| - content::WebUIDataSource::Add(profile, CreateHistoryUIHTMLSource(profile));
|
| + CreateDataSource();
|
| }
|
|
|
| HistoryUI::~HistoryUI() {}
|
| @@ -211,3 +211,11 @@ base::RefCountedMemory* HistoryUI::GetFaviconResourceBytes(
|
| return ResourceBundle::GetSharedInstance().
|
| LoadDataResourceBytesForScale(IDR_HISTORY_FAVICON, scale_factor);
|
| }
|
| +
|
| +// TODO(lshang): Change to not re-create data source every time after we use
|
| +// unique_ptr instead of raw pointers for data source.
|
| +void HistoryUI::CreateDataSource() {
|
| + Profile* profile = Profile::FromWebUI(web_ui());
|
| + content::WebUIDataSource* data_source = CreateHistoryUIHTMLSource(profile);
|
| + content::WebUIDataSource::Add(profile, data_source);
|
| +}
|
|
|