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

Side by Side Diff: chrome/browser/ui/webui/signin_internals_ui.cc

Issue 1075273002: Handle ListAccount fetches from within the GaiaCookieManagerService. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix a test post rebase Created 5 years, 8 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 unified diff | Download patch
« no previous file with comments | « chrome/browser/signin/signin_tracker_factory.cc ('k') | chrome/chrome_tests_unit.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
11 #include "chrome/browser/signin/gaia_cookie_manager_service_factory.h"
11 #include "chrome/common/url_constants.h" 12 #include "chrome/common/url_constants.h"
12 #include "components/signin/core/browser/about_signin_internals.h" 13 #include "components/signin/core/browser/about_signin_internals.h"
14 #include "components/signin/core/browser/gaia_cookie_manager_service.h"
13 #include "content/public/browser/web_ui.h" 15 #include "content/public/browser/web_ui.h"
14 #include "content/public/browser/web_ui_data_source.h" 16 #include "content/public/browser/web_ui_data_source.h"
15 #include "grit/signin_internals_resources.h" 17 #include "grit/signin_internals_resources.h"
16 18
17 namespace { 19 namespace {
18 20
19 content::WebUIDataSource* CreateSignInInternalsHTMLSource() { 21 content::WebUIDataSource* CreateSignInInternalsHTMLSource() {
20 content::WebUIDataSource* source = 22 content::WebUIDataSource* source =
21 content::WebUIDataSource::Create(chrome::kChromeUISignInInternalsHost); 23 content::WebUIDataSource::Create(chrome::kChromeUISignInInternalsHost);
22 24
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 AboutSigninInternals* about_signin_internals = 65 AboutSigninInternals* about_signin_internals =
64 AboutSigninInternalsFactory::GetForProfile(profile); 66 AboutSigninInternalsFactory::GetForProfile(profile);
65 // 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
66 // reasonable defaults, so the about:signin-internals page doesn't look 68 // reasonable defaults, so the about:signin-internals page doesn't look
67 // empty in incognito mode. Alternatively, we could force about:signin to 69 // empty in incognito mode. Alternatively, we could force about:signin to
68 // open in non-incognito mode always (like about:settings for ex.). 70 // open in non-incognito mode always (like about:settings for ex.).
69 if (about_signin_internals) { 71 if (about_signin_internals) {
70 web_ui()->CallJavascriptFunction( 72 web_ui()->CallJavascriptFunction(
71 "chrome.signin.getSigninInfo.handleReply", 73 "chrome.signin.getSigninInfo.handleReply",
72 *about_signin_internals->GetSigninStatus()); 74 *about_signin_internals->GetSigninStatus());
73 about_signin_internals->GetCookieAccountsAsync(); 75
76 std::vector<std::pair<std::string, bool>> cookie_accounts;
77 GaiaCookieManagerService* cookie_manager_service =
78 GaiaCookieManagerServiceFactory::GetForProfile(profile);
79 if (cookie_manager_service->ListAccounts(&cookie_accounts)) {
80 about_signin_internals->OnGaiaAccountsInCookieUpdated(
81 cookie_accounts,
82 GoogleServiceAuthError(GoogleServiceAuthError::NONE));
83 }
74 84
75 return true; 85 return true;
76 } 86 }
77 } 87 }
78 return false; 88 return false;
79 } 89 }
80 90
81 void SignInInternalsUI::OnSigninStateChanged( 91 void SignInInternalsUI::OnSigninStateChanged(
82 const base::DictionaryValue* info) { 92 const base::DictionaryValue* info) {
83 // TODO(robliao): Remove ScopedTracker below once https://crbug.com/422460 is 93 // TODO(robliao): Remove ScopedTracker below once https://crbug.com/422460 is
84 // fixed. 94 // fixed.
85 tracked_objects::ScopedTracker tracking_profile( 95 tracked_objects::ScopedTracker tracking_profile(
86 FROM_HERE_WITH_EXPLICIT_FUNCTION( 96 FROM_HERE_WITH_EXPLICIT_FUNCTION(
87 "422460 SignInInternalsUI::OnSigninStateChanged")); 97 "422460 SignInInternalsUI::OnSigninStateChanged"));
88 98
89 web_ui()->CallJavascriptFunction( 99 web_ui()->CallJavascriptFunction(
90 "chrome.signin.onSigninInfoChanged.fire", *info); 100 "chrome.signin.onSigninInfoChanged.fire", *info);
91 } 101 }
92 102
93 void SignInInternalsUI::OnCookieAccountsFetched( 103 void SignInInternalsUI::OnCookieAccountsFetched(
94 const base::DictionaryValue* info) { 104 const base::DictionaryValue* info) {
95 web_ui()->CallJavascriptFunction( 105 web_ui()->CallJavascriptFunction(
96 "chrome.signin.onCookieAccountsFetched.fire", *info); 106 "chrome.signin.onCookieAccountsFetched.fire", *info);
97 } 107 }
OLDNEW
« no previous file with comments | « chrome/browser/signin/signin_tracker_factory.cc ('k') | chrome/chrome_tests_unit.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698