Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3744)

Unified Diff: chrome/browser/ui/webui/history_ui.cc

Issue 2361513003: MD History: Update sign in state in data source (Closed)
Patch Set: move Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/webui/history_ui.h ('k') | chrome/browser/ui/webui/md_history_ui.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
+}
« no previous file with comments | « chrome/browser/ui/webui/history_ui.h ('k') | chrome/browser/ui/webui/md_history_ui.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698