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

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: vabr@ comments Created 5 years, 5 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..63ef6a2f4d0d42bd08f0ba0b83da74086001841c 100644
--- a/chrome/browser/password_manager/password_store_proxy_mac.h
+++ b/chrome/browser/password_manager/password_store_proxy_mac.h
@@ -5,8 +5,12 @@
#ifndef CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_STORE_PROXY_MAC_H_
#define CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_STORE_PROXY_MAC_H_
+#include <deque>
+
+#include "base/prefs/pref_member.h"
#include "base/threading/thread.h"
#include "components/password_manager/core/browser/password_store.h"
+#include "components/password_manager/core/common/password_manager_pref_names.h"
namespace crypto {
class AppleKeychain;
@@ -28,7 +32,8 @@ class PasswordStoreProxyMac : public password_manager::PasswordStore {
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 +52,13 @@ class PasswordStoreProxyMac : public password_manager::PasswordStore {
password_manager::PasswordStore* GetBackend() const;
// Opens LoginDatabase on the background |thread_|.
- void InitOnBackgroundThread();
+ void InitOnBackgroundThread(password_manager::MigrationStatus status);
+
+ // Writes status to the prefs.
+ void UpdateStatusPref(password_manager::MigrationStatus status);
+
+ // Executes |pending_ui_tasks_| on the UI thread.
+ void FlushPendingTasks();
// PasswordStore:
void ReportMetricsImpl(const std::string& sync_username,
@@ -82,11 +93,23 @@ class PasswordStoreProxyMac : public password_manager::PasswordStore {
// The login metadata SQL database. If opening the DB on |thread_| fails,
// |login_metadata_db_| will be reset to NULL for the lifetime of |this|.
+ // The ownership may be transferred to |password_store_simple_|.
scoped_ptr<password_manager::LoginDatabase> login_metadata_db_;
// Thread that the synchronous methods are run on.
scoped_ptr<base::Thread> thread_;
+ // Current migration status for the profile.
+ IntegerPrefMember migration_status_;
+
+ // List of tasks filled by InitOnBackgroundThread. They can't be just posted
+ // to the UI thread because the message loop can shut down before executing
+ // them. If this is the case then Shutdown() flushes the tasks after stopping
+ // the background thread.
+ // After InitOnBackgroundThread is run once, the queue may not be modified on
+ // the background thread any more.
+ std::deque<base::Closure> pending_ui_tasks_;
Garrett Casto 2015/07/06 21:38:54 Why is this a deque and not a vector?
vasilii 2015/07/07 15:45:54 Done.
+
DISALLOW_COPY_AND_ASSIGN(PasswordStoreProxyMac);
};

Powered by Google App Engine
This is Rietveld 408576698