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

Unified Diff: chrome/browser/password_manager/password_store_proxy_mac.h

Issue 1213043003: Start the migration of passwords from the Keychain. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 months 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/password_manager/password_store_proxy_mac.h
diff --git a/chrome/browser/password_manager/password_store_proxy_mac.h b/chrome/browser/password_manager/password_store_proxy_mac.h
index 67029cf3ceec3be5219ef9f0993db80496d74d6f..b9da23f6086b23c0e02fbb8885b87fb89289af44 100644
--- a/chrome/browser/password_manager/password_store_proxy_mac.h
+++ b/chrome/browser/password_manager/password_store_proxy_mac.h
@@ -5,6 +5,8 @@
#ifndef CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_STORE_PROXY_MAC_H_
#define CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_STORE_PROXY_MAC_H_
+#include "base/prefs/pref_member.h"
+#include "base/synchronization/waitable_event.h"
#include "base/threading/thread.h"
#include "components/password_manager/core/browser/password_store.h"
@@ -25,10 +27,27 @@ class SimplePasswordStoreMac;
// user's state.
class PasswordStoreProxyMac : public password_manager::PasswordStore {
public:
+ enum MigrationStatus {
+ // Migration wasn't tried yet.
+ NOT_STARTED = 0,
+
+ // Migration finished successfully.
+ MIGRATED,
+
+ // Migration failed once. It should be tried again.
+ FAILED_ONCE,
+
+ // Migration failed twice. It should not be tried again.
+ FAILED_TWICE,
+
+ NUM_MIGRATION_STATUS,
+ };
+
PasswordStoreProxyMac(
scoped_refptr<base::SingleThreadTaskRunner> main_thread_runner,
scoped_ptr<crypto::AppleKeychain> keychain,
- scoped_ptr<password_manager::LoginDatabase> login_db);
+ scoped_ptr<password_manager::LoginDatabase> login_db,
+ PrefService* prefs);
bool Init(const syncer::SyncableService::StartSyncFlare& flare) override;
void Shutdown() override;
@@ -47,7 +66,13 @@ class PasswordStoreProxyMac : public password_manager::PasswordStore {
password_manager::PasswordStore* GetBackend() const;
// Opens LoginDatabase on the background |thread_|.
- void InitOnBackgroundThread();
+ void InitOnBackgroundThread(MigrationStatus status);
+
+ // Writes status to the prefs.
+ void UpdateStatusPref(MigrationStatus status);
+
+ // Reports |status| via UMA.
+ static void ReportStatusPref(MigrationStatus status);
// PasswordStore:
void ReportMetricsImpl(const std::string& sync_username,
@@ -87,6 +112,12 @@ class PasswordStoreProxyMac : public password_manager::PasswordStore {
// Thread that the synchronous methods are run on.
scoped_ptr<base::Thread> thread_;
+ // Current migration status for the profile.
+ IntegerPrefMember migration_status_;
+
+ // Signals the main thread that the migration is finished or won't be done.
+ base::WaitableEvent migration_completion_;
+
DISALLOW_COPY_AND_ASSIGN(PasswordStoreProxyMac);
};

Powered by Google App Engine
This is Rietveld 408576698