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

Side by Side Diff: chrome/utility/importer/bookmark_html_reader.cc

Issue 102843002: Move RemoveChars, ReplaceChars, TrimString, and TruncateUTF8ToByteSize to base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/utility/importer/bookmark_html_reader.h" 5 #include "chrome/utility/importer/bookmark_html_reader.h"
6 6
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/i18n/icu_string_conversions.h" 9 #include "base/i18n/icu_string_conversions.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 bool has_subfolder = false; 103 bool has_subfolder = false;
104 base::Time last_folder_add_date; 104 base::Time last_folder_add_date;
105 std::vector<base::string16> path; 105 std::vector<base::string16> path;
106 size_t toolbar_folder_index = 0; 106 size_t toolbar_folder_index = 0;
107 std::string charset; 107 std::string charset;
108 for (size_t i = 0; 108 for (size_t i = 0;
109 i < lines.size() && 109 i < lines.size() &&
110 (cancellation_callback.is_null() || !cancellation_callback.Run()); 110 (cancellation_callback.is_null() || !cancellation_callback.Run());
111 ++i) { 111 ++i) {
112 std::string line; 112 std::string line;
113 TrimString(lines[i], " ", &line); 113 base::TrimString(lines[i], " ", &line);
114 114
115 // Remove "<HR>" if |line| starts with it. "<HR>" is the bookmark entries 115 // Remove "<HR>" if |line| starts with it. "<HR>" is the bookmark entries
116 // separator in Firefox that Chrome does not support. Note that there can be 116 // separator in Firefox that Chrome does not support. Note that there can be
117 // multiple "<HR>" tags at the beginning of a single line. 117 // multiple "<HR>" tags at the beginning of a single line.
118 // See http://crbug.com/257474. 118 // See http://crbug.com/257474.
119 static const char kHrTag[] = "<HR>"; 119 static const char kHrTag[] = "<HR>";
120 while (StartsWithASCII(line, kHrTag, false)) { 120 while (StartsWithASCII(line, kHrTag, false)) {
121 line.erase(0, arraysize(kHrTag) - 1); 121 line.erase(0, arraysize(kHrTag) - 1);
122 TrimString(line, " ", &line); 122 base::TrimString(line, " ", &line);
123 } 123 }
124 124
125 // Get the encoding of the bookmark file. 125 // Get the encoding of the bookmark file.
126 if (internal::ParseCharsetFromLine(line, &charset)) 126 if (internal::ParseCharsetFromLine(line, &charset))
127 continue; 127 continue;
128 128
129 // Get the folder name. 129 // Get the folder name.
130 if (internal::ParseFolderNameFromLine(line, 130 if (internal::ParseFolderNameFromLine(line,
131 charset, 131 charset,
132 &last_folder, 132 &last_folder,
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
433 *url = GURL(value); 433 *url = GURL(value);
434 } 434 }
435 } 435 }
436 436
437 return true; 437 return true;
438 } 438 }
439 439
440 } // namespace internal 440 } // namespace internal
441 441
442 } // namespace bookmark_html_reader 442 } // namespace bookmark_html_reader
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698