| 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/extensions/extension_bookmarks_module.h" | 5 #include "chrome/browser/extensions/extension_bookmarks_module.h" |
| 6 | 6 |
| 7 #include "base/file_path.h" | 7 #include "base/file_path.h" |
| 8 #include "base/i18n/file_util_icu.h" | 8 #include "base/i18n/file_util_icu.h" |
| 9 #include "base/i18n/time_formatting.h" | 9 #include "base/i18n/time_formatting.h" |
| 10 #include "base/json/json_writer.h" | 10 #include "base/json/json_writer.h" |
| (...skipping 782 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 793 BookmarksQuotaLimitFactory::Build<UpdateBookmarkFunction>(heuristics); | 793 BookmarksQuotaLimitFactory::Build<UpdateBookmarkFunction>(heuristics); |
| 794 }; | 794 }; |
| 795 | 795 |
| 796 void CreateBookmarkFunction::GetQuotaLimitHeuristics( | 796 void CreateBookmarkFunction::GetQuotaLimitHeuristics( |
| 797 QuotaLimitHeuristics* heuristics) const { | 797 QuotaLimitHeuristics* heuristics) const { |
| 798 BookmarksQuotaLimitFactory::BuildForCreate(heuristics, profile()); | 798 BookmarksQuotaLimitFactory::BuildForCreate(heuristics, profile()); |
| 799 } | 799 } |
| 800 | 800 |
| 801 BookmarksIOFunction::BookmarksIOFunction() {} | 801 BookmarksIOFunction::BookmarksIOFunction() {} |
| 802 | 802 |
| 803 BookmarksIOFunction::~BookmarksIOFunction() {} | 803 BookmarksIOFunction::~BookmarksIOFunction() { |
| 804 // There may be pending file dialogs, we need to tell them that we've gone |
| 805 // away so they don't try and call back to us. |
| 806 if (select_file_dialog_.get()) |
| 807 select_file_dialog_->ListenerDestroyed(); |
| 808 } |
| 804 | 809 |
| 805 void BookmarksIOFunction::SelectFile(SelectFileDialog::Type type) { | 810 void BookmarksIOFunction::SelectFile(SelectFileDialog::Type type) { |
| 806 // Balanced in one of the three callbacks of SelectFileDialog: | 811 // Balanced in one of the three callbacks of SelectFileDialog: |
| 807 // either FileSelectionCanceled, MultiFilesSelected, or FileSelected | 812 // either FileSelectionCanceled, MultiFilesSelected, or FileSelected |
| 808 AddRef(); | 813 AddRef(); |
| 809 select_file_dialog_ = SelectFileDialog::Create(this); | 814 select_file_dialog_ = SelectFileDialog::Create(this); |
| 810 SelectFileDialog::FileTypeInfo file_type_info; | 815 SelectFileDialog::FileTypeInfo file_type_info; |
| 811 file_type_info.extensions.resize(1); | 816 file_type_info.extensions.resize(1); |
| 812 file_type_info.extensions[0].push_back(FILE_PATH_LITERAL("html")); | 817 file_type_info.extensions[0].push_back(FILE_PATH_LITERAL("html")); |
| 813 | 818 |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 863 SelectFile(SelectFileDialog::SELECT_SAVEAS_FILE); | 868 SelectFile(SelectFileDialog::SELECT_SAVEAS_FILE); |
| 864 return true; | 869 return true; |
| 865 } | 870 } |
| 866 | 871 |
| 867 void ExportBookmarksFunction::FileSelected(const FilePath& path, | 872 void ExportBookmarksFunction::FileSelected(const FilePath& path, |
| 868 int index, | 873 int index, |
| 869 void* params) { | 874 void* params) { |
| 870 bookmark_html_writer::WriteBookmarks(profile(), path, NULL); | 875 bookmark_html_writer::WriteBookmarks(profile(), path, NULL); |
| 871 Release(); // Balanced in BookmarksIOFunction::SelectFile() | 876 Release(); // Balanced in BookmarksIOFunction::SelectFile() |
| 872 } | 877 } |
| OLD | NEW |