| 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 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 void NotifyItemStarted(importer::ImportItem item); | 49 void NotifyItemStarted(importer::ImportItem item); |
| 50 void NotifyItemEnded(importer::ImportItem item); | 50 void NotifyItemEnded(importer::ImportItem item); |
| 51 void NotifyEnded(); | 51 void NotifyEnded(); |
| 52 | 52 |
| 53 // Bridging methods that move data back across the process boundary. | 53 // Bridging methods that move data back across the process boundary. |
| 54 void NotifyHistoryImportReady(const std::vector<history::URLRow>& rows, | 54 void NotifyHistoryImportReady(const std::vector<history::URLRow>& rows, |
| 55 history::VisitSource visit_source); | 55 history::VisitSource visit_source); |
| 56 void NotifyHomePageImportReady(const GURL& home_page); | 56 void NotifyHomePageImportReady(const GURL& home_page); |
| 57 void NotifyBookmarksImportReady( | 57 void NotifyBookmarksImportReady( |
| 58 const std::vector<ProfileWriter::BookmarkEntry>& bookmarks, | 58 const std::vector<ProfileWriter::BookmarkEntry>& bookmarks, |
| 59 const string16& first_folder_name, | 59 const string16& first_folder_name); |
| 60 int options); | |
| 61 void NotifyFaviconsImportReady( | 60 void NotifyFaviconsImportReady( |
| 62 const std::vector<history::ImportedFaviconUsage>& favicons); | 61 const std::vector<history::ImportedFaviconUsage>& favicons); |
| 63 void NotifyPasswordFormReady(const webkit_glue::PasswordForm& form); | 62 void NotifyPasswordFormReady(const webkit_glue::PasswordForm& form); |
| 64 void NotifyKeywordsReady(const std::vector<TemplateURL*>& template_urls, | 63 void NotifyKeywordsReady(const std::vector<TemplateURL*>& template_urls, |
| 65 int default_keyword_index, | 64 int default_keyword_index, |
| 66 bool unique_on_host_and_path); | 65 bool unique_on_host_and_path); |
| 67 | 66 |
| 68 private: | 67 private: |
| 69 // IPC messages | 68 // IPC messages |
| 70 virtual bool OnControlMessageReceived(const IPC::Message& msg); | 69 virtual bool OnControlMessageReceived(const IPC::Message& msg); |
| 71 | 70 |
| 72 // 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 |
| 73 // 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 |
| 74 // main process (especially cancel requests) while the worker thread handles | 73 // main process (especially cancel requests) while the worker thread handles |
| 75 // the actual import. | 74 // the actual import. |
| 76 void OnImportStart( | 75 void OnImportStart( |
| 77 const importer::SourceProfile& source_profile, | 76 const importer::SourceProfile& source_profile, |
| 78 uint16 items, | 77 uint16 items, |
| 79 const DictionaryValue& localized_strings, | 78 const DictionaryValue& localized_strings); |
| 80 bool import_to_bookmark_bar); | |
| 81 | 79 |
| 82 // Calls cleanup to stop the import operation. | 80 // Calls cleanup to stop the import operation. |
| 83 void OnImportCancel(); | 81 void OnImportCancel(); |
| 84 | 82 |
| 85 // 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 |
| 86 // from the import process. | 84 // from the import process. |
| 87 void OnImportItemFinished(uint16 item); | 85 void OnImportItemFinished(uint16 item); |
| 88 | 86 |
| 89 // Release the process and ourselves. | 87 // Release the process and ourselves. |
| 90 void Cleanup(); | 88 void Cleanup(); |
| 91 | 89 |
| 92 // Thread that importer runs on, while ProfileImportThread handles messages | 90 // Thread that importer runs on, while ProfileImportThread handles messages |
| 93 // from the browser process. | 91 // from the browser process. |
| 94 scoped_ptr<base::Thread> import_thread_; | 92 scoped_ptr<base::Thread> import_thread_; |
| 95 | 93 |
| 96 // 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 |
| 97 // directly back to the ProfileImportProcessHost. | 95 // directly back to the ProfileImportProcessHost. |
| 98 scoped_refptr<ExternalProcessImporterBridge> bridge_; | 96 scoped_refptr<ExternalProcessImporterBridge> bridge_; |
| 99 | 97 |
| 100 // A bitmask of importer::ImportItem. | 98 // A bitmask of importer::ImportItem. |
| 101 uint16 items_to_import_; | 99 uint16 items_to_import_; |
| 102 | 100 |
| 103 // Importer of the appropriate type (Firefox, Safari, IE, etc.) | 101 // Importer of the appropriate type (Firefox, Safari, IE, etc.) |
| 104 scoped_refptr<Importer> importer_; | 102 scoped_refptr<Importer> importer_; |
| 105 | 103 |
| 106 DISALLOW_COPY_AND_ASSIGN(ProfileImportThread); | 104 DISALLOW_COPY_AND_ASSIGN(ProfileImportThread); |
| 107 }; | 105 }; |
| 108 | 106 |
| 109 #endif // CHROME_PROFILE_IMPORT_PROFILE_IMPORT_THREAD_H_ | 107 #endif // CHROME_PROFILE_IMPORT_PROFILE_IMPORT_THREAD_H_ |
| OLD | NEW |