| 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 #include "chrome/profile_import/profile_import_thread.h" | 5 #include "chrome/profile_import/profile_import_thread.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/values.h" | 9 #include "base/values.h" |
| 10 #include "chrome/browser/importer/importer_bridge.h" | 10 #include "chrome/browser/importer/importer_bridge.h" |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 it + kNumBookmarksToSend < bookmarks.end() ? | 150 it + kNumBookmarksToSend < bookmarks.end() ? |
| 151 it + kNumBookmarksToSend : bookmarks.end(); | 151 it + kNumBookmarksToSend : bookmarks.end(); |
| 152 bookmark_group.assign(it, end_group); | 152 bookmark_group.assign(it, end_group); |
| 153 | 153 |
| 154 Send(new ProfileImportProcessHostMsg_NotifyBookmarksImportGroup( | 154 Send(new ProfileImportProcessHostMsg_NotifyBookmarksImportGroup( |
| 155 bookmark_group)); | 155 bookmark_group)); |
| 156 } | 156 } |
| 157 } | 157 } |
| 158 | 158 |
| 159 void ProfileImportThread::NotifyFavIconsImportReady( | 159 void ProfileImportThread::NotifyFavIconsImportReady( |
| 160 const std::vector<history::ImportedFavIconUsage>& fav_icons) { | 160 const std::vector<history::ImportedFavIconUsage>& favicons) { |
| 161 Send(new ProfileImportProcessHostMsg_NotifyFavIconsImportStart( | 161 Send(new ProfileImportProcessHostMsg_NotifyFavIconsImportStart( |
| 162 fav_icons.size())); | 162 favicons.size())); |
| 163 | 163 |
| 164 std::vector<history::ImportedFavIconUsage>::const_iterator it; | 164 std::vector<history::ImportedFavIconUsage>::const_iterator it; |
| 165 for (it = fav_icons.begin(); it < fav_icons.end(); | 165 for (it = favicons.begin(); it < favicons.end(); |
| 166 it = it + kNumFavIconsToSend) { | 166 it = it + kNumFavIconsToSend) { |
| 167 std::vector<history::ImportedFavIconUsage> fav_icons_group; | 167 std::vector<history::ImportedFavIconUsage> favicons_group; |
| 168 std::vector<history::ImportedFavIconUsage>::const_iterator end_group = | 168 std::vector<history::ImportedFavIconUsage>::const_iterator end_group = |
| 169 std::min(it + kNumFavIconsToSend, fav_icons.end()); | 169 std::min(it + kNumFavIconsToSend, favicons.end()); |
| 170 fav_icons_group.assign(it, end_group); | 170 favicons_group.assign(it, end_group); |
| 171 | 171 |
| 172 Send(new ProfileImportProcessHostMsg_NotifyFavIconsImportGroup( | 172 Send(new ProfileImportProcessHostMsg_NotifyFavIconsImportGroup( |
| 173 fav_icons_group)); | 173 favicons_group)); |
| 174 } | 174 } |
| 175 } | 175 } |
| 176 | 176 |
| 177 void ProfileImportThread::NotifyPasswordFormReady( | 177 void ProfileImportThread::NotifyPasswordFormReady( |
| 178 const webkit_glue::PasswordForm& form) { | 178 const webkit_glue::PasswordForm& form) { |
| 179 Send(new ProfileImportProcessHostMsg_NotifyPasswordFormReady(form)); | 179 Send(new ProfileImportProcessHostMsg_NotifyPasswordFormReady(form)); |
| 180 } | 180 } |
| 181 | 181 |
| 182 void ProfileImportThread::NotifyKeywordsReady( | 182 void ProfileImportThread::NotifyKeywordsReady( |
| 183 const std::vector<TemplateURL*>& template_urls, | 183 const std::vector<TemplateURL*>& template_urls, |
| 184 int default_keyword_index, bool unique_on_host_and_path) { | 184 int default_keyword_index, bool unique_on_host_and_path) { |
| 185 std::vector<TemplateURL> urls; | 185 std::vector<TemplateURL> urls; |
| 186 for (size_t i = 0; i < template_urls.size(); ++i) { | 186 for (size_t i = 0; i < template_urls.size(); ++i) { |
| 187 urls.push_back(*template_urls[i]); | 187 urls.push_back(*template_urls[i]); |
| 188 } | 188 } |
| 189 Send(new ProfileImportProcessHostMsg_NotifyKeywordsReady(urls, | 189 Send(new ProfileImportProcessHostMsg_NotifyKeywordsReady(urls, |
| 190 default_keyword_index, unique_on_host_and_path)); | 190 default_keyword_index, unique_on_host_and_path)); |
| 191 } | 191 } |
| 192 | 192 |
| 193 void ProfileImportThread::Cleanup() { | 193 void ProfileImportThread::Cleanup() { |
| 194 importer_->Cancel(); | 194 importer_->Cancel(); |
| 195 importer_ = NULL; | 195 importer_ = NULL; |
| 196 bridge_ = NULL; | 196 bridge_ = NULL; |
| 197 ChildProcess::current()->ReleaseProcess(); | 197 ChildProcess::current()->ReleaseProcess(); |
| 198 } | 198 } |
| OLD | NEW |