Chromium Code Reviews| 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..ddc9880dbbac84544488e6c12fa8da46bc918d1e 100644 |
| --- a/chrome/browser/ui/webui/history_ui.cc |
| +++ b/chrome/browser/ui/webui/history_ui.cc |
| @@ -176,11 +176,15 @@ HistoryUI::HistoryUI(content::WebUI* web_ui) : WebUIController(web_ui) { |
| web_ui->AddMessageHandler(new BrowsingHistoryHandler()); |
| web_ui->AddMessageHandler(new MetricsHandler()); |
| + // Set up the chrome://history-frame/ source. |
| + CreateDataSource(); |
| + |
| // On mobile we deal with foreign sessions differently. |
| #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::SignInChanged, base::Unretained(this)))); |
|
Dan Beam
2016/09/30 02:55:40
why not just bind to CreateDataSource directly?
lshang
2016/09/30 03:21:13
Done.
|
| } |
| #endif |
| @@ -197,10 +201,6 @@ HistoryUI::HistoryUI(content::WebUI* web_ui) : WebUIController(web_ui) { |
| browsing_data::testing:: |
| g_override_other_forms_of_browsing_history_query = true; |
| } |
| - |
| - // Set up the chrome://history-frame/ source. |
| - Profile* profile = Profile::FromWebUI(web_ui); |
| - content::WebUIDataSource::Add(profile, CreateHistoryUIHTMLSource(profile)); |
| } |
| HistoryUI::~HistoryUI() {} |
| @@ -211,3 +211,14 @@ base::RefCountedMemory* HistoryUI::GetFaviconResourceBytes( |
| return ResourceBundle::GetSharedInstance(). |
| LoadDataResourceBytesForScale(IDR_HISTORY_FAVICON, scale_factor); |
| } |
| + |
| +void HistoryUI::CreateDataSource() { |
| + Profile* profile = Profile::FromWebUI(web_ui()); |
| + content::WebUIDataSource* data_source = CreateHistoryUIHTMLSource(profile); |
| + content::WebUIDataSource::Add(profile, data_source); |
| +} |
| + |
| +void HistoryUI::SignInChanged() { |
| + // Recreate the data source so sign in state get updated in there. |
| + CreateDataSource(); |
| +} |