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/bookmarks/bookmark_html_writer.h" | 5 #include "chrome/browser/bookmarks/bookmark_html_writer.h" |
6 | 6 |
7 #include "base/base64.h" | 7 #include "base/base64.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/bind_helpers.h" | 9 #include "base/bind_helpers.h" |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 // Writes out the text string (as UTF8). The text is escaped based on | 207 // Writes out the text string (as UTF8). The text is escaped based on |
208 // type. | 208 // type. |
209 bool Write(const std::string& text, TextType type) { | 209 bool Write(const std::string& text, TextType type) { |
210 DCHECK(base::IsStringUTF8(text)); | 210 DCHECK(base::IsStringUTF8(text)); |
211 std::string utf8_string; | 211 std::string utf8_string; |
212 | 212 |
213 switch (type) { | 213 switch (type) { |
214 case ATTRIBUTE_VALUE: | 214 case ATTRIBUTE_VALUE: |
215 // Convert " to " | 215 // Convert " to " |
216 utf8_string = text; | 216 utf8_string = text; |
217 ReplaceSubstringsAfterOffset(&utf8_string, 0, "\"", """); | 217 base::ReplaceSubstringsAfterOffset(&utf8_string, 0, "\"", """); |
218 break; | 218 break; |
219 | 219 |
220 case CONTENT: | 220 case CONTENT: |
221 utf8_string = net::EscapeForHTML(text); | 221 utf8_string = net::EscapeForHTML(text); |
222 break; | 222 break; |
223 | 223 |
224 default: | 224 default: |
225 NOTREACHED(); | 225 NOTREACHED(); |
226 } | 226 } |
227 | 227 |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
502 // BookmarkModel isn't thread safe (nor would we want to lock it down | 502 // BookmarkModel isn't thread safe (nor would we want to lock it down |
503 // for the duration of the write), as such we make a copy of the | 503 // for the duration of the write), as such we make a copy of the |
504 // BookmarkModel using BookmarkCodec then write from that. | 504 // BookmarkModel using BookmarkCodec then write from that. |
505 if (fetcher == NULL) { | 505 if (fetcher == NULL) { |
506 fetcher = new BookmarkFaviconFetcher(profile, path, observer); | 506 fetcher = new BookmarkFaviconFetcher(profile, path, observer); |
507 fetcher->ExportBookmarks(); | 507 fetcher->ExportBookmarks(); |
508 } | 508 } |
509 } | 509 } |
510 | 510 |
511 } // namespace bookmark_html_writer | 511 } // namespace bookmark_html_writer |
OLD | NEW |