OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/importer_bridge.h" | 5 #include "chrome/browser/importer/importer_bridge.h" |
6 | 6 |
7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
8 #include "base/scoped_ptr.h" | 8 #include "base/scoped_ptr.h" |
9 #include "base/values.h" | 9 #include "base/values.h" |
10 #include "chrome/browser/chrome_thread.h" | 10 #include "chrome/browser/chrome_thread.h" |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 NewRunnableMethod(host_, &ImporterHost::ImportEnded)); | 106 NewRunnableMethod(host_, &ImporterHost::ImportEnded)); |
107 } | 107 } |
108 | 108 |
109 std::wstring InProcessImporterBridge::GetLocalizedString(int message_id) { | 109 std::wstring InProcessImporterBridge::GetLocalizedString(int message_id) { |
110 return l10n_util::GetString(message_id); | 110 return l10n_util::GetString(message_id); |
111 } | 111 } |
112 | 112 |
113 ExternalProcessImporterBridge::ExternalProcessImporterBridge( | 113 ExternalProcessImporterBridge::ExternalProcessImporterBridge( |
114 ProfileImportThread* profile_import_thread, | 114 ProfileImportThread* profile_import_thread, |
115 const DictionaryValue& localized_strings) | 115 const DictionaryValue& localized_strings) |
116 : profile_import_thread_(profile_import_thread), | 116 : profile_import_thread_(profile_import_thread) { |
117 localized_strings_(localized_strings) { | 117 // Bridge needs to make its own copy because OS 10.6 autoreleases the |
| 118 // localized_strings value that is passed in (see http://crbug.com/46003 ). |
| 119 localized_strings_.reset( |
| 120 static_cast<DictionaryValue*>(localized_strings.DeepCopy())); |
118 } | 121 } |
119 | 122 |
120 void ExternalProcessImporterBridge::AddBookmarkEntries( | 123 void ExternalProcessImporterBridge::AddBookmarkEntries( |
121 const std::vector<ProfileWriter::BookmarkEntry>& bookmarks, | 124 const std::vector<ProfileWriter::BookmarkEntry>& bookmarks, |
122 const std::wstring& first_folder_name, int options) { | 125 const std::wstring& first_folder_name, int options) { |
123 profile_import_thread_->NotifyBookmarksImportReady(bookmarks, | 126 profile_import_thread_->NotifyBookmarksImportReady(bookmarks, |
124 first_folder_name, options); | 127 first_folder_name, options); |
125 } | 128 } |
126 | 129 |
127 void ExternalProcessImporterBridge::AddHomePage(const GURL &home_page) { | 130 void ExternalProcessImporterBridge::AddHomePage(const GURL &home_page) { |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 profile_import_thread_->NotifyStarted(); | 177 profile_import_thread_->NotifyStarted(); |
175 } | 178 } |
176 | 179 |
177 void ExternalProcessImporterBridge::NotifyEnded() { | 180 void ExternalProcessImporterBridge::NotifyEnded() { |
178 // The internal process detects import end when all items have been received. | 181 // The internal process detects import end when all items have been received. |
179 } | 182 } |
180 | 183 |
181 std::wstring ExternalProcessImporterBridge::GetLocalizedString( | 184 std::wstring ExternalProcessImporterBridge::GetLocalizedString( |
182 int message_id) { | 185 int message_id) { |
183 std::wstring message; | 186 std::wstring message; |
184 localized_strings_.GetString(IntToWString(message_id), &message); | 187 localized_strings_->GetString(IntToWString(message_id), &message); |
185 return message; | 188 return message; |
186 } | 189 } |
187 | 190 |
OLD | NEW |