| 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_BROWSER_IMPORTER_EXTERNAL_PROCESS_IMPORTER_CLIENT_H_ | 5 #ifndef CHROME_BROWSER_IMPORTER_EXTERNAL_PROCESS_IMPORTER_CLIENT_H_ |
| 6 #define CHROME_BROWSER_IMPORTER_EXTERNAL_PROCESS_IMPORTER_CLIENT_H_ | 6 #define CHROME_BROWSER_IMPORTER_EXTERNAL_PROCESS_IMPORTER_CLIENT_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
| 13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
| 14 #include "base/strings/string16.h" | 14 #include "base/strings/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 "content/public/browser/browser_thread.h" | 17 #include "content/public/browser/browser_thread.h" |
| 18 #include "content/public/browser/utility_process_host_client.h" | 18 #include "content/public/browser/utility_process_host_client.h" |
| 19 | 19 |
| 20 class ExternalProcessImporterHost; | 20 class ExternalProcessImporterHost; |
| 21 struct ImportedBookmarkEntry; | 21 struct ImportedBookmarkEntry; |
| 22 struct ImportedFaviconUsage; | 22 struct ImportedFaviconUsage; |
| 23 class InProcessImporterBridge; | 23 class InProcessImporterBridge; |
| 24 class TemplateURL; | |
| 25 | 24 |
| 26 namespace content { | 25 namespace content { |
| 27 struct PasswordForm; | 26 struct PasswordForm; |
| 28 class UtilityProcessHost; | 27 class UtilityProcessHost; |
| 29 } | 28 } |
| 30 | 29 |
| 30 namespace importer { |
| 31 struct URLKeywordInfo; |
| 32 } |
| 33 |
| 31 // This class is the client for the out of process profile importing. It | 34 // This class is the client for the out of process profile importing. It |
| 32 // collects notifications from this process host and feeds data back to the | 35 // collects notifications from this process host and feeds data back to the |
| 33 // importer host, who actually does the writing. | 36 // importer host, who actually does the writing. |
| 34 class ExternalProcessImporterClient : public content::UtilityProcessHostClient { | 37 class ExternalProcessImporterClient : public content::UtilityProcessHostClient { |
| 35 public: | 38 public: |
| 36 ExternalProcessImporterClient(ExternalProcessImporterHost* importer_host, | 39 ExternalProcessImporterClient(ExternalProcessImporterHost* importer_host, |
| 37 const importer::SourceProfile& source_profile, | 40 const importer::SourceProfile& source_profile, |
| 38 uint16 items, | 41 uint16 items, |
| 39 InProcessImporterBridge* bridge); | 42 InProcessImporterBridge* bridge); |
| 40 | 43 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 58 int visit_source); | 61 int visit_source); |
| 59 void OnHomePageImportReady(const GURL& home_page); | 62 void OnHomePageImportReady(const GURL& home_page); |
| 60 void OnBookmarksImportStart(const string16& first_folder_name, | 63 void OnBookmarksImportStart(const string16& first_folder_name, |
| 61 size_t total_bookmarks_count); | 64 size_t total_bookmarks_count); |
| 62 void OnBookmarksImportGroup( | 65 void OnBookmarksImportGroup( |
| 63 const std::vector<ImportedBookmarkEntry>& bookmarks_group); | 66 const std::vector<ImportedBookmarkEntry>& bookmarks_group); |
| 64 void OnFaviconsImportStart(size_t total_favicons_count); | 67 void OnFaviconsImportStart(size_t total_favicons_count); |
| 65 void OnFaviconsImportGroup( | 68 void OnFaviconsImportGroup( |
| 66 const std::vector<ImportedFaviconUsage>& favicons_group); | 69 const std::vector<ImportedFaviconUsage>& favicons_group); |
| 67 void OnPasswordFormImportReady(const content::PasswordForm& form); | 70 void OnPasswordFormImportReady(const content::PasswordForm& form); |
| 68 // WARNING: This function takes ownership of (and deletes) the pointers in | 71 void OnKeywordsImportReady( |
| 69 // |template_urls|! | 72 const std::vector<importer::URLKeywordInfo>& url_keywords, |
| 70 void OnKeywordsImportReady(const std::vector<TemplateURL*>& template_urls, | 73 bool unique_on_host_and_path); |
| 71 bool unique_on_host_and_path); | 74 void OnFirefoxSearchEngineDataReceived( |
| 75 const std::vector<std::string> search_engine_data); |
| 72 | 76 |
| 73 protected: | 77 protected: |
| 74 virtual ~ExternalProcessImporterClient(); | 78 virtual ~ExternalProcessImporterClient(); |
| 75 | 79 |
| 76 private: | 80 private: |
| 77 // Notifies the importerhost that import has finished, and calls Release(). | 81 // Notifies the importerhost that import has finished, and calls Release(). |
| 78 void Cleanup(); | 82 void Cleanup(); |
| 79 | 83 |
| 80 // Cancel import process on IO thread. | 84 // Cancel import process on IO thread. |
| 81 void CancelImportProcessOnIOThread(); | 85 void CancelImportProcessOnIOThread(); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 // ProfileWriter. | 128 // ProfileWriter. |
| 125 scoped_refptr<InProcessImporterBridge> bridge_; | 129 scoped_refptr<InProcessImporterBridge> bridge_; |
| 126 | 130 |
| 127 // True if import process has been cancelled. | 131 // True if import process has been cancelled. |
| 128 bool cancelled_; | 132 bool cancelled_; |
| 129 | 133 |
| 130 DISALLOW_COPY_AND_ASSIGN(ExternalProcessImporterClient); | 134 DISALLOW_COPY_AND_ASSIGN(ExternalProcessImporterClient); |
| 131 }; | 135 }; |
| 132 | 136 |
| 133 #endif // CHROME_BROWSER_IMPORTER_EXTERNAL_PROCESS_IMPORTER_CLIENT_H_ | 137 #endif // CHROME_BROWSER_IMPORTER_EXTERNAL_PROCESS_IMPORTER_CLIENT_H_ |
| OLD | NEW |