OLD | NEW |
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/extensions/api/bookmarks/bookmarks_api.h" | 5 #include "chrome/browser/extensions/api/bookmarks/bookmarks_api.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
9 #include "base/i18n/file_util_icu.h" | 9 #include "base/i18n/file_util_icu.h" |
10 #include "base/i18n/time_formatting.h" | 10 #include "base/i18n/time_formatting.h" |
(...skipping 12 matching lines...) Expand all Loading... |
23 #include "chrome/browser/bookmarks/bookmark_html_writer.h" | 23 #include "chrome/browser/bookmarks/bookmark_html_writer.h" |
24 #include "chrome/browser/bookmarks/bookmark_model.h" | 24 #include "chrome/browser/bookmarks/bookmark_model.h" |
25 #include "chrome/browser/bookmarks/bookmark_model_factory.h" | 25 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
26 #include "chrome/browser/bookmarks/bookmark_utils.h" | 26 #include "chrome/browser/bookmarks/bookmark_utils.h" |
27 #include "chrome/browser/extensions/api/bookmarks/bookmark_api_constants.h" | 27 #include "chrome/browser/extensions/api/bookmarks/bookmark_api_constants.h" |
28 #include "chrome/browser/extensions/api/bookmarks/bookmark_api_helpers.h" | 28 #include "chrome/browser/extensions/api/bookmarks/bookmark_api_helpers.h" |
29 #include "chrome/browser/extensions/event_router.h" | 29 #include "chrome/browser/extensions/event_router.h" |
30 #include "chrome/browser/extensions/extension_function_dispatcher.h" | 30 #include "chrome/browser/extensions/extension_function_dispatcher.h" |
31 #include "chrome/browser/extensions/extension_system.h" | 31 #include "chrome/browser/extensions/extension_system.h" |
32 #include "chrome/browser/extensions/extensions_quota_service.h" | 32 #include "chrome/browser/extensions/extensions_quota_service.h" |
| 33 #include "chrome/browser/importer/external_process_importer_host.h" |
33 #include "chrome/browser/importer/importer_data_types.h" | 34 #include "chrome/browser/importer/importer_data_types.h" |
34 #include "chrome/browser/importer/importer_host.h" | |
35 #include "chrome/browser/importer/importer_type.h" | 35 #include "chrome/browser/importer/importer_type.h" |
36 #include "chrome/browser/profiles/profile.h" | 36 #include "chrome/browser/profiles/profile.h" |
37 #include "chrome/browser/ui/chrome_select_file_policy.h" | 37 #include "chrome/browser/ui/chrome_select_file_policy.h" |
38 #include "chrome/common/chrome_notification_types.h" | 38 #include "chrome/common/chrome_notification_types.h" |
39 #include "chrome/common/chrome_paths.h" | 39 #include "chrome/common/chrome_paths.h" |
40 #include "chrome/common/extensions/api/bookmarks.h" | 40 #include "chrome/common/extensions/api/bookmarks.h" |
41 #include "chrome/common/pref_names.h" | 41 #include "chrome/common/pref_names.h" |
42 #include "components/user_prefs/user_prefs.h" | 42 #include "components/user_prefs/user_prefs.h" |
43 #include "content/public/browser/notification_service.h" | 43 #include "content/public/browser/notification_service.h" |
44 #include "grit/generated_resources.h" | 44 #include "grit/generated_resources.h" |
(...skipping 925 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
970 } | 970 } |
971 | 971 |
972 void BookmarksImportFunction::FileSelected(const base::FilePath& path, | 972 void BookmarksImportFunction::FileSelected(const base::FilePath& path, |
973 int index, | 973 int index, |
974 void* params) { | 974 void* params) { |
975 #if !defined(OS_ANDROID) | 975 #if !defined(OS_ANDROID) |
976 // Android does not have support for the standard importers. | 976 // Android does not have support for the standard importers. |
977 // TODO(jgreenwald): remove ifdef once extensions are no longer built on | 977 // TODO(jgreenwald): remove ifdef once extensions are no longer built on |
978 // Android. | 978 // Android. |
979 // Deletes itself. | 979 // Deletes itself. |
980 ImporterHost* importer_host = new ImporterHost; | 980 ImporterHost* importer_host = new ExternalProcessImporterHost; |
981 importer::SourceProfile source_profile; | 981 importer::SourceProfile source_profile; |
982 source_profile.importer_type = importer::TYPE_BOOKMARKS_FILE; | 982 source_profile.importer_type = importer::TYPE_BOOKMARKS_FILE; |
983 source_profile.source_path = path; | 983 source_profile.source_path = path; |
984 importer_host->StartImportSettings(source_profile, | 984 importer_host->StartImportSettings(source_profile, |
985 profile(), | 985 profile(), |
986 importer::FAVORITES, | 986 importer::FAVORITES, |
987 new ProfileWriter(profile())); | 987 new ProfileWriter(profile())); |
988 | 988 |
989 importer::LogImporterUseToMetrics("BookmarksAPI", | 989 importer::LogImporterUseToMetrics("BookmarksAPI", |
990 importer::TYPE_BOOKMARKS_FILE); | 990 importer::TYPE_BOOKMARKS_FILE); |
(...skipping 12 matching lines...) Expand all Loading... |
1003 #if !defined(OS_ANDROID) | 1003 #if !defined(OS_ANDROID) |
1004 // Android does not have support for the standard exporter. | 1004 // Android does not have support for the standard exporter. |
1005 // TODO(jgreenwald): remove ifdef once extensions are no longer built on | 1005 // TODO(jgreenwald): remove ifdef once extensions are no longer built on |
1006 // Android. | 1006 // Android. |
1007 bookmark_html_writer::WriteBookmarks(profile(), path, NULL); | 1007 bookmark_html_writer::WriteBookmarks(profile(), path, NULL); |
1008 #endif | 1008 #endif |
1009 Release(); // Balanced in BookmarksIOFunction::SelectFile() | 1009 Release(); // Balanced in BookmarksIOFunction::SelectFile() |
1010 } | 1010 } |
1011 | 1011 |
1012 } // namespace extensions | 1012 } // namespace extensions |
OLD | NEW |