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

Side by Side Diff: chrome/browser/importer/firefox2_importer.cc

Issue 3750001: base: Move SplitString functions into the base namespace and update the callers. (Closed) Base URL: git://git.chromium.org/chromium.git
Patch Set: brett review, reverted changes in o3d due to it's using an old base revision Created 10 years, 2 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
OLDNEW
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/firefox2_importer.h" 5 #include "chrome/browser/importer/firefox2_importer.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/file_path.h" 10 #include "base/file_path.h"
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 FilePath file = app_path.AppendASCII("defaults") 98 FilePath file = app_path.AppendASCII("defaults")
99 .AppendASCII("profile") 99 .AppendASCII("profile")
100 .AppendASCII("bookmarks.html"); 100 .AppendASCII("bookmarks.html");
101 101
102 urls->clear(); 102 urls->clear();
103 103
104 // Read the whole file. 104 // Read the whole file.
105 std::string content; 105 std::string content;
106 file_util::ReadFileToString(file, &content); 106 file_util::ReadFileToString(file, &content);
107 std::vector<std::string> lines; 107 std::vector<std::string> lines;
108 SplitString(content, '\n', &lines); 108 base::SplitString(content, '\n', &lines);
109 109
110 std::string charset; 110 std::string charset;
111 for (size_t i = 0; i < lines.size(); ++i) { 111 for (size_t i = 0; i < lines.size(); ++i) {
112 std::string line; 112 std::string line;
113 TrimString(lines[i], " ", &line); 113 TrimString(lines[i], " ", &line);
114 114
115 // Get the encoding of the bookmark file. 115 // Get the encoding of the bookmark file.
116 if (ParseCharsetFromLine(line, &charset)) 116 if (ParseCharsetFromLine(line, &charset))
117 continue; 117 continue;
118 118
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 const std::set<GURL>& default_urls, 153 const std::set<GURL>& default_urls,
154 bool import_to_bookmark_bar, 154 bool import_to_bookmark_bar,
155 const std::wstring& first_folder_name, 155 const std::wstring& first_folder_name,
156 Importer* importer, 156 Importer* importer,
157 std::vector<ProfileWriter::BookmarkEntry>* bookmarks, 157 std::vector<ProfileWriter::BookmarkEntry>* bookmarks,
158 std::vector<TemplateURL*>* template_urls, 158 std::vector<TemplateURL*>* template_urls,
159 std::vector<history::ImportedFavIconUsage>* favicons) { 159 std::vector<history::ImportedFavIconUsage>* favicons) {
160 std::string content; 160 std::string content;
161 file_util::ReadFileToString(file_path, &content); 161 file_util::ReadFileToString(file_path, &content);
162 std::vector<std::string> lines; 162 std::vector<std::string> lines;
163 SplitString(content, '\n', &lines); 163 base::SplitString(content, '\n', &lines);
164 164
165 std::vector<ProfileWriter::BookmarkEntry> toolbar_bookmarks; 165 std::vector<ProfileWriter::BookmarkEntry> toolbar_bookmarks;
166 std::wstring last_folder = first_folder_name; 166 std::wstring last_folder = first_folder_name;
167 bool last_folder_on_toolbar = false; 167 bool last_folder_on_toolbar = false;
168 std::vector<std::wstring> path; 168 std::vector<std::wstring> path;
169 size_t toolbar_folder = 0; 169 size_t toolbar_folder = 0;
170 std::string charset; 170 std::string charset;
171 for (size_t i = 0; i < lines.size() && (!importer || !importer->cancelled()); 171 for (size_t i = 0; i < lines.size() && (!importer || !importer->cancelled());
172 ++i) { 172 ++i) {
173 std::string line; 173 std::string line;
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after
582 582
583 // We need to make up a URL for the favicon. We use a version of the page's 583 // We need to make up a URL for the favicon. We use a version of the page's
584 // URL so that we can be sure it will not collide. 584 // URL so that we can be sure it will not collide.
585 usage.favicon_url = GURL(std::string("made-up-favicon:") + link_url.spec()); 585 usage.favicon_url = GURL(std::string("made-up-favicon:") + link_url.spec());
586 586
587 // We only have one URL per favicon for Firefox 2 bookmarks. 587 // We only have one URL per favicon for Firefox 2 bookmarks.
588 usage.urls.insert(link_url); 588 usage.urls.insert(link_url);
589 589
590 favicons->push_back(usage); 590 favicons->push_back(usage);
591 } 591 }
OLDNEW
« no previous file with comments | « chrome/browser/history/snippet_unittest.cc ('k') | chrome/browser/importer/firefox_importer_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698