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..193f835bd638f365469f987c7c8f7feb9da8f20f 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. |
| + CreateAndGetDataSource(); |
| + |
| // 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)))); |
| } |
| #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,15 @@ base::RefCountedMemory* HistoryUI::GetFaviconResourceBytes( |
| return ResourceBundle::GetSharedInstance(). |
| LoadDataResourceBytesForScale(IDR_HISTORY_FAVICON, scale_factor); |
| } |
| + |
| +content::WebUIDataSource* HistoryUI::CreateAndGetDataSource() { |
| + Profile* profile = Profile::FromWebUI(web_ui()); |
| + content::WebUIDataSource* data_source = CreateHistoryUIHTMLSource(profile); |
| + content::WebUIDataSource::Add(profile, data_source); |
| + return data_source; |
|
Dan Beam
2016/09/30 00:47:43
so, groby@ is going to make this API take a std::u
lshang
2016/09/30 01:31:08
Changed to just create it. groby@'s change would b
Dan Beam
2016/09/30 02:55:40
let's just re-create every time with a TODO for no
lshang
2016/09/30 03:21:13
Done.
|
| +} |
| + |
| +void HistoryUI::SignInChanged(bool signed_in) { |
| + // Recreate the data source so sign in state get updated in there. |
| + CreateAndGetDataSource(); |
| +} |