Skip to content

Commit

Permalink
Mark many functions as not used on Android in profiles_state.h.
Browse files Browse the repository at this point in the history
Change-Id: I8a8c0ba1da296572c5c661a82faa15c776200671
Reviewed-on: https://chromium-review.googlesource.com/1123895
Reviewed-by: Mihai Sardarescu <msarda@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/master@{#572285}
  • Loading branch information
leizleiz authored and Commit Bot committed Jul 3, 2018
1 parent 9109da6 commit 39ff0c7
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 19 deletions.
28 changes: 15 additions & 13 deletions chrome/browser/profiles/profiles_state.cc
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,18 @@ void RegisterPrefs(PrefRegistrySimple* registry) {
registry->RegisterBooleanPref(prefs::kForceBrowserSignin, false);
}

void SetLastUsedProfile(const std::string& profile_dir) {
// We should never be saving the System Profile as the last one used since it
// shouldn't have a browser.
if (profile_dir == base::FilePath(chrome::kSystemProfileDir).AsUTF8Unsafe())
return;

PrefService* local_state = g_browser_process->local_state();
DCHECK(local_state);
local_state->SetString(prefs::kProfileLastUsed, profile_dir);
}

#if !defined(OS_ANDROID)
base::string16 GetAvatarNameForProfile(const base::FilePath& profile_path) {
base::string16 display_name;

Expand Down Expand Up @@ -160,7 +172,7 @@ std::vector<std::string> GetSecondaryAccountsForProfile(

return accounts;
}
#endif
#endif // !defined(OS_CHROMEOS)

bool IsRegularOrGuestSession(Browser* browser) {
Profile* profile = browser->profile();
Expand Down Expand Up @@ -222,7 +234,7 @@ bool SetActiveProfileToGuestIfLocked() {

return true;
}
#endif
#endif // !defined(OS_CHROMEOS)

void RemoveBrowsingDataForProfile(const base::FilePath& profile_path) {
// The BrowsingDataRemover relies on the ResourceDispatcherHost, which is
Expand All @@ -245,17 +257,6 @@ void RemoveBrowsingDataForProfile(const base::FilePath& profile_path) {
ChromeBrowsingDataRemoverDelegate::ALL_ORIGIN_TYPES);
}

void SetLastUsedProfile(const std::string& profile_dir) {
// We should never be saving the System Profile as the last one used since it
// shouldn't have a browser.
if (profile_dir == base::FilePath(chrome::kSystemProfileDir).AsUTF8Unsafe())
return;

PrefService* local_state = g_browser_process->local_state();
DCHECK(local_state);
local_state->SetString(prefs::kProfileLastUsed, profile_dir);
}

#if !defined(OS_CHROMEOS)
bool AreAllNonChildNonSupervisedProfilesLocked() {
bool at_least_one_regular_profile_present = false;
Expand Down Expand Up @@ -287,5 +288,6 @@ bool IsPublicSession() {
#endif
return false;
}
#endif // !defined(OS_ANDROID)

} // namespace profiles
17 changes: 11 additions & 6 deletions chrome/browser/profiles/profiles_state.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,19 @@
#include <string>

#include "base/strings/string16.h"
#include "build/build_config.h"

#if !defined(OS_CHROMEOS)
#include <vector>

#include "chrome/browser/profiles/avatar_menu.h"
#endif

class Browser;
class PrefRegistrySimple;
class Profile;
class SigninErrorController;

namespace base { class FilePath; }

namespace profiles {
Expand All @@ -36,6 +39,11 @@ base::FilePath GetDefaultProfileDir(const base::FilePath& user_data_dir);
// Register multi-profile related preferences in Local State.
void RegisterPrefs(PrefRegistrySimple* registry);

// Sets the last used profile pref to |profile_dir|, unless |profile_dir| is the
// System Profile directory, which is an invalid last used profile.
void SetLastUsedProfile(const std::string& profile_dir);

#if !defined(OS_ANDROID)
// Returns the display name of the specified on-the-record profile (or guest),
// specified by |profile_path|, used in the avatar button or user manager. If
// |profile_path| is the guest path, it will return IDS_GUEST_PROFILE_NAME. If
Expand Down Expand Up @@ -67,7 +75,7 @@ void UpdateProfileName(Profile* profile,
std::vector<std::string> GetSecondaryAccountsForProfile(
Profile* profile,
const std::string& primary_account);
#endif
#endif // !defined(OS_CHROMEOS)

// Returns whether the |browser|'s profile is a non-incognito or guest profile.
// The distinction is needed because guest profiles are implemented as
Expand Down Expand Up @@ -99,16 +107,12 @@ SigninErrorController* GetSigninErrorController(Profile* profile);
// profile had been Guest before calling or became Guest as a result of this
// method.
bool SetActiveProfileToGuestIfLocked();
#endif
#endif // !defined(OS_CHROMEOS)

// If the profile given by |profile_path| is loaded in the ProfileManager, use
// a BrowsingDataRemover to delete all the Profile's data.
void RemoveBrowsingDataForProfile(const base::FilePath& profile_path);

// Sets the last used profile pref to |profile_dir|, unless |profile_dir| is the
// System Profile directory, which is an invalid last used profile.
void SetLastUsedProfile(const std::string& profile_dir);

#if !defined(OS_CHROMEOS)
// Returns true if there exists at least one non-supervised or non-child profile
// and they are all locked.
Expand All @@ -117,6 +121,7 @@ bool AreAllNonChildNonSupervisedProfilesLocked();

// Returns whether a public session is being run currently.
bool IsPublicSession();
#endif // !defined(OS_ANDROID)

} // namespace profiles

Expand Down

0 comments on commit 39ff0c7

Please sign in to comment.