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

Side by Side Diff: chrome/browser/ui/webui/signin/user_manager_screen_handler.cc

Issue 1428973003: Utilize ProfileInfoCache to support data type counts in profile deletion flow (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: user_pod_row.js done, statistics now saved when the last window of a profile is closed. Created 5 years, 1 month 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/user_manager_screen_handler.h" 5 #include "chrome/browser/ui/webui/signin/user_manager_screen_handler.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/location.h" 8 #include "base/location.h"
9 #include "base/prefs/pref_service.h" 9 #include "base/prefs/pref_service.h"
10 #include "base/profiler/scoped_tracker.h" 10 #include "base/profiler/scoped_tracker.h"
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 const char kKeyProfilePath[] = "profilePath"; 64 const char kKeyProfilePath[] = "profilePath";
65 const char kKeyPublicAccount[] = "publicAccount"; 65 const char kKeyPublicAccount[] = "publicAccount";
66 const char kKeyLegacySupervisedUser[] = "legacySupervisedUser"; 66 const char kKeyLegacySupervisedUser[] = "legacySupervisedUser";
67 const char kKeyChildUser[] = "childUser"; 67 const char kKeyChildUser[] = "childUser";
68 const char kKeyCanRemove[] = "canRemove"; 68 const char kKeyCanRemove[] = "canRemove";
69 const char kKeyIsOwner[] = "isOwner"; 69 const char kKeyIsOwner[] = "isOwner";
70 const char kKeyIsDesktop[] = "isDesktopUser"; 70 const char kKeyIsDesktop[] = "isDesktopUser";
71 const char kKeyAvatarUrl[] = "userImage"; 71 const char kKeyAvatarUrl[] = "userImage";
72 const char kKeyNeedsSignin[] = "needsSignin"; 72 const char kKeyNeedsSignin[] = "needsSignin";
73 const char kKeyHasLocalCreds[] = "hasLocalCreds"; 73 const char kKeyHasLocalCreds[] = "hasLocalCreds";
74 const char kKeyStatistics[] = "statistics";
74 const char kKeyIsProfileLoaded[] = "isProfileLoaded"; 75 const char kKeyIsProfileLoaded[] = "isProfileLoaded";
75 76
76 // JS API callback names. 77 // JS API callback names.
77 const char kJsApiUserManagerInitialize[] = "userManagerInitialize"; 78 const char kJsApiUserManagerInitialize[] = "userManagerInitialize";
78 const char kJsApiUserManagerAddUser[] = "addUser"; 79 const char kJsApiUserManagerAddUser[] = "addUser";
79 const char kJsApiUserManagerAuthLaunchUser[] = "authenticatedLaunchUser"; 80 const char kJsApiUserManagerAuthLaunchUser[] = "authenticatedLaunchUser";
80 const char kJsApiUserManagerLaunchGuest[] = "launchGuest"; 81 const char kJsApiUserManagerLaunchGuest[] = "launchGuest";
81 const char kJsApiUserManagerLaunchUser[] = "launchUser"; 82 const char kJsApiUserManagerLaunchUser[] = "launchUser";
82 const char kJsApiUserManagerRemoveUser[] = "removeUser"; 83 const char kJsApiUserManagerRemoveUser[] = "removeUser";
83 const char kJsApiUserManagerAttemptUnlock[] = "attemptUnlock"; 84 const char kJsApiUserManagerAttemptUnlock[] = "attemptUnlock";
(...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after
576 if (!base::GetValueAsFilePath(*profile_path_value, &profile_path)) 577 if (!base::GetValueAsFilePath(*profile_path_value, &profile_path))
577 return; 578 return;
578 579
579 base::StringValue return_profile_path(profile_path.value()); 580 base::StringValue return_profile_path(profile_path.value());
580 Profile* profile = g_browser_process->profile_manager()-> 581 Profile* profile = g_browser_process->profile_manager()->
581 GetProfileByPath(profile_path); 582 GetProfileByPath(profile_path);
582 583
583 if (!profile) 584 if (!profile)
584 return; 585 return;
585 586
586 profiles::GetProfileStatistics( 587 profiles::GetProfileStatistics(
Mike Lerman 2015/11/03 20:50:42 Only do this if the profile has open browser windo
lwchkg 2015/11/04 00:11:07 Sounds good.
lwchkg 2015/11/05 22:21:30 Update: the data's already been saved to ProfileIn
587 profile, 588 profile,
588 base::Bind( 589 base::Bind(
589 &UserManagerScreenHandler::RemoveUserDialogLoadStatsCallback, 590 &UserManagerScreenHandler::RemoveUserDialogLoadStatsCallback,
590 weak_ptr_factory_.GetWeakPtr(), profile_path), 591 weak_ptr_factory_.GetWeakPtr(), profile_path),
591 &tracker_); 592 &tracker_);
592 } 593 }
593 594
594 void UserManagerScreenHandler::RemoveUserDialogLoadStatsCallback( 595 void UserManagerScreenHandler::RemoveUserDialogLoadStatsCallback(
595 base::FilePath profile_path, 596 base::FilePath profile_path,
596 profiles::ProfileCategoryStats result) { 597 profiles::ProfileCategoryStats result) {
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
869 profile_value->SetBoolean( 870 profile_value->SetBoolean(
870 kKeyNeedsSignin, info_cache->ProfileIsSigninRequiredAtIndex(i)); 871 kKeyNeedsSignin, info_cache->ProfileIsSigninRequiredAtIndex(i));
871 profile_value->SetBoolean( 872 profile_value->SetBoolean(
872 kKeyHasLocalCreds, 873 kKeyHasLocalCreds,
873 !info_cache->GetLocalAuthCredentialsOfProfileAtIndex(i).empty()); 874 !info_cache->GetLocalAuthCredentialsOfProfileAtIndex(i).empty());
874 profile_value->SetBoolean(kKeyIsOwner, false); 875 profile_value->SetBoolean(kKeyIsOwner, false);
875 profile_value->SetBoolean(kKeyCanRemove, can_remove); 876 profile_value->SetBoolean(kKeyCanRemove, can_remove);
876 profile_value->SetBoolean(kKeyIsDesktop, true); 877 profile_value->SetBoolean(kKeyIsDesktop, true);
877 profile_value->SetString( 878 profile_value->SetString(
878 kKeyAvatarUrl, GetAvatarImageAtIndex(i, info_cache)); 879 kKeyAvatarUrl, GetAvatarImageAtIndex(i, info_cache));
880 profile_value->Set(kKeyStatistics, info_cache->
881 GetAllStatisticsOfProfileAtIndexAsDictionaryValue(i));
879 882
880 // GetProfileByPath returns a pointer if the profile is fully loaded, NULL 883 // GetProfileByPath returns a pointer if the profile is fully loaded, NULL
881 // otherwise. 884 // otherwise.
882 Profile* profile = 885 Profile* profile =
883 g_browser_process->profile_manager()->GetProfileByPath(profile_path); 886 g_browser_process->profile_manager()->GetProfileByPath(profile_path);
884 profile_value->SetBoolean(kKeyIsProfileLoaded, profile != nullptr); 887 profile_value->SetBoolean(kKeyIsProfileLoaded, profile != nullptr);
885 888
886 users_list.Append(profile_value); 889 users_list.Append(profile_value);
887 } 890 }
888 891
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
973 Profile* profile, Profile::CreateStatus profile_create_status) { 976 Profile* profile, Profile::CreateStatus profile_create_status) {
974 Browser* browser = chrome::FindAnyBrowser(profile, false, desktop_type_); 977 Browser* browser = chrome::FindAnyBrowser(profile, false, desktop_type_);
975 if (browser && browser->window()) { 978 if (browser && browser->window()) {
976 OnBrowserWindowReady(browser); 979 OnBrowserWindowReady(browser);
977 } else { 980 } else {
978 registrar_.Add(this, 981 registrar_.Add(this,
979 chrome::NOTIFICATION_BROWSER_WINDOW_READY, 982 chrome::NOTIFICATION_BROWSER_WINDOW_READY,
980 content::NotificationService::AllSources()); 983 content::NotificationService::AllSources());
981 } 984 }
982 } 985 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698