Add ICU message format support
[chromium-blink-merge.git] / chrome / browser / ui / webui / history_login_handler.cc
blob55b83a9f0e64cfb2333b00599a9460421b36d0d1
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "chrome/browser/ui/webui/history_login_handler.h"
7 #include "base/bind.h"
8 #include "base/bind_helpers.h"
9 #include "base/values.h"
10 #include "chrome/browser/profiles/profile.h"
11 #include "chrome/browser/ui/webui/profile_info_watcher.h"
12 #include "content/public/browser/web_ui.h"
14 HistoryLoginHandler::HistoryLoginHandler() {}
15 HistoryLoginHandler::~HistoryLoginHandler() {}
17 void HistoryLoginHandler::RegisterMessages() {
18 profile_info_watcher_.reset(new ProfileInfoWatcher(
19 Profile::FromWebUI(web_ui()),
20 base::Bind(&HistoryLoginHandler::ProfileInfoChanged,
21 base::Unretained(this))));
23 web_ui()->RegisterMessageCallback("otherDevicesInitialized",
24 base::Bind(&HistoryLoginHandler::HandleOtherDevicesInitialized,
25 base::Unretained(this)));
28 void HistoryLoginHandler::HandleOtherDevicesInitialized(
29 const base::ListValue* /*args*/) {
30 ProfileInfoChanged();
33 void HistoryLoginHandler::ProfileInfoChanged() {
34 bool signed_in = !profile_info_watcher_->GetAuthenticatedUsername().empty();
35 web_ui()->CallJavascriptFunction(
36 "updateSignInState", base::FundamentalValue(signed_in));