| 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/bookmarks/bookmark_extension_api.h" | 5 #include "chrome/browser/bookmarks/bookmark_extension_api.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/file_path.h" | 8 #include "base/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 898 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 909 bool ImportBookmarksFunction::RunImpl() { | 909 bool ImportBookmarksFunction::RunImpl() { |
| 910 if (!EditBookmarksEnabled()) | 910 if (!EditBookmarksEnabled()) |
| 911 return false; | 911 return false; |
| 912 SelectFile(SelectFileDialog::SELECT_OPEN_FILE); | 912 SelectFile(SelectFileDialog::SELECT_OPEN_FILE); |
| 913 return true; | 913 return true; |
| 914 } | 914 } |
| 915 | 915 |
| 916 void ImportBookmarksFunction::FileSelected(const FilePath& path, | 916 void ImportBookmarksFunction::FileSelected(const FilePath& path, |
| 917 int index, | 917 int index, |
| 918 void* params) { | 918 void* params) { |
| 919 #if !defined(OS_ANDROID) |
| 920 // Android does not have support for the standard importers. |
| 921 // TODO(jgreenwald): remove ifdef once extensions are no longer built on |
| 922 // Android. |
| 919 scoped_refptr<ImporterHost> importer_host(new ImporterHost); | 923 scoped_refptr<ImporterHost> importer_host(new ImporterHost); |
| 920 importer::SourceProfile source_profile; | 924 importer::SourceProfile source_profile; |
| 921 source_profile.importer_type = importer::TYPE_BOOKMARKS_FILE; | 925 source_profile.importer_type = importer::TYPE_BOOKMARKS_FILE; |
| 922 source_profile.source_path = path; | 926 source_profile.source_path = path; |
| 923 importer_host->StartImportSettings(source_profile, | 927 importer_host->StartImportSettings(source_profile, |
| 924 profile(), | 928 profile(), |
| 925 importer::FAVORITES, | 929 importer::FAVORITES, |
| 926 new ProfileWriter(profile()), | 930 new ProfileWriter(profile()), |
| 927 true); | 931 true); |
| 932 #endif |
| 928 Release(); // Balanced in BookmarksIOFunction::SelectFile() | 933 Release(); // Balanced in BookmarksIOFunction::SelectFile() |
| 929 } | 934 } |
| 930 | 935 |
| 931 bool ExportBookmarksFunction::RunImpl() { | 936 bool ExportBookmarksFunction::RunImpl() { |
| 932 SelectFile(SelectFileDialog::SELECT_SAVEAS_FILE); | 937 SelectFile(SelectFileDialog::SELECT_SAVEAS_FILE); |
| 933 return true; | 938 return true; |
| 934 } | 939 } |
| 935 | 940 |
| 936 void ExportBookmarksFunction::FileSelected(const FilePath& path, | 941 void ExportBookmarksFunction::FileSelected(const FilePath& path, |
| 937 int index, | 942 int index, |
| 938 void* params) { | 943 void* params) { |
| 939 bookmark_html_writer::WriteBookmarks(profile(), path, NULL); | 944 bookmark_html_writer::WriteBookmarks(profile(), path, NULL); |
| 940 Release(); // Balanced in BookmarksIOFunction::SelectFile() | 945 Release(); // Balanced in BookmarksIOFunction::SelectFile() |
| 941 } | 946 } |
| OLD | NEW |