Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(357)

Side by Side Diff: chrome/browser/bookmarks/bookmark_html_writer.cc

Issue 126036: Patch to solve the problem in import export bookmarks (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 11 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/bookmarks/bookmark_html_writer_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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/bookmarks/bookmark_html_writer.h" 5 #include "chrome/browser/bookmarks/bookmark_html_writer.h"
6 6
7 #include "app/l10n_util.h" 7 #include "app/l10n_util.h"
8 #include "base/file_path.h" 8 #include "base/file_path.h"
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 return result; 159 return result;
160 } 160 }
161 161
162 // Writes out the text string (as UTF8). The text is escaped based on 162 // Writes out the text string (as UTF8). The text is escaped based on
163 // type. 163 // type.
164 bool Write(const std::wstring& text, TextType type) { 164 bool Write(const std::wstring& text, TextType type) {
165 std::string utf8_string; 165 std::string utf8_string;
166 166
167 switch (type) { 167 switch (type) {
168 case ATTRIBUTE_VALUE: 168 case ATTRIBUTE_VALUE:
169 // Convert " to \" 169 // Convert " to "
170 if (text.find(L"\"") != std::wstring::npos) { 170 if (text.find(L"\"") != std::wstring::npos) {
171 string16 replaced_string = WideToUTF16Hack(text); 171 string16 replaced_string = WideToUTF16Hack(text);
172 ReplaceSubstringsAfterOffset(&replaced_string, 0, 172 ReplaceSubstringsAfterOffset(&replaced_string, 0,
173 ASCIIToUTF16("\""), 173 ASCIIToUTF16("\""),
174 ASCIIToUTF16("\\\"")); 174 ASCIIToUTF16("""));
175 utf8_string = UTF16ToUTF8(replaced_string); 175 utf8_string = UTF16ToUTF8(replaced_string);
176 } else { 176 } else {
177 utf8_string = WideToUTF8(text); 177 utf8_string = WideToUTF8(text);
178 } 178 }
179 break; 179 break;
180 180
181 case CONTENT: 181 case CONTENT:
182 utf8_string = WideToUTF8(EscapeForHTML(text)); 182 utf8_string = WideToUTF8(EscapeForHTML(text));
183 break; 183 break;
184 184
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
326 BookmarkCodec codec; 326 BookmarkCodec codec;
327 scoped_ptr<Writer> writer(new Writer(codec.Encode(model), 327 scoped_ptr<Writer> writer(new Writer(codec.Encode(model),
328 FilePath::FromWStringHack(path))); 328 FilePath::FromWStringHack(path)));
329 if (thread) 329 if (thread)
330 thread->PostTask(FROM_HERE, writer.release()); 330 thread->PostTask(FROM_HERE, writer.release());
331 else 331 else
332 writer->Run(); 332 writer->Run();
333 } 333 }
334 334
335 } // namespace bookmark_html_writer 335 } // namespace bookmark_html_writer
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/bookmarks/bookmark_html_writer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698