| Index: chrome/browser/importer/firefox3_importer.cc
|
| diff --git a/chrome/browser/importer/firefox3_importer.cc b/chrome/browser/importer/firefox3_importer.cc
|
| index 2cab2caee68c69bc92f1a311925e57e945ab2ea2..7aee612a35ad72ee5271200f3c612c85aaacaa22 100644
|
| --- a/chrome/browser/importer/firefox3_importer.cc
|
| +++ b/chrome/browser/importer/firefox3_importer.cc
|
| @@ -41,6 +41,24 @@ enum BookmarkItemType {
|
| TYPE_DYNAMIC_CONTAINER = 4
|
| };
|
|
|
| +// Creates a TemplateURL with the |keyword| and |url|. |title| may be empty.
|
| +// This function transfers ownership of the created TemplateURL to the caller.
|
| +TemplateURL* CreateTemplateURL(const string16& title,
|
| + const string16& keyword,
|
| + const GURL& url) {
|
| + // Skip if the keyword or url is invalid.
|
| + if (keyword.empty() || !url.is_valid())
|
| + return NULL;
|
| +
|
| + TemplateURLData data;
|
| + // We set short name by using the title if it exists.
|
| + // Otherwise, we use the shortcut.
|
| + data.short_name = title.empty() ? keyword : title;
|
| + data.SetKeyword(keyword);
|
| + data.SetURL(TemplateURLRef::DisplayURLToURLRef(UTF8ToUTF16(url.spec())));
|
| + return new TemplateURL(NULL, data);
|
| +}
|
| +
|
| } // namespace
|
|
|
| struct Firefox3Importer::BookmarkItem {
|
| @@ -273,7 +291,7 @@ void Firefox3Importer::ImportBookmarks() {
|
| favicon_map[item->favicon].insert(item->url);
|
|
|
| // This bookmark has a keyword, we import it to our TemplateURL model.
|
| - TemplateURL* t_url = Firefox2Importer::CreateTemplateURL(
|
| + TemplateURL* t_url = CreateTemplateURL(
|
| item->title, UTF8ToUTF16(item->keyword), item->url);
|
| if (t_url)
|
| template_urls.push_back(t_url);
|
|
|