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

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

Issue 1143963002: Split NTPLoginHandler across chrome://apps and chrome://history. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: gyp fixes Created 5 years, 7 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_login_handler.h ('k') | chrome/browser/ui/webui/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_login_handler.cc
diff --git a/chrome/browser/ui/webui/history_login_handler.cc b/chrome/browser/ui/webui/history_login_handler.cc
new file mode 100644
index 0000000000000000000000000000000000000000..55b83a9f0e64cfb2333b00599a9460421b36d0d1
--- /dev/null
+++ b/chrome/browser/ui/webui/history_login_handler.cc
@@ -0,0 +1,37 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/ui/webui/history_login_handler.h"
+
+#include "base/bind.h"
+#include "base/bind_helpers.h"
+#include "base/values.h"
+#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/ui/webui/profile_info_watcher.h"
+#include "content/public/browser/web_ui.h"
+
+HistoryLoginHandler::HistoryLoginHandler() {}
+HistoryLoginHandler::~HistoryLoginHandler() {}
+
+void HistoryLoginHandler::RegisterMessages() {
+ profile_info_watcher_.reset(new ProfileInfoWatcher(
+ Profile::FromWebUI(web_ui()),
+ base::Bind(&HistoryLoginHandler::ProfileInfoChanged,
+ base::Unretained(this))));
+
+ web_ui()->RegisterMessageCallback("otherDevicesInitialized",
+ base::Bind(&HistoryLoginHandler::HandleOtherDevicesInitialized,
+ base::Unretained(this)));
+}
+
+void HistoryLoginHandler::HandleOtherDevicesInitialized(
+ const base::ListValue* /*args*/) {
+ ProfileInfoChanged();
+}
+
+void HistoryLoginHandler::ProfileInfoChanged() {
+ bool signed_in = !profile_info_watcher_->GetAuthenticatedUsername().empty();
+ web_ui()->CallJavascriptFunction(
+ "updateSignInState", base::FundamentalValue(signed_in));
+}
« no previous file with comments | « chrome/browser/ui/webui/history_login_handler.h ('k') | chrome/browser/ui/webui/history_ui.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698