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

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

Issue 9982018: Move most TemplateURL data members to a new struct, TemplateURLData. This allows us to eliminate t… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 8 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
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/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 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 } 127 }
128 128
129 // static 129 // static
130 TemplateURL* Firefox2Importer::CreateTemplateURL(const string16& title, 130 TemplateURL* Firefox2Importer::CreateTemplateURL(const string16& title,
131 const string16& keyword, 131 const string16& keyword,
132 const GURL& url) { 132 const GURL& url) {
133 // Skip if the keyword or url is invalid. 133 // Skip if the keyword or url is invalid.
134 if (keyword.empty() || !url.is_valid()) 134 if (keyword.empty() || !url.is_valid())
135 return NULL; 135 return NULL;
136 136
137 TemplateURL* t_url = new TemplateURL(); 137 TemplateURLData data;
138 // We set short name by using the title if it exists. 138 // We set short name by using the title if it exists.
139 // Otherwise, we use the shortcut. 139 // Otherwise, we use the shortcut.
140 t_url->set_short_name(title.empty() ? keyword : title); 140 data.short_name = title.empty() ? keyword : title;
141 t_url->set_keyword(keyword); 141 data.SetKeyword(keyword);
142 t_url->SetURL(TemplateURLRef::DisplayURLToURLRef(UTF8ToUTF16(url.spec()))); 142 data.SetURL(TemplateURLRef::DisplayURLToURLRef(UTF8ToUTF16(url.spec())));
143 return t_url; 143 return new TemplateURL(data);
144 } 144 }
145 145
146 // static 146 // static
147 void Firefox2Importer::ImportBookmarksFile( 147 void Firefox2Importer::ImportBookmarksFile(
148 const FilePath& file_path, 148 const FilePath& file_path,
149 const std::set<GURL>& default_urls, 149 const std::set<GURL>& default_urls,
150 Importer* importer, 150 Importer* importer,
151 std::vector<ProfileWriter::BookmarkEntry>* bookmarks, 151 std::vector<ProfileWriter::BookmarkEntry>* bookmarks,
152 std::vector<TemplateURL*>* template_urls, 152 std::vector<TemplateURL*>* template_urls,
153 std::vector<history::ImportedFaviconUsage>* favicons) { 153 std::vector<history::ImportedFaviconUsage>* favicons) {
(...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after
657 657
658 // We need to make up a URL for the favicon. We use a version of the page's 658 // We need to make up a URL for the favicon. We use a version of the page's
659 // URL so that we can be sure it will not collide. 659 // URL so that we can be sure it will not collide.
660 usage.favicon_url = GURL(std::string("made-up-favicon:") + link_url.spec()); 660 usage.favicon_url = GURL(std::string("made-up-favicon:") + link_url.spec());
661 661
662 // We only have one URL per favicon for Firefox 2 bookmarks. 662 // We only have one URL per favicon for Firefox 2 bookmarks.
663 usage.urls.insert(link_url); 663 usage.urls.insert(link_url);
664 664
665 favicons->push_back(usage); 665 favicons->push_back(usage);
666 } 666 }
OLDNEW
« no previous file with comments | « chrome/browser/autocomplete/search_provider_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