| OLD | NEW |
| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 571 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 582 if (!base::GetValueAsFilePath(*profile_path_value, &profile_path)) | 582 if (!base::GetValueAsFilePath(*profile_path_value, &profile_path)) |
| 583 return; | 583 return; |
| 584 | 584 |
| 585 base::StringValue return_profile_path(profile_path.value()); | 585 base::StringValue return_profile_path(profile_path.value()); |
| 586 Profile* profile = g_browser_process->profile_manager()-> | 586 Profile* profile = g_browser_process->profile_manager()-> |
| 587 GetProfileByPath(profile_path); | 587 GetProfileByPath(profile_path); |
| 588 | 588 |
| 589 if (!profile) | 589 if (!profile) |
| 590 return; | 590 return; |
| 591 | 591 |
| 592 if (!chrome::FindAnyBrowser(profile, true, desktop_type_)) { | 592 if (!chrome::FindAnyBrowser(profile, true)) { |
| 593 // If no windows are open for that profile, the statistics in | 593 // If no windows are open for that profile, the statistics in |
| 594 // ProfileInfoCache are up to date. The statistics in ProfileInfoCache are | 594 // ProfileInfoCache are up to date. The statistics in ProfileInfoCache are |
| 595 // returned because the copy in user_pod_row.js may be outdated. However, if | 595 // returned because the copy in user_pod_row.js may be outdated. However, if |
| 596 // some statistics are missing in ProfileInfoCache (i.e. |item.success| is | 596 // some statistics are missing in ProfileInfoCache (i.e. |item.success| is |
| 597 // false), then the actual statistics are queried instead. | 597 // false), then the actual statistics are queried instead. |
| 598 base::DictionaryValue return_value; | 598 base::DictionaryValue return_value; |
| 599 profiles::ProfileCategoryStats stats = | 599 profiles::ProfileCategoryStats stats = |
| 600 profiles::GetProfileStatisticsFromCache(profile_path); | 600 profiles::GetProfileStatisticsFromCache(profile_path); |
| 601 bool stats_success = true; | 601 bool stats_success = true; |
| 602 for (const auto& item : stats) { | 602 for (const auto& item : stats) { |
| (...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1007 } | 1007 } |
| 1008 } | 1008 } |
| 1009 | 1009 |
| 1010 // This callback is run after switching to a new profile has finished. This | 1010 // This callback is run after switching to a new profile has finished. This |
| 1011 // means either a new browser has been created (but not the window), or an | 1011 // means either a new browser has been created (but not the window), or an |
| 1012 // existing one has been found. The HideUserManager task needs to be posted | 1012 // existing one has been found. The HideUserManager task needs to be posted |
| 1013 // since closing the User Manager before the window is created can flakily | 1013 // since closing the User Manager before the window is created can flakily |
| 1014 // cause Chrome to close. | 1014 // cause Chrome to close. |
| 1015 void UserManagerScreenHandler::OnSwitchToProfileComplete( | 1015 void UserManagerScreenHandler::OnSwitchToProfileComplete( |
| 1016 Profile* profile, Profile::CreateStatus profile_create_status) { | 1016 Profile* profile, Profile::CreateStatus profile_create_status) { |
| 1017 Browser* browser = chrome::FindAnyBrowser(profile, false, desktop_type_); | 1017 Browser* browser = chrome::FindAnyBrowser(profile, false); |
| 1018 if (browser && browser->window()) { | 1018 if (browser && browser->window()) { |
| 1019 OnBrowserWindowReady(browser); | 1019 OnBrowserWindowReady(browser); |
| 1020 } else { | 1020 } else { |
| 1021 registrar_.Add(this, | 1021 registrar_.Add(this, |
| 1022 chrome::NOTIFICATION_BROWSER_WINDOW_READY, | 1022 chrome::NOTIFICATION_BROWSER_WINDOW_READY, |
| 1023 content::NotificationService::AllSources()); | 1023 content::NotificationService::AllSources()); |
| 1024 } | 1024 } |
| 1025 } | 1025 } |
| OLD | NEW |