Fix memory leak in Sync FakeServerEntity
[chromium-blink-merge.git] / chrome / utility / importer / importer.h
blob36483e071a71db196d08f4b087aaa4b5fd71c84c
1 // Copyright (c) 2011 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.
5 #ifndef CHROME_UTILITY_IMPORTER_IMPORTER_H_
6 #define CHROME_UTILITY_IMPORTER_IMPORTER_H_
8 #include "base/basictypes.h"
9 #include "base/memory/ref_counted.h"
11 class ImporterBridge;
13 namespace importer {
14 struct SourceProfile;
17 // The base class of all importers.
18 class Importer : public base::RefCountedThreadSafe<Importer> {
19 public:
20 // All importers should implement this method by adding their import logic.
21 // And it will be run in file thread by ImporterHost. Since we do async
22 // import, the importer should invoke ImporterHost::NotifyImportEnded() to
23 // notify its host that import stuff have been finished.
24 virtual void StartImport(const importer::SourceProfile& source_profile,
25 uint16 items,
26 ImporterBridge* bridge) = 0;
28 // Cancels the import process.
29 virtual void Cancel();
31 bool cancelled() const { return cancelled_; }
33 protected:
34 friend class base::RefCountedThreadSafe<Importer>;
36 Importer();
37 virtual ~Importer();
39 scoped_refptr<ImporterBridge> bridge_;
41 private:
42 // True if the caller cancels the import process.
43 bool cancelled_;
45 DISALLOW_COPY_AND_ASSIGN(Importer);
48 #endif // CHROME_UTILITY_IMPORTER_IMPORTER_H_