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

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

Issue 270183002: Move IsStringUTF8/ASCII to base namespace (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: more minor nit Created 6 years, 7 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 | « chrome/app/chrome_main_delegate.cc ('k') | chrome/browser/chromeos/drive/file_system_util.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) 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 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 return true; 198 return true;
199 size_t wrote = file_->WriteAtCurrentPos(text.c_str(), text.length()); 199 size_t wrote = file_->WriteAtCurrentPos(text.c_str(), text.length());
200 bool result = (wrote == text.length()); 200 bool result = (wrote == text.length());
201 DCHECK(result); 201 DCHECK(result);
202 return result; 202 return result;
203 } 203 }
204 204
205 // Writes out the text string (as UTF8). The text is escaped based on 205 // Writes out the text string (as UTF8). The text is escaped based on
206 // type. 206 // type.
207 bool Write(const std::string& text, TextType type) { 207 bool Write(const std::string& text, TextType type) {
208 DCHECK(IsStringUTF8(text)); 208 DCHECK(base::IsStringUTF8(text));
209 std::string utf8_string; 209 std::string utf8_string;
210 210
211 switch (type) { 211 switch (type) {
212 case ATTRIBUTE_VALUE: 212 case ATTRIBUTE_VALUE:
213 // Convert " to " 213 // Convert " to "
214 utf8_string = text; 214 utf8_string = text;
215 ReplaceSubstringsAfterOffset(&utf8_string, 0, "\"", """); 215 ReplaceSubstringsAfterOffset(&utf8_string, 0, "\"", """);
216 break; 216 break;
217 217
218 case CONTENT: 218 case CONTENT:
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
499 // BookmarkModel isn't thread safe (nor would we want to lock it down 499 // BookmarkModel isn't thread safe (nor would we want to lock it down
500 // for the duration of the write), as such we make a copy of the 500 // for the duration of the write), as such we make a copy of the
501 // BookmarkModel using BookmarkCodec then write from that. 501 // BookmarkModel using BookmarkCodec then write from that.
502 if (fetcher == NULL) { 502 if (fetcher == NULL) {
503 fetcher = new BookmarkFaviconFetcher(profile, path, observer); 503 fetcher = new BookmarkFaviconFetcher(profile, path, observer);
504 fetcher->ExportBookmarks(); 504 fetcher->ExportBookmarks();
505 } 505 }
506 } 506 }
507 507
508 } // namespace bookmark_html_writer 508 } // namespace bookmark_html_writer
OLDNEW
« no previous file with comments | « chrome/app/chrome_main_delegate.cc ('k') | chrome/browser/chromeos/drive/file_system_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698