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