OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/ui/webui/history_login_handler.h" | 5 #include "chrome/browser/ui/webui/history_login_handler.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
(...skipping 30 matching lines...) Expand all Loading... |
41 const base::ListValue* /*args*/) { | 41 const base::ListValue* /*args*/) { |
42 AllowJavascript(); | 42 AllowJavascript(); |
43 ProfileInfoChanged(); | 43 ProfileInfoChanged(); |
44 } | 44 } |
45 | 45 |
46 void HistoryLoginHandler::ProfileInfoChanged() { | 46 void HistoryLoginHandler::ProfileInfoChanged() { |
47 bool signed_in = !profile_info_watcher_->GetAuthenticatedUsername().empty(); | 47 bool signed_in = !profile_info_watcher_->GetAuthenticatedUsername().empty(); |
48 if (!signin_callback_.is_null()) | 48 if (!signin_callback_.is_null()) |
49 signin_callback_.Run(); | 49 signin_callback_.Run(); |
50 | 50 |
51 if (IsJavascriptAllowed()) { | 51 if (IsJavascriptAllowed()) |
52 CallJavascriptFunction("updateSignInState", | 52 CallJavascriptFunction("updateSignInState", base::Value(signed_in)); |
53 base::FundamentalValue(signed_in)); | |
54 } | |
55 } | 53 } |
56 | 54 |
57 void HistoryLoginHandler::HandleStartSignInFlow( | 55 void HistoryLoginHandler::HandleStartSignInFlow( |
58 const base::ListValue* /*args*/) { | 56 const base::ListValue* /*args*/) { |
59 Browser* browser = | 57 Browser* browser = |
60 chrome::FindBrowserWithWebContents(web_ui()->GetWebContents()); | 58 chrome::FindBrowserWithWebContents(web_ui()->GetWebContents()); |
61 browser->window()->ShowAvatarBubbleFromAvatarButton( | 59 browser->window()->ShowAvatarBubbleFromAvatarButton( |
62 BrowserWindow::AVATAR_BUBBLE_MODE_SIGNIN, | 60 BrowserWindow::AVATAR_BUBBLE_MODE_SIGNIN, |
63 signin::ManageAccountsParams(), | 61 signin::ManageAccountsParams(), |
64 signin_metrics::AccessPoint::ACCESS_POINT_RECENT_TABS); | 62 signin_metrics::AccessPoint::ACCESS_POINT_RECENT_TABS); |
65 } | 63 } |
OLD | NEW |