Commit 464ab1d1 authored by Marc Treib's avatar Marc Treib Committed by Commit Bot

Remove dead PasswordStoreFactory code around "local profile ID"

After https://crrev.com/c/1713560 this isn't used anymore.

This also lets us deprecate the kLocalProfileId pref, and remove
password_manager_util_linux.h/cc.

Bug: 950269
Change-Id: Ib0cdc5a0552430a0c087b637eadd7f18e24ea19e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1720639Reviewed-by: default avatarVasilii Sukhanov <vasilii@chromium.org>
Reviewed-by: default avatarChristos Froussios <cfroussios@chromium.org>
Commit-Queue: Marc Treib <treib@chromium.org>
Cr-Commit-Position: refs/heads/master@{#683562}
parent 62837a9c
...@@ -1028,8 +1028,6 @@ jumbo_split_static_library("browser") { ...@@ -1028,8 +1028,6 @@ jumbo_split_static_library("browser") {
"page_load_metrics/resource_tracker.h", "page_load_metrics/resource_tracker.h",
"password_manager/chrome_password_manager_client.cc", "password_manager/chrome_password_manager_client.cc",
"password_manager/chrome_password_manager_client.h", "password_manager/chrome_password_manager_client.h",
"password_manager/password_manager_util_linux.cc",
"password_manager/password_manager_util_linux.h",
"password_manager/password_manager_util_mac.h", "password_manager/password_manager_util_mac.h",
"password_manager/password_manager_util_mac.mm", "password_manager/password_manager_util_mac.mm",
"password_manager/password_manager_util_win.cc", "password_manager/password_manager_util_win.cc",
......
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/password_manager/password_manager_util_linux.h"
#if !defined(OS_CHROMEOS)
#include "base/strings/stringprintf.h"
const char kLibsecretAndGnomeAppString[] = "chrome";
// Generates a profile-specific app string based on profile_id_.
std::string GetProfileSpecificAppString(LocalProfileId id) {
// Originally, the application string was always just "chrome" and used only
// so that we had *something* to search for since GNOME Keyring won't search
// for nothing. Now we use it to distinguish passwords for different profiles.
return base::StringPrintf("%s-%d", kLibsecretAndGnomeAppString, id);
}
#endif // !OS_CHROMEOS
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_MANAGER_UTIL_LINUX_H_
#define CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_MANAGER_UTIL_LINUX_H_
#include <limits>
#include <string>
#include "build/build_config.h"
#include "chrome/browser/password_manager/password_store_factory.h"
#if !defined(OS_CHROMEOS)
constexpr int kMaxPossibleTimeTValue = std::numeric_limits<int>::max();
extern const char kLibsecretAndGnomeAppString[];
// Generates a profile-specific app string based on profile_id_.
std::string GetProfileSpecificAppString(LocalProfileId id);
#endif // !OS_CHROMEOS
#endif // CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_MANAGER_UTIL_LINUX_H_
...@@ -8,10 +8,6 @@ ...@@ -8,10 +8,6 @@
#include <utility> #include <utility>
#include "base/bind.h" #include "base/bind.h"
#include "base/command_line.h"
#include "base/environment.h"
#include "base/metrics/histogram_macros.h"
#include "base/rand_util.h"
#include "build/build_config.h" #include "build/build_config.h"
#include "chrome/browser/browser_process.h" #include "chrome/browser/browser_process.h"
#include "chrome/browser/profiles/incognito_helpers.h" #include "chrome/browser/profiles/incognito_helpers.h"
...@@ -22,9 +18,7 @@ ...@@ -22,9 +18,7 @@
#include "chrome/browser/sync/profile_sync_service_factory.h" #include "chrome/browser/sync/profile_sync_service_factory.h"
#include "chrome/browser/web_data_service_factory.h" #include "chrome/browser/web_data_service_factory.h"
#include "chrome/common/chrome_paths_internal.h" #include "chrome/common/chrome_paths_internal.h"
#include "chrome/common/chrome_switches.h"
#include "components/keyed_service/content/browser_context_dependency_manager.h" #include "components/keyed_service/content/browser_context_dependency_manager.h"
#include "components/os_crypt/os_crypt_switches.h"
#include "components/password_manager/core/browser/login_database.h" #include "components/password_manager/core/browser/login_database.h"
#include "components/password_manager/core/browser/password_manager_constants.h" #include "components/password_manager/core/browser/password_manager_constants.h"
#include "components/password_manager/core/browser/password_manager_onboarding.h" #include "components/password_manager/core/browser/password_manager_onboarding.h"
...@@ -61,8 +55,6 @@ using password_manager::PasswordStore; ...@@ -61,8 +55,6 @@ using password_manager::PasswordStore;
namespace { namespace {
#if defined(USE_X11) #if defined(USE_X11)
constexpr LocalProfileId kInvalidLocalProfileId =
static_cast<LocalProfileId>(0);
constexpr PasswordStoreX::MigrationToLoginDBStep constexpr PasswordStoreX::MigrationToLoginDBStep
kMigrationToLoginDBNotAttempted = PasswordStoreX::NOT_ATTEMPTED; kMigrationToLoginDBNotAttempted = PasswordStoreX::NOT_ATTEMPTED;
#endif #endif
...@@ -128,28 +120,6 @@ PasswordStoreFactory::PasswordStoreFactory() ...@@ -128,28 +120,6 @@ PasswordStoreFactory::PasswordStoreFactory()
PasswordStoreFactory::~PasswordStoreFactory() {} PasswordStoreFactory::~PasswordStoreFactory() {}
#if defined(USE_X11)
LocalProfileId PasswordStoreFactory::GetLocalProfileId(
PrefService* prefs) const {
LocalProfileId id =
prefs->GetInteger(password_manager::prefs::kLocalProfileId);
if (id == kInvalidLocalProfileId) {
// Note that there are many more users than this. Thus, by design, this is
// not a unique id. However, it is large enough that it is very unlikely
// that it would be repeated twice on a single machine. It is still possible
// for that to occur though, so the potential results of it actually
// happening should be considered when using this value.
static const int kLocalProfileIdMask = (1 << 24) - 1;
do {
id = base::RandInt(0, kLocalProfileIdMask);
// TODO(mdm): scan other profiles to make sure they are not using this id?
} while (id == kInvalidLocalProfileId);
prefs->SetInteger(password_manager::prefs::kLocalProfileId, id);
}
return id;
}
#endif
scoped_refptr<RefcountedKeyedService> scoped_refptr<RefcountedKeyedService>
PasswordStoreFactory::BuildServiceInstanceFor( PasswordStoreFactory::BuildServiceInstanceFor(
content::BrowserContext* context) const { content::BrowserContext* context) const {
...@@ -225,8 +195,6 @@ void PasswordStoreFactory::RegisterProfilePrefs( ...@@ -225,8 +195,6 @@ void PasswordStoreFactory::RegisterProfilePrefs(
#if defined(USE_X11) #if defined(USE_X11)
// Notice that the preprocessor conditions above are exactly those that will // Notice that the preprocessor conditions above are exactly those that will
// result in using PasswordStoreX in BuildServiceInstanceFor(). // result in using PasswordStoreX in BuildServiceInstanceFor().
registry->RegisterIntegerPref(password_manager::prefs::kLocalProfileId,
kInvalidLocalProfileId);
registry->RegisterIntegerPref( registry->RegisterIntegerPref(
password_manager::prefs::kMigrationToLoginDBStep, password_manager::prefs::kMigrationToLoginDBStep,
kMigrationToLoginDBNotAttempted); kMigrationToLoginDBNotAttempted);
......
...@@ -13,21 +13,12 @@ ...@@ -13,21 +13,12 @@
#include "components/keyed_service/content/refcounted_browser_context_keyed_service_factory.h" #include "components/keyed_service/content/refcounted_browser_context_keyed_service_factory.h"
#include "components/keyed_service/core/service_access_type.h" #include "components/keyed_service/core/service_access_type.h"
class PrefService;
class Profile; class Profile;
namespace password_manager { namespace password_manager {
class PasswordStore; class PasswordStore;
} }
#if !defined(OS_MACOSX) && !defined(OS_CHROMEOS) && defined(OS_POSIX)
// Local profile ids are used to associate resources stored outside the profile
// directory, like saved passwords in GNOME Keyring / KWallet, with a profile.
// With high probability, they are unique on the local machine. They are almost
// certainly not unique globally, by design. Do not send them over the network.
typedef int LocalProfileId;
#endif
// Singleton that owns all PasswordStores and associates them with // Singleton that owns all PasswordStores and associates them with
// Profiles. // Profiles.
class PasswordStoreFactory class PasswordStoreFactory
...@@ -49,10 +40,6 @@ class PasswordStoreFactory ...@@ -49,10 +40,6 @@ class PasswordStoreFactory
PasswordStoreFactory(); PasswordStoreFactory();
~PasswordStoreFactory() override; ~PasswordStoreFactory() override;
#if !defined(OS_MACOSX) && !defined(OS_CHROMEOS) && defined(OS_POSIX)
LocalProfileId GetLocalProfileId(PrefService* prefs) const;
#endif
// RefcountedBrowserContextKeyedServiceFactory: // RefcountedBrowserContextKeyedServiceFactory:
scoped_refptr<RefcountedKeyedService> BuildServiceInstanceFor( scoped_refptr<RefcountedKeyedService> BuildServiceInstanceFor(
content::BrowserContext* context) const override; content::BrowserContext* context) const override;
......
...@@ -480,6 +480,9 @@ const char kWebAuthnBlePairedMacAddressesPrefName[] = ...@@ -480,6 +480,9 @@ const char kWebAuthnBlePairedMacAddressesPrefName[] =
// Deprecated 7/2019 // Deprecated 7/2019
const char kLastKnownGoogleURL[] = "browser.last_known_google_url"; const char kLastKnownGoogleURL[] = "browser.last_known_google_url";
const char kLastPromptedGoogleURL[] = "browser.last_prompted_google_url"; const char kLastPromptedGoogleURL[] = "browser.last_prompted_google_url";
#if defined(USE_X11)
constexpr char kLocalProfileId[] = "profile.local_profile_id";
#endif
// Register prefs used only for migration (clearing or moving to a new key). // Register prefs used only for migration (clearing or moving to a new key).
void RegisterProfilePrefsForMigration( void RegisterProfilePrefsForMigration(
...@@ -550,6 +553,9 @@ void RegisterProfilePrefsForMigration( ...@@ -550,6 +553,9 @@ void RegisterProfilePrefsForMigration(
registry->RegisterStringPref(kLastKnownGoogleURL, std::string()); registry->RegisterStringPref(kLastKnownGoogleURL, std::string());
registry->RegisterStringPref(kLastPromptedGoogleURL, std::string()); registry->RegisterStringPref(kLastPromptedGoogleURL, std::string());
#if defined(USE_X11)
registry->RegisterIntegerPref(kLocalProfileId, 0);
#endif
} }
} // namespace } // namespace
...@@ -1141,4 +1147,9 @@ void MigrateObsoleteProfilePrefs(Profile* profile) { ...@@ -1141,4 +1147,9 @@ void MigrateObsoleteProfilePrefs(Profile* profile) {
profile_prefs->ClearPref(kWebAuthnLastTransportUsedPrefName); profile_prefs->ClearPref(kWebAuthnLastTransportUsedPrefName);
profile_prefs->ClearPref(kWebAuthnBlePairedMacAddressesPrefName); profile_prefs->ClearPref(kWebAuthnBlePairedMacAddressesPrefName);
#endif // defined(OS_ANDROID) #endif // defined(OS_ANDROID)
// Added 7/2019.
#if defined(USE_X11)
profile_prefs->ClearPref(kLocalProfileId);
#endif
} }
...@@ -15,7 +15,6 @@ const char kCredentialsEnableAutosignin[] = "credentials_enable_autosignin"; ...@@ -15,7 +15,6 @@ const char kCredentialsEnableAutosignin[] = "credentials_enable_autosignin";
const char kCredentialsEnableService[] = "credentials_enable_service"; const char kCredentialsEnableService[] = "credentials_enable_service";
#if !defined(OS_MACOSX) && !defined(OS_CHROMEOS) && defined(OS_POSIX) #if !defined(OS_MACOSX) && !defined(OS_CHROMEOS) && defined(OS_POSIX)
const char kLocalProfileId[] = "profile.local_profile_id";
const char kMigrationToLoginDBStep[] = "profile.migration_to_logindb_step"; const char kMigrationToLoginDBStep[] = "profile.migration_to_logindb_step";
#endif #endif
......
...@@ -29,9 +29,6 @@ extern const char kCredentialsEnableAutosignin[]; ...@@ -29,9 +29,6 @@ extern const char kCredentialsEnableAutosignin[];
extern const char kCredentialsEnableService[]; extern const char kCredentialsEnableService[];
#if !defined(OS_MACOSX) && !defined(OS_CHROMEOS) && defined(OS_POSIX) #if !defined(OS_MACOSX) && !defined(OS_CHROMEOS) && defined(OS_POSIX)
// The local profile id for this profile.
extern const char kLocalProfileId[];
// The current state of the migration to LoginDB from Keyring/Kwallet on Linux. // The current state of the migration to LoginDB from Keyring/Kwallet on Linux.
extern const char kMigrationToLoginDBStep[]; extern const char kMigrationToLoginDBStep[];
#endif #endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment