OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/utility/importer/firefox_importer.h" | 5 #include "chrome/utility/importer/firefox_importer.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 | 8 |
9 #include "base/files/file_enumerator.h" | 9 #include "base/files/file_enumerator.h" |
10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
11 #include "base/json/json_file_value_serializer.h" | 11 #include "base/json/json_file_value_serializer.h" |
| 12 #include "base/macros.h" |
12 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
13 #include "base/message_loop/message_loop.h" | 14 #include "base/message_loop/message_loop.h" |
14 #include "base/stl_util.h" | 15 #include "base/stl_util.h" |
15 #include "base/strings/string_util.h" | 16 #include "base/strings/string_util.h" |
16 #include "base/strings/utf_string_conversions.h" | 17 #include "base/strings/utf_string_conversions.h" |
| 18 #include "build/build_config.h" |
17 #include "chrome/common/importer/firefox_importer_utils.h" | 19 #include "chrome/common/importer/firefox_importer_utils.h" |
18 #include "chrome/common/importer/imported_bookmark_entry.h" | 20 #include "chrome/common/importer/imported_bookmark_entry.h" |
19 #include "chrome/common/importer/importer_autofill_form_data_entry.h" | 21 #include "chrome/common/importer/importer_autofill_form_data_entry.h" |
20 #include "chrome/common/importer/importer_bridge.h" | 22 #include "chrome/common/importer/importer_bridge.h" |
21 #include "chrome/common/importer/importer_url_row.h" | 23 #include "chrome/common/importer/importer_url_row.h" |
22 #include "chrome/grit/generated_resources.h" | 24 #include "chrome/grit/generated_resources.h" |
23 #include "chrome/utility/importer/bookmark_html_reader.h" | 25 #include "chrome/utility/importer/bookmark_html_reader.h" |
24 #include "chrome/utility/importer/favicon_reencode.h" | 26 #include "chrome/utility/importer/favicon_reencode.h" |
25 #include "chrome/utility/importer/nss_decryptor.h" | 27 #include "chrome/utility/importer/nss_decryptor.h" |
26 #include "components/autofill/core/common/password_form.h" | 28 #include "components/autofill/core/common/password_form.h" |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 } // namespace | 82 } // namespace |
81 | 83 |
82 struct FirefoxImporter::BookmarkItem { | 84 struct FirefoxImporter::BookmarkItem { |
83 int parent; | 85 int parent; |
84 int id; | 86 int id; |
85 GURL url; | 87 GURL url; |
86 base::string16 title; | 88 base::string16 title; |
87 BookmarkItemType type; | 89 BookmarkItemType type; |
88 std::string keyword; | 90 std::string keyword; |
89 base::Time date_added; | 91 base::Time date_added; |
90 int64 favicon; | 92 int64_t favicon; |
91 bool empty_folder; | 93 bool empty_folder; |
92 }; | 94 }; |
93 | 95 |
94 FirefoxImporter::FirefoxImporter() { | 96 FirefoxImporter::FirefoxImporter() { |
95 } | 97 } |
96 | 98 |
97 FirefoxImporter::~FirefoxImporter() { | 99 FirefoxImporter::~FirefoxImporter() { |
98 } | 100 } |
99 | 101 |
100 void FirefoxImporter::StartImport( | 102 void FirefoxImporter::StartImport(const importer::SourceProfile& source_profile, |
101 const importer::SourceProfile& source_profile, | 103 uint16_t items, |
102 uint16 items, | 104 ImporterBridge* bridge) { |
103 ImporterBridge* bridge) { | |
104 bridge_ = bridge; | 105 bridge_ = bridge; |
105 source_path_ = source_profile.source_path; | 106 source_path_ = source_profile.source_path; |
106 app_path_ = source_profile.app_path; | 107 app_path_ = source_profile.app_path; |
107 | 108 |
108 #if defined(OS_POSIX) | 109 #if defined(OS_POSIX) |
109 locale_ = source_profile.locale; | 110 locale_ = source_profile.locale; |
110 #endif | 111 #endif |
111 | 112 |
112 // The order here is important! | 113 // The order here is important! |
113 bridge_->NotifyStarted(); | 114 bridge_->NotifyStarted(); |
(...skipping 670 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
784 | 785 |
785 if (!importer::ReencodeFavicon(&data[0], data.size(), &usage.png_data)) | 786 if (!importer::ReencodeFavicon(&data[0], data.size(), &usage.png_data)) |
786 continue; // Unable to decode. | 787 continue; // Unable to decode. |
787 | 788 |
788 usage.urls = i->second; | 789 usage.urls = i->second; |
789 favicons->push_back(usage); | 790 favicons->push_back(usage); |
790 } | 791 } |
791 s.Reset(true); | 792 s.Reset(true); |
792 } | 793 } |
793 } | 794 } |
OLD | NEW |