password_model_worker.h revision 3345a6884c488ff3a535c2c9acdd33d74b37e311
1// Copyright (c) 2010 The Chromium Authors. All rights reserved. 2// Use of this source code is governed by a BSD-style license that can be 3// found in the LICENSE file. 4 5#ifndef CHROME_BROWSER_SYNC_GLUE_PASSWORD_MODEL_WORKER_H_ 6#define CHROME_BROWSER_SYNC_GLUE_PASSWORD_MODEL_WORKER_H_ 7#pragma once 8 9#include "chrome/browser/sync/engine/model_safe_worker.h" 10 11#include "base/basictypes.h" 12#include "base/callback.h" 13#include "base/ref_counted.h" 14 15class PasswordStore; 16 17namespace base { 18class WaitableEvent; 19} 20 21namespace browser_sync { 22 23// A ModelSafeWorker for password models that accepts requests 24// from the syncapi that need to be fulfilled on the password thread, 25// which is the DB thread on Linux and Windows. 26class PasswordModelWorker : public browser_sync::ModelSafeWorker { 27 public: 28 explicit PasswordModelWorker(PasswordStore* password_store); 29 30 // ModelSafeWorker implementation. Called on syncapi SyncerThread. 31 void DoWorkAndWaitUntilDone(Callback0::Type* work); 32 virtual ModelSafeGroup GetModelSafeGroup() { return GROUP_PASSWORD; } 33 virtual bool CurrentThreadIsWorkThread(); 34 35 private: 36 void CallDoWorkAndSignalTask(Callback0::Type* work, 37 base::WaitableEvent* done); 38 39 scoped_refptr<PasswordStore> password_store_; 40 DISALLOW_COPY_AND_ASSIGN(PasswordModelWorker); 41}; 42 43} // namespace browser_sync 44 45#endif // CHROME_BROWSER_SYNC_GLUE_PASSWORD_MODEL_WORKER_H_ 46