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 965 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 scoped_refptr<ImporterHost> importer_host(new ImporterHost); | 979 scoped_refptr<ImporterHost> importer_host(new ImporterHost); |
980 importer::SourceProfile source_profile; | 980 importer::SourceProfile source_profile; |
981 source_profile.importer_type = importer::TYPE_BOOKMARKS_FILE; | 981 source_profile.importer_type = importer::TYPE_BOOKMARKS_FILE; |
982 source_profile.source_path = path; | 982 source_profile.source_path = path; |
983 importer_host->StartImportSettings(source_profile, | 983 importer_host->StartImportSettings(source_profile, |
984 profile(), | 984 profile(), |
985 importer::FAVORITES, | 985 importer::FAVORITES, |
986 new ProfileWriter(profile()), | 986 new ProfileWriter(profile())); |
987 true); | |
988 | 987 |
989 importer::LogImporterUseToMetrics("BookmarksAPI", | 988 importer::LogImporterUseToMetrics("BookmarksAPI", |
990 importer::TYPE_BOOKMARKS_FILE); | 989 importer::TYPE_BOOKMARKS_FILE); |
991 #endif | 990 #endif |
992 Release(); // Balanced in BookmarksIOFunction::SelectFile() | 991 Release(); // Balanced in BookmarksIOFunction::SelectFile() |
993 } | 992 } |
994 | 993 |
995 bool BookmarksExportFunction::RunImpl() { | 994 bool BookmarksExportFunction::RunImpl() { |
996 SelectFile(ui::SelectFileDialog::SELECT_SAVEAS_FILE); | 995 SelectFile(ui::SelectFileDialog::SELECT_SAVEAS_FILE); |
997 return true; | 996 return true; |
998 } | 997 } |
999 | 998 |
1000 void BookmarksExportFunction::FileSelected(const base::FilePath& path, | 999 void BookmarksExportFunction::FileSelected(const base::FilePath& path, |
1001 int index, | 1000 int index, |
1002 void* params) { | 1001 void* params) { |
1003 #if !defined(OS_ANDROID) | 1002 #if !defined(OS_ANDROID) |
1004 // Android does not have support for the standard exporter. | 1003 // Android does not have support for the standard exporter. |
1005 // TODO(jgreenwald): remove ifdef once extensions are no longer built on | 1004 // TODO(jgreenwald): remove ifdef once extensions are no longer built on |
1006 // Android. | 1005 // Android. |
1007 bookmark_html_writer::WriteBookmarks(profile(), path, NULL); | 1006 bookmark_html_writer::WriteBookmarks(profile(), path, NULL); |
1008 #endif | 1007 #endif |
1009 Release(); // Balanced in BookmarksIOFunction::SelectFile() | 1008 Release(); // Balanced in BookmarksIOFunction::SelectFile() |
1010 } | 1009 } |
1011 | 1010 |
1012 } // namespace extensions | 1011 } // namespace extensions |
OLD | NEW |