| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/signin_internals_ui.h" | 5 #include "chrome/browser/ui/webui/signin_internals_ui.h" |
| 6 | 6 |
| 7 #include "base/hash.h" | 7 #include "base/hash.h" |
| 8 #include "base/profiler/scoped_tracker.h" | 8 #include "base/profiler/scoped_tracker.h" |
| 9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
| 10 #include "chrome/browser/signin/about_signin_internals_factory.h" | 10 #include "chrome/browser/signin/about_signin_internals_factory.h" |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 if (!profile) | 62 if (!profile) |
| 63 return false; | 63 return false; |
| 64 | 64 |
| 65 AboutSigninInternals* about_signin_internals = | 65 AboutSigninInternals* about_signin_internals = |
| 66 AboutSigninInternalsFactory::GetForProfile(profile); | 66 AboutSigninInternalsFactory::GetForProfile(profile); |
| 67 // TODO(vishwath): The UI would look better if we passed in a dict with some | 67 // TODO(vishwath): The UI would look better if we passed in a dict with some |
| 68 // reasonable defaults, so the about:signin-internals page doesn't look | 68 // reasonable defaults, so the about:signin-internals page doesn't look |
| 69 // empty in incognito mode. Alternatively, we could force about:signin to | 69 // empty in incognito mode. Alternatively, we could force about:signin to |
| 70 // open in non-incognito mode always (like about:settings for ex.). | 70 // open in non-incognito mode always (like about:settings for ex.). |
| 71 if (about_signin_internals) { | 71 if (about_signin_internals) { |
| 72 web_ui()->CallJavascriptFunction( | 72 web_ui()->CallJavascriptFunctionUnsafe( |
| 73 "chrome.signin.getSigninInfo.handleReply", | 73 "chrome.signin.getSigninInfo.handleReply", |
| 74 *about_signin_internals->GetSigninStatus()); | 74 *about_signin_internals->GetSigninStatus()); |
| 75 | 75 |
| 76 std::vector<gaia::ListedAccount> cookie_accounts; | 76 std::vector<gaia::ListedAccount> cookie_accounts; |
| 77 std::vector<gaia::ListedAccount> signed_out_accounts; | 77 std::vector<gaia::ListedAccount> signed_out_accounts; |
| 78 GaiaCookieManagerService* cookie_manager_service = | 78 GaiaCookieManagerService* cookie_manager_service = |
| 79 GaiaCookieManagerServiceFactory::GetForProfile(profile); | 79 GaiaCookieManagerServiceFactory::GetForProfile(profile); |
| 80 if (cookie_manager_service->ListAccounts( | 80 if (cookie_manager_service->ListAccounts( |
| 81 &cookie_accounts, &signed_out_accounts)) { | 81 &cookie_accounts, &signed_out_accounts)) { |
| 82 about_signin_internals->OnGaiaAccountsInCookieUpdated( | 82 about_signin_internals->OnGaiaAccountsInCookieUpdated( |
| 83 cookie_accounts, | 83 cookie_accounts, |
| 84 signed_out_accounts, | 84 signed_out_accounts, |
| 85 GoogleServiceAuthError(GoogleServiceAuthError::NONE)); | 85 GoogleServiceAuthError(GoogleServiceAuthError::NONE)); |
| 86 } | 86 } |
| 87 | 87 |
| 88 return true; | 88 return true; |
| 89 } | 89 } |
| 90 } | 90 } |
| 91 return false; | 91 return false; |
| 92 } | 92 } |
| 93 | 93 |
| 94 void SignInInternalsUI::OnSigninStateChanged( | 94 void SignInInternalsUI::OnSigninStateChanged( |
| 95 const base::DictionaryValue* info) { | 95 const base::DictionaryValue* info) { |
| 96 // TODO(robliao): Remove ScopedTracker below once https://crbug.com/422460 is | 96 // TODO(robliao): Remove ScopedTracker below once https://crbug.com/422460 is |
| 97 // fixed. | 97 // fixed. |
| 98 tracked_objects::ScopedTracker tracking_profile( | 98 tracked_objects::ScopedTracker tracking_profile( |
| 99 FROM_HERE_WITH_EXPLICIT_FUNCTION( | 99 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
| 100 "422460 SignInInternalsUI::OnSigninStateChanged")); | 100 "422460 SignInInternalsUI::OnSigninStateChanged")); |
| 101 | 101 |
| 102 web_ui()->CallJavascriptFunction( | 102 web_ui()->CallJavascriptFunctionUnsafe( |
| 103 "chrome.signin.onSigninInfoChanged.fire", *info); | 103 "chrome.signin.onSigninInfoChanged.fire", *info); |
| 104 } | 104 } |
| 105 | 105 |
| 106 void SignInInternalsUI::OnCookieAccountsFetched( | 106 void SignInInternalsUI::OnCookieAccountsFetched( |
| 107 const base::DictionaryValue* info) { | 107 const base::DictionaryValue* info) { |
| 108 web_ui()->CallJavascriptFunction( | 108 web_ui()->CallJavascriptFunctionUnsafe( |
| 109 "chrome.signin.onCookieAccountsFetched.fire", *info); | 109 "chrome.signin.onCookieAccountsFetched.fire", *info); |
| 110 } | 110 } |
| OLD | NEW |