OLD | NEW |
| (Empty) |
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. | |
4 | |
5 #ifndef CHROME_BROWSER_IMPORTER_IMPORTER_H_ | |
6 #define CHROME_BROWSER_IMPORTER_IMPORTER_H_ | |
7 | |
8 #include "base/basictypes.h" | |
9 #include "base/memory/ref_counted.h" | |
10 | |
11 class ImporterBridge; | |
12 | |
13 namespace importer { | |
14 struct SourceProfile; | |
15 } | |
16 | |
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; | |
27 | |
28 // Cancels the import process. | |
29 virtual void Cancel(); | |
30 | |
31 bool cancelled() const { return cancelled_; } | |
32 | |
33 protected: | |
34 friend class base::RefCountedThreadSafe<Importer>; | |
35 | |
36 Importer(); | |
37 virtual ~Importer(); | |
38 | |
39 scoped_refptr<ImporterBridge> bridge_; | |
40 | |
41 private: | |
42 // True if the caller cancels the import process. | |
43 bool cancelled_; | |
44 | |
45 DISALLOW_COPY_AND_ASSIGN(Importer); | |
46 }; | |
47 | |
48 #endif // CHROME_BROWSER_IMPORTER_IMPORTER_H_ | |
OLD | NEW |