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 #include "chrome/browser/importer/external_process_importer_bridge.h" | 5 #include "chrome/browser/importer/external_process_importer_bridge.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/string_number_conversions.h" | 9 #include "base/string_number_conversions.h" |
10 #include "base/task_runner.h" | 10 #include "base/task_runner.h" |
11 #include "base/utf_string_conversions.h" | 11 #include "base/utf_string_conversions.h" |
12 #include "base/values.h" | 12 #include "base/values.h" |
13 #include "chrome/browser/history/history_types.h" | 13 #include "chrome/browser/history/history_types.h" |
14 #include "chrome/browser/importer/profile_import_process_messages.h" | 14 #include "chrome/browser/importer/profile_import_process_messages.h" |
15 #include "webkit/forms/password_form.h" | 15 #include "content/public/common/password_form.h" |
16 | 16 |
17 #if defined(OS_WIN) | 17 #if defined(OS_WIN) |
18 #include "chrome/browser/password_manager/ie7_password.h" | 18 #include "chrome/browser/password_manager/ie7_password.h" |
19 #endif | 19 #endif |
20 | 20 |
21 namespace { | 21 namespace { |
22 // Rather than sending all import items over IPC at once we chunk them into | 22 // Rather than sending all import items over IPC at once we chunk them into |
23 // separate requests. This avoids the case of a large import causing | 23 // separate requests. This avoids the case of a large import causing |
24 // oversized IPC messages. | 24 // oversized IPC messages. |
25 const int kNumBookmarksToSend = 100; | 25 const int kNumBookmarksToSend = 100; |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 | 108 |
109 void ExternalProcessImporterBridge::SetKeywords( | 109 void ExternalProcessImporterBridge::SetKeywords( |
110 const std::vector<TemplateURL*>& template_urls, | 110 const std::vector<TemplateURL*>& template_urls, |
111 bool unique_on_host_and_path) { | 111 bool unique_on_host_and_path) { |
112 Send(new ProfileImportProcessHostMsg_NotifyKeywordsReady(template_urls, | 112 Send(new ProfileImportProcessHostMsg_NotifyKeywordsReady(template_urls, |
113 unique_on_host_and_path)); | 113 unique_on_host_and_path)); |
114 STLDeleteContainerPointers(template_urls.begin(), template_urls.end()); | 114 STLDeleteContainerPointers(template_urls.begin(), template_urls.end()); |
115 } | 115 } |
116 | 116 |
117 void ExternalProcessImporterBridge::SetPasswordForm( | 117 void ExternalProcessImporterBridge::SetPasswordForm( |
118 const webkit::forms::PasswordForm& form) { | 118 const content::PasswordForm& form) { |
119 Send(new ProfileImportProcessHostMsg_NotifyPasswordFormReady(form)); | 119 Send(new ProfileImportProcessHostMsg_NotifyPasswordFormReady(form)); |
120 } | 120 } |
121 | 121 |
122 void ExternalProcessImporterBridge::NotifyStarted() { | 122 void ExternalProcessImporterBridge::NotifyStarted() { |
123 Send(new ProfileImportProcessHostMsg_Import_Started()); | 123 Send(new ProfileImportProcessHostMsg_Import_Started()); |
124 } | 124 } |
125 | 125 |
126 void ExternalProcessImporterBridge::NotifyItemStarted( | 126 void ExternalProcessImporterBridge::NotifyItemStarted( |
127 importer::ImportItem item) { | 127 importer::ImportItem item) { |
128 Send(new ProfileImportProcessHostMsg_ImportItem_Started(item)); | 128 Send(new ProfileImportProcessHostMsg_ImportItem_Started(item)); |
(...skipping 19 matching lines...) Expand all Loading... |
148 task_runner_->PostTask( | 148 task_runner_->PostTask( |
149 FROM_HERE, | 149 FROM_HERE, |
150 base::Bind(&ExternalProcessImporterBridge::SendInternal, | 150 base::Bind(&ExternalProcessImporterBridge::SendInternal, |
151 this, message)); | 151 this, message)); |
152 } | 152 } |
153 | 153 |
154 void ExternalProcessImporterBridge::SendInternal(IPC::Message* message) { | 154 void ExternalProcessImporterBridge::SendInternal(IPC::Message* message) { |
155 DCHECK(task_runner_->RunsTasksOnCurrentThread()); | 155 DCHECK(task_runner_->RunsTasksOnCurrentThread()); |
156 sender_->Send(message); | 156 sender_->Send(message); |
157 } | 157 } |
OLD | NEW |