| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 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_PROFILE_IMPORT_PROFILE_IMPORT_THREAD_H_ | 5 #ifndef CHROME_PROFILE_IMPORT_PROFILE_IMPORT_THREAD_H_ |
| 6 #define CHROME_PROFILE_IMPORT_PROFILE_IMPORT_THREAD_H_ | 6 #define CHROME_PROFILE_IMPORT_PROFILE_IMPORT_THREAD_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
| 13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 14 #include "base/string16.h" | 14 #include "base/string16.h" |
| 15 #include "chrome/browser/history/history_types.h" | 15 #include "chrome/browser/history/history_types.h" |
| 16 #include "chrome/browser/importer/importer_data_types.h" | 16 #include "chrome/browser/importer/importer_data_types.h" |
| 17 #include "chrome/browser/importer/profile_writer.h" | 17 #include "chrome/browser/importer/profile_writer.h" |
| 18 #include "content/common/child_thread.h" | 18 #include "content/common/child_thread.h" |
| 19 #include "webkit/glue/password_form.h" | 19 #include "webkit/glue/password_form.h" |
| 20 | 20 |
| 21 class DictionaryValue; | |
| 22 class ExternalProcessImporterBridge; | 21 class ExternalProcessImporterBridge; |
| 23 class GURL; | 22 class GURL; |
| 24 class Importer; | 23 class Importer; |
| 25 class TemplateURL; | 24 class TemplateURL; |
| 26 | 25 |
| 27 namespace base { | 26 namespace base { |
| 27 class DictionaryValue; |
| 28 class Thread; | 28 class Thread; |
| 29 } | 29 } |
| 30 | 30 |
| 31 namespace IPC { | 31 namespace IPC { |
| 32 class Message; | 32 class Message; |
| 33 } | 33 } |
| 34 | 34 |
| 35 // This class represents the background thread which communicates with the | 35 // This class represents the background thread which communicates with the |
| 36 // importer work thread in the importer process. | 36 // importer work thread in the importer process. |
| 37 class ProfileImportThread : public ChildThread { | 37 class ProfileImportThread : public ChildThread { |
| (...skipping 30 matching lines...) Expand all Loading... |
| 68 // IPC messages | 68 // IPC messages |
| 69 virtual bool OnControlMessageReceived(const IPC::Message& msg); | 69 virtual bool OnControlMessageReceived(const IPC::Message& msg); |
| 70 | 70 |
| 71 // Creates the importer and launches it in a new thread. Import is run on | 71 // Creates the importer and launches it in a new thread. Import is run on |
| 72 // a separate thread so that this thread can receive messages from the | 72 // a separate thread so that this thread can receive messages from the |
| 73 // main process (especially cancel requests) while the worker thread handles | 73 // main process (especially cancel requests) while the worker thread handles |
| 74 // the actual import. | 74 // the actual import. |
| 75 void OnImportStart( | 75 void OnImportStart( |
| 76 const importer::SourceProfile& source_profile, | 76 const importer::SourceProfile& source_profile, |
| 77 uint16 items, | 77 uint16 items, |
| 78 const DictionaryValue& localized_strings); | 78 const base::DictionaryValue& localized_strings); |
| 79 | 79 |
| 80 // Calls cleanup to stop the import operation. | 80 // Calls cleanup to stop the import operation. |
| 81 void OnImportCancel(); | 81 void OnImportCancel(); |
| 82 | 82 |
| 83 // Called from the main process to notify that an item has been received | 83 // Called from the main process to notify that an item has been received |
| 84 // from the import process. | 84 // from the import process. |
| 85 void OnImportItemFinished(uint16 item); | 85 void OnImportItemFinished(uint16 item); |
| 86 | 86 |
| 87 // Release the process and ourselves. | 87 // Release the process and ourselves. |
| 88 void Cleanup(); | 88 void Cleanup(); |
| 89 | 89 |
| 90 // Thread that importer runs on, while ProfileImportThread handles messages | 90 // Thread that importer runs on, while ProfileImportThread handles messages |
| 91 // from the browser process. | 91 // from the browser process. |
| 92 scoped_ptr<base::Thread> import_thread_; | 92 scoped_ptr<base::Thread> import_thread_; |
| 93 | 93 |
| 94 // Bridge object is passed to importer, so that it can send IPC calls | 94 // Bridge object is passed to importer, so that it can send IPC calls |
| 95 // directly back to the ProfileImportProcessHost. | 95 // directly back to the ProfileImportProcessHost. |
| 96 scoped_refptr<ExternalProcessImporterBridge> bridge_; | 96 scoped_refptr<ExternalProcessImporterBridge> bridge_; |
| 97 | 97 |
| 98 // A bitmask of importer::ImportItem. | 98 // A bitmask of importer::ImportItem. |
| 99 uint16 items_to_import_; | 99 uint16 items_to_import_; |
| 100 | 100 |
| 101 // Importer of the appropriate type (Firefox, Safari, IE, etc.) | 101 // Importer of the appropriate type (Firefox, Safari, IE, etc.) |
| 102 scoped_refptr<Importer> importer_; | 102 scoped_refptr<Importer> importer_; |
| 103 | 103 |
| 104 DISALLOW_COPY_AND_ASSIGN(ProfileImportThread); | 104 DISALLOW_COPY_AND_ASSIGN(ProfileImportThread); |
| 105 }; | 105 }; |
| 106 | 106 |
| 107 #endif // CHROME_PROFILE_IMPORT_PROFILE_IMPORT_THREAD_H_ | 107 #endif // CHROME_PROFILE_IMPORT_PROFILE_IMPORT_THREAD_H_ |
| OLD | NEW |