| 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..9d57fdfca4f0aff3b16e65d7f0babe2309617fb0 100644
|
| --- a/chrome/browser/ui/webui/history_ui.cc
|
| +++ b/chrome/browser/ui/webui/history_ui.cc
|
| @@ -172,15 +172,22 @@ content::WebUIDataSource* CreateHistoryUIHTMLSource(Profile* profile) {
|
|
|
| } // namespace
|
|
|
| -HistoryUI::HistoryUI(content::WebUI* web_ui) : WebUIController(web_ui) {
|
| +HistoryUI::HistoryUI(content::WebUI* web_ui)
|
| + : WebUIController(web_ui), weak_ptr_factory_(this) {
|
| web_ui->AddMessageHandler(new BrowsingHistoryHandler());
|
| web_ui->AddMessageHandler(new MetricsHandler());
|
|
|
| + Profile* profile = Profile::FromWebUI(web_ui);
|
| + data_source_ = CreateHistoryUIHTMLSource(profile);
|
| + // Set up the chrome://history-frame/ source.
|
| + content::WebUIDataSource::Add(profile, data_source_);
|
| +
|
| // 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, weak_ptr_factory_.GetWeakPtr())));
|
| }
|
| #endif
|
|
|
| @@ -197,10 +204,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 +214,10 @@ base::RefCountedMemory* HistoryUI::GetFaviconResourceBytes(
|
| return ResourceBundle::GetSharedInstance().
|
| LoadDataResourceBytesForScale(IDR_HISTORY_FAVICON, scale_factor);
|
| }
|
| +
|
| +void HistoryUI::SignInChanged(bool signed_in) {
|
| + // Recreate the data source so sign in state get updated in there.
|
| + Profile* profile = Profile::FromWebUI(web_ui());
|
| + data_source_ = CreateHistoryUIHTMLSource(profile);
|
| + content::WebUIDataSource::Add(profile, data_source_);
|
| +}
|
|
|