diff options
| author | lwchkg <lwchkg@gmail.com> | 2016-03-02 06:31:53 -0800 |
|---|---|---|
| committer | Commit bot <commit-bot@chromium.org> | 2016-03-02 14:34:12 +0000 |
| commit | 3c782d0a07b0f8383660496966b4d2015840bb7a (patch) | |
| tree | 5996ecdbc92fc8a114c0a5f3aff9267b662f71cf | |
| parent | 64dff81f1efea585a3aba2c2ea2893b7f8e2bfaa (diff) | |
| download | chromium_src-3c782d0a07b0f8383660496966b4d2015840bb7a.zip chromium_src-3c782d0a07b0f8383660496966b4d2015840bb7a.tar.gz chromium_src-3c782d0a07b0f8383660496966b4d2015840bb7a.tar.bz2 | |
Refactor ProfileInfoCache in c/b/ui
ProfileInfoCache is being refactored into ProfileAttributesStorage and
ProfileAttributesEntry, which use profile paths instead of numerical
indices in the interface. See
https://crrev.com/94dacdb8289038b7fa68c9f2bd57d5311b2cb5cb for details.
BUG=305720
Review URL: https://codereview.chromium.org/1748533002
Cr-Commit-Position: refs/heads/master@{#378745}
5 files changed, 27 insertions, 23 deletions
diff --git a/chrome/browser/ui/ash/app_list/app_list_service_ash.h b/chrome/browser/ui/ash/app_list/app_list_service_ash.h index 55349f0..ba2bcbb 100644 --- a/chrome/browser/ui/ash/app_list/app_list_service_ash.h +++ b/chrome/browser/ui/ash/app_list/app_list_service_ash.h @@ -25,10 +25,10 @@ class AppListServiceAsh : public AppListServiceImpl { // AppListService overrides: void Init(Profile* initial_profile) override; - // ProfileInfoCacheObserver overrides: + // ProfileAttributesStorage::Observer overrides: // On ChromeOS this should never happen. On other platforms, there is always a // Non-ash AppListService that is responsible for handling this. - // TODO(calamity): Ash shouldn't observe the ProfileInfoCache at all. + // TODO(calamity): Ash shouldn't observe the ProfileAttributesStorage at all. void OnProfileWillBeRemoved(const base::FilePath& profile_path) override; private: diff --git a/chrome/browser/ui/browser_browsertest.cc b/chrome/browser/ui/browser_browsertest.cc index 5ae8bf8..d6efc04 100644 --- a/chrome/browser/ui/browser_browsertest.cc +++ b/chrome/browser/ui/browser_browsertest.cc @@ -33,7 +33,7 @@ #include "chrome/browser/lifetime/application_lifetime.h" #include "chrome/browser/prefs/incognito_mode_prefs.h" #include "chrome/browser/profiles/profile.h" -#include "chrome/browser/profiles/profile_info_cache.h" +#include "chrome/browser/profiles/profile_attributes_storage.h" #include "chrome/browser/profiles/profile_manager.h" #include "chrome/browser/search/search.h" #include "chrome/browser/sessions/session_service_factory.h" @@ -2324,9 +2324,10 @@ IN_PROC_BROWSER_TEST_F(LaunchBrowserWithNonAsciiUserDatadir, // Verify that the window is present. ASSERT_TRUE(browser()); ASSERT_TRUE(browser()->profile()); - // Verify that the profile has been added correctly to the ProfileInfoCache. + // Verify that the profile has been added correctly to the + // ProfileAttributesStorage. ASSERT_EQ(1u, g_browser_process->profile_manager()-> - GetProfileInfoCache().GetNumberOfProfiles()); + GetProfileAttributesStorage().GetNumberOfProfiles()); } #endif // defined(OS_WIN) @@ -2354,9 +2355,10 @@ IN_PROC_BROWSER_TEST_F(LaunchBrowserWithTrailingSlashDatadir, // Verify that the window is present. ASSERT_TRUE(browser()); ASSERT_TRUE(browser()->profile()); - // Verify that the profile has been added correctly to the ProfileInfoCache. + // Verify that the profile has been added correctly to the + // ProfileAttributesStorage. ASSERT_EQ(1u, g_browser_process->profile_manager()-> - GetProfileInfoCache().GetNumberOfProfiles()); + GetProfileAttributesStorage().GetNumberOfProfiles()); } #endif // defined(OS_WIN) diff --git a/chrome/browser/ui/startup/startup_browser_creator.cc b/chrome/browser/ui/startup/startup_browser_creator.cc index c99e19d..a03c8e0 100644 --- a/chrome/browser/ui/startup/startup_browser_creator.cc +++ b/chrome/browser/ui/startup/startup_browser_creator.cc @@ -45,6 +45,8 @@ #include "chrome/browser/prefs/incognito_mode_prefs.h" #include "chrome/browser/prefs/session_startup_pref.h" #include "chrome/browser/profiles/profile.h" +#include "chrome/browser/profiles/profile_attributes_entry.h" +#include "chrome/browser/profiles/profile_attributes_storage.h" #include "chrome/browser/profiles/profile_manager.h" #include "chrome/browser/profiles/profiles_state.h" #include "chrome/browser/search_engines/template_url_service_factory.h" @@ -269,13 +271,13 @@ bool ShowUserManagerOnStartupIfNeeded( // ChromeOS never shows the User Manager on startup. return false; #else - const ProfileInfoCache& profile_info = - g_browser_process->profile_manager()->GetProfileInfoCache(); - size_t profile_index = profile_info.GetIndexOfProfileWithPath( - last_used_profile->GetPath()); + ProfileAttributesEntry* entry = nullptr; + bool has_entry = + g_browser_process->profile_manager() + ->GetProfileAttributesStorage() + .GetProfileAttributesWithPath(last_used_profile->GetPath(), &entry); - if (profile_index == std::string::npos || - !profile_info.ProfileIsSigninRequiredAtIndex(profile_index)) { + if (!has_entry || !entry->IsSigninRequired()) { // Signin is not required. However, guest, system or locked profiles cannot // be re-opened on startup. The only exception is if there's already a Guest // window open in a separate process (for example, launching a new browser @@ -447,14 +449,14 @@ SessionStartupPref StartupBrowserCreator::GetSessionStartupPref( // A browser starting for a profile being unlocked should always restore. if (!profile->IsGuestSession()) { - ProfileInfoCache& info_cache = - g_browser_process->profile_manager()->GetProfileInfoCache(); - size_t index = info_cache.GetIndexOfProfileWithPath(profile->GetPath()); + ProfileAttributesEntry* entry = nullptr; + bool has_entry = + g_browser_process->profile_manager() + ->GetProfileAttributesStorage() + .GetProfileAttributesWithPath(profile->GetPath(), &entry); - if (index != std::string::npos && - info_cache.ProfileIsSigninRequiredAtIndex(index)) { + if (has_entry && entry->IsSigninRequired()) pref.type = SessionStartupPref::LAST; - } } if (pref.type == SessionStartupPref::LAST && diff --git a/chrome/browser/ui/sync/one_click_signin_sync_starter.cc b/chrome/browser/ui/sync/one_click_signin_sync_starter.cc index 64a85b7..b01c15f 100644 --- a/chrome/browser/ui/sync/one_click_signin_sync_starter.cc +++ b/chrome/browser/ui/sync/one_click_signin_sync_starter.cc @@ -17,8 +17,8 @@ #endif #include "chrome/browser/profiles/profile.h" +#include "chrome/browser/profiles/profile_attributes_storage.h" #include "chrome/browser/profiles/profile_avatar_icon_util.h" -#include "chrome/browser/profiles/profile_info_cache.h" #include "chrome/browser/profiles/profile_io_data.h" #include "chrome/browser/profiles/profile_manager.h" #include "chrome/browser/profiles/profile_window.h" @@ -273,7 +273,7 @@ void OneClickSigninSyncStarter::CreateNewSignedInProfile() { // Create a new profile and have it call back when done so we can inject our // signin credentials. size_t icon_index = g_browser_process->profile_manager()-> - GetProfileInfoCache().ChooseAvatarIconIndexForNewProfile(); + GetProfileAttributesStorage().ChooseAvatarIconIndexForNewProfile(); ProfileManager::CreateMultiProfileAsync( base::UTF8ToUTF16(signin->GetUsernameForAuthInProgress()), profiles::GetDefaultAvatarIconUrl(icon_index), diff --git a/chrome/browser/ui/webui/signin/user_manager_screen_handler.cc b/chrome/browser/ui/webui/signin/user_manager_screen_handler.cc index 41ce878..c5851af 100644 --- a/chrome/browser/ui/webui/signin/user_manager_screen_handler.cc +++ b/chrome/browser/ui/webui/signin/user_manager_screen_handler.cc @@ -21,9 +21,9 @@ #include "chrome/browser/chrome_notification_types.h" #include "chrome/browser/extensions/api/screenlock_private/screenlock_private_api.h" #include "chrome/browser/profiles/profile.h" +#include "chrome/browser/profiles/profile_attributes_entry.h" +#include "chrome/browser/profiles/profile_attributes_storage.h" #include "chrome/browser/profiles/profile_avatar_icon_util.h" -#include "chrome/browser/profiles/profile_info_cache.h" -#include "chrome/browser/profiles/profile_info_cache_observer.h" #include "chrome/browser/profiles/profile_manager.h" #include "chrome/browser/profiles/profile_metrics.h" #include "chrome/browser/profiles/profile_statistics.h" |
