| 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/strings/string_number_conversions.h" | 9 #include "base/strings/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/bookmarks/imported_bookmark_entry.h" |
| 13 #include "chrome/browser/history/history_types.h" | 14 #include "chrome/browser/history/history_types.h" |
| 14 #include "chrome/browser/importer/profile_import_process_messages.h" | 15 #include "chrome/browser/importer/profile_import_process_messages.h" |
| 15 #include "content/public/common/password_form.h" | 16 #include "content/public/common/password_form.h" |
| 16 #include "ipc/ipc_sender.h" | 17 #include "ipc/ipc_sender.h" |
| 17 | 18 |
| 18 #if defined(OS_WIN) | 19 #if defined(OS_WIN) |
| 19 #include "components/webdata/encryptor/ie7_password.h" | 20 #include "components/webdata/encryptor/ie7_password.h" |
| 20 #endif | 21 #endif |
| 21 | 22 |
| 22 namespace { | 23 namespace { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 33 IPC::Sender* sender, | 34 IPC::Sender* sender, |
| 34 base::TaskRunner* task_runner) | 35 base::TaskRunner* task_runner) |
| 35 : sender_(sender), | 36 : sender_(sender), |
| 36 task_runner_(task_runner) { | 37 task_runner_(task_runner) { |
| 37 // Bridge needs to make its own copy because OS 10.6 autoreleases the | 38 // Bridge needs to make its own copy because OS 10.6 autoreleases the |
| 38 // localized_strings value that is passed in (see http://crbug.com/46003 ). | 39 // localized_strings value that is passed in (see http://crbug.com/46003 ). |
| 39 localized_strings_.reset(localized_strings.DeepCopy()); | 40 localized_strings_.reset(localized_strings.DeepCopy()); |
| 40 } | 41 } |
| 41 | 42 |
| 42 void ExternalProcessImporterBridge::AddBookmarks( | 43 void ExternalProcessImporterBridge::AddBookmarks( |
| 43 const std::vector<ProfileWriter::BookmarkEntry>& bookmarks, | 44 const std::vector<ImportedBookmarkEntry>& bookmarks, |
| 44 const string16& first_folder_name) { | 45 const string16& first_folder_name) { |
| 45 Send(new ProfileImportProcessHostMsg_NotifyBookmarksImportStart( | 46 Send(new ProfileImportProcessHostMsg_NotifyBookmarksImportStart( |
| 46 first_folder_name, bookmarks.size())); | 47 first_folder_name, bookmarks.size())); |
| 47 | 48 |
| 48 std::vector<ProfileWriter::BookmarkEntry>::const_iterator it; | 49 std::vector<ImportedBookmarkEntry>::const_iterator it; |
| 49 for (it = bookmarks.begin(); it < bookmarks.end(); | 50 for (it = bookmarks.begin(); it < bookmarks.end(); |
| 50 it = it + kNumBookmarksToSend) { | 51 it = it + kNumBookmarksToSend) { |
| 51 std::vector<ProfileWriter::BookmarkEntry> bookmark_group; | 52 std::vector<ImportedBookmarkEntry> bookmark_group; |
| 52 std::vector<ProfileWriter::BookmarkEntry>::const_iterator end_group = | 53 std::vector<ImportedBookmarkEntry>::const_iterator end_group = |
| 53 it + kNumBookmarksToSend < bookmarks.end() ? | 54 it + kNumBookmarksToSend < bookmarks.end() ? |
| 54 it + kNumBookmarksToSend : bookmarks.end(); | 55 it + kNumBookmarksToSend : bookmarks.end(); |
| 55 bookmark_group.assign(it, end_group); | 56 bookmark_group.assign(it, end_group); |
| 56 | 57 |
| 57 Send(new ProfileImportProcessHostMsg_NotifyBookmarksImportGroup( | 58 Send(new ProfileImportProcessHostMsg_NotifyBookmarksImportGroup( |
| 58 bookmark_group)); | 59 bookmark_group)); |
| 59 } | 60 } |
| 60 } | 61 } |
| 61 | 62 |
| 62 void ExternalProcessImporterBridge::AddHomePage(const GURL& home_page) { | 63 void ExternalProcessImporterBridge::AddHomePage(const GURL& home_page) { |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 task_runner_->PostTask( | 150 task_runner_->PostTask( |
| 150 FROM_HERE, | 151 FROM_HERE, |
| 151 base::Bind(&ExternalProcessImporterBridge::SendInternal, | 152 base::Bind(&ExternalProcessImporterBridge::SendInternal, |
| 152 this, message)); | 153 this, message)); |
| 153 } | 154 } |
| 154 | 155 |
| 155 void ExternalProcessImporterBridge::SendInternal(IPC::Message* message) { | 156 void ExternalProcessImporterBridge::SendInternal(IPC::Message* message) { |
| 156 DCHECK(task_runner_->RunsTasksOnCurrentThread()); | 157 DCHECK(task_runner_->RunsTasksOnCurrentThread()); |
| 157 sender_->Send(message); | 158 sender_->Send(message); |
| 158 } | 159 } |
| OLD | NEW |