Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_UTILITY_PROFILE_IMPORT_HANDLER_H_ | |
| 6 #define CHROME_UTILITY_PROFILE_IMPORT_HANDLER_H_ | |
| 7 | |
| 8 #include "base/basictypes.h" | |
| 9 #include "base/memory/ref_counted.h" | |
| 10 #include "base/memory/scoped_ptr.h" | |
| 11 #include "ipc/ipc_listener.h" | |
| 12 | |
| 13 class ExternalProcessImporterBridge; | |
| 14 class Importer; | |
| 15 | |
| 16 namespace base { | |
| 17 class DictionaryValue; | |
| 18 class Thread; | |
| 19 } | |
| 20 | |
| 21 namespace importer { | |
| 22 struct SourceProfile; | |
| 23 } | |
| 24 | |
| 25 namespace IPC { | |
| 26 class Message; | |
|
jam
2012/07/18 16:28:33
nit: not needed since you include ipc_listener.h
Philippe
2012/07/18 16:54:52
Done.
| |
| 27 } | |
| 28 | |
| 29 namespace chrome { | |
| 30 | |
| 31 // Class used by ChromeContentUtilityClient that handles profile import. This | |
|
jam
2012/07/18 16:28:33
this comment is just describing what the code does
Philippe
2012/07/18 16:54:52
Done.
| |
| 32 // class processes StartImport, CancelImport and ReportImportItemFinished | |
| 33 // messages received through its OnMessageReceived() method. | |
| 34 class ProfileImportHandler : public IPC::Listener { | |
| 35 public: | |
| 36 ProfileImportHandler(); | |
| 37 ~ProfileImportHandler(); | |
| 38 | |
| 39 // IPC::Listener: | |
| 40 virtual bool OnMessageReceived(const IPC::Message& message); | |
| 41 | |
| 42 private: | |
| 43 void OnImportStart( | |
| 44 const importer::SourceProfile& source_profile, | |
| 45 uint16 items, | |
| 46 const base::DictionaryValue& localized_strings); | |
| 47 | |
| 48 void OnImportCancel(); | |
|
jam
2012/07/18 16:28:33
nit: put all the IPC message handlers beside each
Philippe
2012/07/18 16:54:52
Done.
| |
| 49 | |
| 50 // The following are used with out of process profile import: | |
| 51 void ImporterCleanup(); | |
| 52 | |
| 53 void OnImportItemFinished(uint16 item); | |
| 54 | |
| 55 static bool Send(IPC::Message* message); | |
| 56 | |
| 57 // Thread that importer runs on, while ProfileImportThread handles messages | |
| 58 // from the browser process. | |
| 59 scoped_ptr<base::Thread> import_thread_; | |
| 60 | |
| 61 // Bridge object is passed to importer, so that it can send IPC calls | |
| 62 // directly back to the ProfileImportProcessHost. | |
| 63 scoped_refptr<ExternalProcessImporterBridge> bridge_; | |
| 64 | |
| 65 // A bitmask of importer::ImportItem. | |
| 66 uint16 items_to_import_; | |
| 67 | |
| 68 // Importer of the appropriate type (Firefox, Safari, IE, etc.) | |
| 69 scoped_refptr<Importer> importer_; | |
| 70 }; | |
| 71 | |
| 72 } // namespace chrome | |
| 73 | |
| 74 #endif // CHROME_UTILITY_PROFILE_IMPORT_HANDLER_H_ | |
| OLD | NEW |