| OLD | NEW |
| 1 // Copyright (c) 2011 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" |
| 11 #include "base/file_util.h" | 11 #include "base/file_util.h" |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 TemplateURL* Firefox2Importer::CreateTemplateURL(const std::wstring& title, | 133 TemplateURL* Firefox2Importer::CreateTemplateURL(const std::wstring& title, |
| 134 const std::wstring& keyword, | 134 const std::wstring& keyword, |
| 135 const GURL& url) { | 135 const GURL& url) { |
| 136 // Skip if the keyword or url is invalid. | 136 // Skip if the keyword or url is invalid. |
| 137 if (keyword.empty() && url.is_valid()) | 137 if (keyword.empty() && url.is_valid()) |
| 138 return NULL; | 138 return NULL; |
| 139 | 139 |
| 140 TemplateURL* t_url = new TemplateURL(); | 140 TemplateURL* t_url = new TemplateURL(); |
| 141 // We set short name by using the title if it exists. | 141 // We set short name by using the title if it exists. |
| 142 // Otherwise, we use the shortcut. | 142 // Otherwise, we use the shortcut. |
| 143 t_url->set_short_name(WideToUTF16Hack(!title.empty() ? title : keyword)); | 143 t_url->set_short_name(!title.empty() ? title : keyword); |
| 144 t_url->set_keyword(WideToUTF16Hack(keyword)); | 144 t_url->set_keyword(keyword); |
| 145 t_url->SetURL(TemplateURLRef::DisplayURLToURLRef(UTF8ToUTF16(url.spec())), | 145 t_url->SetURL(TemplateURLRef::DisplayURLToURLRef(UTF8ToWide(url.spec())), |
| 146 0, 0); | 146 0, 0); |
| 147 return t_url; | 147 return t_url; |
| 148 } | 148 } |
| 149 | 149 |
| 150 // static | 150 // static |
| 151 void Firefox2Importer::ImportBookmarksFile( | 151 void Firefox2Importer::ImportBookmarksFile( |
| 152 const FilePath& file_path, | 152 const FilePath& file_path, |
| 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, |
| (...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 } |
| OLD | NEW |