OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_UTILITY_PROFILE_IMPORT_HANDLER_H_ | 5 #ifndef CHROME_UTILITY_PROFILE_IMPORT_HANDLER_H_ |
6 #define CHROME_UTILITY_PROFILE_IMPORT_HANDLER_H_ | 6 #define CHROME_UTILITY_PROFILE_IMPORT_HANDLER_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "chrome/utility/utility_message_handler.h" | 12 #include "chrome/utility/utility_message_handler.h" |
13 | 13 |
14 class ExternalProcessImporterBridge; | 14 class ExternalProcessImporterBridge; |
15 class Importer; | 15 class Importer; |
16 | 16 |
17 namespace base { | 17 namespace base { |
18 class DictionaryValue; | 18 class DictionaryValue; |
19 class Thread; | 19 class Thread; |
20 } | 20 } |
21 | 21 |
22 namespace importer { | 22 namespace importer { |
23 struct SourceProfile; | 23 struct SourceProfile; |
24 } | 24 } |
25 | 25 |
26 // Dispatches IPCs for out of process profile import. | 26 // Dispatches IPCs for out of process profile import. |
27 class ProfileImportHandler : public UtilityMessageHandler { | 27 class ProfileImportHandler : public UtilityMessageHandler { |
28 public: | 28 public: |
29 ProfileImportHandler(); | 29 ProfileImportHandler(); |
30 virtual ~ProfileImportHandler(); | 30 ~ProfileImportHandler() override; |
31 | 31 |
32 // IPC::Listener: | 32 // IPC::Listener: |
33 virtual bool OnMessageReceived(const IPC::Message& message) override; | 33 bool OnMessageReceived(const IPC::Message& message) override; |
34 | 34 |
35 private: | 35 private: |
36 void OnImportStart( | 36 void OnImportStart( |
37 const importer::SourceProfile& source_profile, | 37 const importer::SourceProfile& source_profile, |
38 uint16 items, | 38 uint16 items, |
39 const base::DictionaryValue& localized_strings); | 39 const base::DictionaryValue& localized_strings); |
40 void OnImportCancel(); | 40 void OnImportCancel(); |
41 void OnImportItemFinished(uint16 item); | 41 void OnImportItemFinished(uint16 item); |
42 | 42 |
43 // The following are used with out of process profile import: | 43 // The following are used with out of process profile import: |
44 void ImporterCleanup(); | 44 void ImporterCleanup(); |
45 | 45 |
46 // Thread that importer runs on, while ProfileImportThread handles messages | 46 // Thread that importer runs on, while ProfileImportThread handles messages |
47 // from the browser process. | 47 // from the browser process. |
48 scoped_ptr<base::Thread> import_thread_; | 48 scoped_ptr<base::Thread> import_thread_; |
49 | 49 |
50 // Bridge object is passed to importer, so that it can send IPC calls | 50 // Bridge object is passed to importer, so that it can send IPC calls |
51 // directly back to the ProfileImportProcessHost. | 51 // directly back to the ProfileImportProcessHost. |
52 scoped_refptr<ExternalProcessImporterBridge> bridge_; | 52 scoped_refptr<ExternalProcessImporterBridge> bridge_; |
53 | 53 |
54 // A bitmask of importer::ImportItem. | 54 // A bitmask of importer::ImportItem. |
55 uint16 items_to_import_; | 55 uint16 items_to_import_; |
56 | 56 |
57 // Importer of the appropriate type (Firefox, Safari, IE, etc.) | 57 // Importer of the appropriate type (Firefox, Safari, IE, etc.) |
58 scoped_refptr<Importer> importer_; | 58 scoped_refptr<Importer> importer_; |
59 }; | 59 }; |
60 | 60 |
61 #endif // CHROME_UTILITY_PROFILE_IMPORT_HANDLER_H_ | 61 #endif // CHROME_UTILITY_PROFILE_IMPORT_HANDLER_H_ |
OLD | NEW |