OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
323 first_folder_name, this, &bookmarks, &template_urls, | 323 first_folder_name, this, &bookmarks, &template_urls, |
324 &favicons); | 324 &favicons); |
325 | 325 |
326 // Write data into profile. | 326 // Write data into profile. |
327 if (!bookmarks.empty() && !cancelled()) { | 327 if (!bookmarks.empty() && !cancelled()) { |
328 int options = 0; | 328 int options = 0; |
329 if (import_to_bookmark_bar()) | 329 if (import_to_bookmark_bar()) |
330 options |= ProfileWriter::IMPORT_TO_BOOKMARK_BAR; | 330 options |= ProfileWriter::IMPORT_TO_BOOKMARK_BAR; |
331 if (bookmark_bar_disabled()) | 331 if (bookmark_bar_disabled()) |
332 options |= ProfileWriter::BOOKMARK_BAR_DISABLED; | 332 options |= ProfileWriter::BOOKMARK_BAR_DISABLED; |
333 bridge_->AddBookmarkEntries(bookmarks, first_folder_name, options); | 333 bridge_->AddBookmarks(bookmarks, first_folder_name, options); |
334 } | 334 } |
335 if (!parsing_bookmarks_html_file_ && !template_urls.empty() && | 335 if (!parsing_bookmarks_html_file_ && !template_urls.empty() && |
336 !cancelled()) { | 336 !cancelled()) { |
337 bridge_->SetKeywords(template_urls, -1, false); | 337 bridge_->SetKeywords(template_urls, -1, false); |
338 } else { | 338 } else { |
339 STLDeleteContainerPointers(template_urls.begin(), template_urls.end()); | 339 STLDeleteContainerPointers(template_urls.begin(), template_urls.end()); |
340 } | 340 } |
341 if (!favicons.empty()) { | 341 if (!favicons.empty()) |
342 bridge_->SetFavicons(favicons); | 342 bridge_->SetFavicons(favicons); |
343 } | |
344 } | 343 } |
345 | 344 |
346 void Firefox2Importer::ImportPasswords() { | 345 void Firefox2Importer::ImportPasswords() { |
347 // Initializes NSS3. | 346 // Initializes NSS3. |
348 NSSDecryptor decryptor; | 347 NSSDecryptor decryptor; |
349 if (!decryptor.Init(source_path_, source_path_) && | 348 if (!decryptor.Init(source_path_, source_path_) && |
350 !decryptor.Init(app_path_, source_path_)) { | 349 !decryptor.Init(app_path_, source_path_)) { |
351 return; | 350 return; |
352 } | 351 } |
353 | 352 |
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
680 | 679 |
681 // We need to make up a URL for the favicon. We use a version of the page's | 680 // We need to make up a URL for the favicon. We use a version of the page's |
682 // URL so that we can be sure it will not collide. | 681 // URL so that we can be sure it will not collide. |
683 usage.favicon_url = GURL(std::string("made-up-favicon:") + link_url.spec()); | 682 usage.favicon_url = GURL(std::string("made-up-favicon:") + link_url.spec()); |
684 | 683 |
685 // We only have one URL per favicon for Firefox 2 bookmarks. | 684 // We only have one URL per favicon for Firefox 2 bookmarks. |
686 usage.urls.insert(link_url); | 685 usage.urls.insert(link_url); |
687 | 686 |
688 favicons->push_back(usage); | 687 favicons->push_back(usage); |
689 } | 688 } |
OLD | NEW |