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 756 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
767 void BookmarksIOFunction::ShowSelectFileDialog( | 767 void BookmarksIOFunction::ShowSelectFileDialog( |
768 ui::SelectFileDialog::Type type, | 768 ui::SelectFileDialog::Type type, |
769 const base::FilePath& default_path) { | 769 const base::FilePath& default_path) { |
770 if (!dispatcher()) | 770 if (!dispatcher()) |
771 return; // Extension was unloaded. | 771 return; // Extension was unloaded. |
772 | 772 |
773 // Balanced in one of the three callbacks of SelectFileDialog: | 773 // Balanced in one of the three callbacks of SelectFileDialog: |
774 // either FileSelectionCanceled, MultiFilesSelected, or FileSelected | 774 // either FileSelectionCanceled, MultiFilesSelected, or FileSelected |
775 AddRef(); | 775 AddRef(); |
776 | 776 |
777 WebContents* web_contents = dispatcher()->delegate()-> | 777 WebContents* web_contents = GetAssociatedWebContents(); |
778 GetAssociatedWebContents(); | |
779 | 778 |
780 select_file_dialog_ = ui::SelectFileDialog::Create( | 779 select_file_dialog_ = ui::SelectFileDialog::Create( |
781 this, new ChromeSelectFilePolicy(web_contents)); | 780 this, new ChromeSelectFilePolicy(web_contents)); |
782 ui::SelectFileDialog::FileTypeInfo file_type_info; | 781 ui::SelectFileDialog::FileTypeInfo file_type_info; |
783 file_type_info.extensions.resize(1); | 782 file_type_info.extensions.resize(1); |
784 file_type_info.extensions[0].push_back(FILE_PATH_LITERAL("html")); | 783 file_type_info.extensions[0].push_back(FILE_PATH_LITERAL("html")); |
785 gfx::NativeWindow owning_window = web_contents ? | 784 gfx::NativeWindow owning_window = web_contents ? |
786 platform_util::GetTopLevel(web_contents->GetNativeView()) | 785 platform_util::GetTopLevel(web_contents->GetNativeView()) |
787 : NULL; | 786 : NULL; |
788 #if defined(OS_WIN) | 787 #if defined(OS_WIN) |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
844 } | 843 } |
845 | 844 |
846 void BookmarksExportFunction::FileSelected(const base::FilePath& path, | 845 void BookmarksExportFunction::FileSelected(const base::FilePath& path, |
847 int index, | 846 int index, |
848 void* params) { | 847 void* params) { |
849 bookmark_html_writer::WriteBookmarks(GetProfile(), path, NULL); | 848 bookmark_html_writer::WriteBookmarks(GetProfile(), path, NULL); |
850 Release(); // Balanced in BookmarksIOFunction::SelectFile() | 849 Release(); // Balanced in BookmarksIOFunction::SelectFile() |
851 } | 850 } |
852 | 851 |
853 } // namespace extensions | 852 } // namespace extensions |
OLD | NEW |