| 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 774 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 785 | 785 |
| 786 select_file_dialog_ = ui::SelectFileDialog::Create( | 786 select_file_dialog_ = ui::SelectFileDialog::Create( |
| 787 this, new ChromeSelectFilePolicy(web_contents)); | 787 this, new ChromeSelectFilePolicy(web_contents)); |
| 788 ui::SelectFileDialog::FileTypeInfo file_type_info; | 788 ui::SelectFileDialog::FileTypeInfo file_type_info; |
| 789 file_type_info.extensions.resize(1); | 789 file_type_info.extensions.resize(1); |
| 790 file_type_info.extensions[0].push_back(FILE_PATH_LITERAL("html")); | 790 file_type_info.extensions[0].push_back(FILE_PATH_LITERAL("html")); |
| 791 gfx::NativeWindow owning_window = web_contents ? | 791 gfx::NativeWindow owning_window = web_contents ? |
| 792 platform_util::GetTopLevel(web_contents->GetNativeView()) | 792 platform_util::GetTopLevel(web_contents->GetNativeView()) |
| 793 : NULL; | 793 : NULL; |
| 794 #if defined(OS_WIN) | 794 #if defined(OS_WIN) |
| 795 if (!owning_window && | 795 if (!owning_window && chrome::GetActiveDesktop() == ui::HOST_DESKTOP_TYPE_ASH) |
| 796 chrome::GetActiveDesktop() == chrome::HOST_DESKTOP_TYPE_ASH) | |
| 797 owning_window = aura::RemoteWindowTreeHostWin::Instance()->GetAshWindow(); | 796 owning_window = aura::RemoteWindowTreeHostWin::Instance()->GetAshWindow(); |
| 798 #endif | 797 #endif |
| 799 // |web_contents| can be NULL (for background pages), which is fine. In such | 798 // |web_contents| can be NULL (for background pages), which is fine. In such |
| 800 // a case if file-selection dialogs are forbidden by policy, we will not | 799 // a case if file-selection dialogs are forbidden by policy, we will not |
| 801 // show an InfoBar, which is better than letting one appear out of the blue. | 800 // show an InfoBar, which is better than letting one appear out of the blue. |
| 802 select_file_dialog_->SelectFile(type, | 801 select_file_dialog_->SelectFile(type, |
| 803 base::string16(), | 802 base::string16(), |
| 804 default_path, | 803 default_path, |
| 805 &file_type_info, | 804 &file_type_info, |
| 806 0, | 805 0, |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 850 } | 849 } |
| 851 | 850 |
| 852 void BookmarksExportFunction::FileSelected(const base::FilePath& path, | 851 void BookmarksExportFunction::FileSelected(const base::FilePath& path, |
| 853 int index, | 852 int index, |
| 854 void* params) { | 853 void* params) { |
| 855 bookmark_html_writer::WriteBookmarks(GetProfile(), path, NULL); | 854 bookmark_html_writer::WriteBookmarks(GetProfile(), path, NULL); |
| 856 Release(); // Balanced in BookmarksIOFunction::SelectFile() | 855 Release(); // Balanced in BookmarksIOFunction::SelectFile() |
| 857 } | 856 } |
| 858 | 857 |
| 859 } // namespace extensions | 858 } // namespace extensions |
| OLD | NEW |