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

Unified Diff: chrome/browser/sync/token_migrator.h

Issue 3305003: New authorization framework for sync. ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 3 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
« no previous file with comments | « chrome/browser/sync/test_profile_sync_service.h ('k') | chrome/browser/sync/token_migrator.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/sync/token_migrator.h
===================================================================
--- chrome/browser/sync/token_migrator.h (revision 0)
+++ chrome/browser/sync/token_migrator.h (revision 0)
@@ -0,0 +1,51 @@
+// Copyright (c) 2010 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 <string>
+
+#include "base/file_path.h"
+#include "base/task.h"
+
+class ProfileSyncService;
+
+// The TokenMigrator provides a bridge between the IO thread and
+// the UI thread to load the old-style credentials from the user
+// settings DB, and post them back to the UI thread to store the
+// token in the token service.
+class TokenMigrator {
+ public:
+ TokenMigrator(ProfileSyncService* service,
+ const FilePath& profile_path);
+ ~TokenMigrator();
+
+ // This is called on the UI thread, it only posts a task.
+ // If migration succeeds, the tokens will become available in
+ // the token service.
+ void TryMigration();
+
+ private:
+ // This runs as a deferred task on the IO thread.
tim (not reviewing) 2010/09/07 22:01:52 nit- s / IO / DB
+ void LoadTokens();
+
+ // This runs as a deferred task on the UI thread (only after the IO thread is
tim (not reviewing) 2010/09/07 22:01:52 nit s/IO/DB
+ // finished with the data.
+ void PostTokensBack();
+
+ // The username and token retrieved from the user settings DB.
+ std::string username_;
+ std::string token_;
+
+ // The ProfileSyncService owns this object, so this pointer is valid when
+ // PostTokensBack is called.
+ ProfileSyncService* service_;
+
+ // Pending tasks, stored so they can be canceled if this object is destroyed.
+ CancelableTask* loading_task_;
+
+ // The directory to search for the user settings database.
+ FilePath database_location_;
tim (not reviewing) 2010/09/07 22:01:52 DISALLOW_COPY_AND_ASSIGN
+};
+
+// We ensure this object will outlive its tasks, so don't need refcounting.
+DISABLE_RUNNABLE_METHOD_REFCOUNT(TokenMigrator);
« no previous file with comments | « chrome/browser/sync/test_profile_sync_service.h ('k') | chrome/browser/sync/token_migrator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698