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

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

Issue 2361513003: MD History: Update sign in state in data source (Closed)
Patch Set: remove downloads 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/resources/md_history/synced_device_manager.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/webui/history_login_handler.cc
diff --git a/chrome/browser/ui/webui/history_login_handler.cc b/chrome/browser/ui/webui/history_login_handler.cc
index 1e4e89d8dd03d399d5f16ce404fc957fc120fec0..f516b607f40ff2678296bd36bd919d44fcbcb8ec 100644
--- a/chrome/browser/ui/webui/history_login_handler.cc
+++ b/chrome/browser/ui/webui/history_login_handler.cc
@@ -11,10 +11,12 @@
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/browser_window.h"
+#include "chrome/browser/ui/webui/md_history_ui.cc"
Dan Beam 2016/09/22 18:18:52 whoa whoa whoa, don't include a .cc
Dan Beam 2016/09/22 18:19:26 i accidentally did this the other day, btw, and it
lshang 2016/09/23 02:00:01 Definitely a typo! (o_O)!
#include "chrome/browser/ui/webui/profile_info_watcher.h"
#include "components/signin/core/browser/signin_metrics.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_ui.h"
+#include "content/public/browser/web_ui_data_source.h"
HistoryLoginHandler::HistoryLoginHandler() {}
HistoryLoginHandler::~HistoryLoginHandler() {}
@@ -41,6 +43,14 @@ void HistoryLoginHandler::HandleOtherDevicesInitialized(
void HistoryLoginHandler::ProfileInfoChanged() {
bool signed_in = !profile_info_watcher_->GetAuthenticatedUsername().empty();
+
+ // Update sign in state in data source so that LoadTimeData() returns updated
+ // value on page reload.
+ Profile* profile = Profile::FromWebUI(web_ui());
+ content::WebUIDataSource* data_source = CreateMdHistoryUIHTMLSource(profile);
Dan Beam 2016/09/22 18:18:53 CreateMdHistoryUIHTMLSource is private to the .cc
lshang 2016/09/23 02:00:01 Done. Removed changes in this file.
+ content::WebUIDataSource::Add(profile, data_source);
+ data_source->AddBoolean("isUserSignedIn", signed_in);
+
web_ui()->CallJavascriptFunctionUnsafe("updateSignInState",
calamity 2016/09/22 08:16:28 Can we just update what we need to with this updat
Dan Beam 2016/09/22 18:18:52 yes, it's safe (AFAIK) to just call data_source
lshang 2016/09/23 02:00:01 Yeah we should register a new message callback to
base::FundamentalValue(signed_in));
}
« no previous file with comments | « chrome/browser/resources/md_history/synced_device_manager.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698