| 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 927 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 938 AddRef(); | 938 AddRef(); |
| 939 | 939 |
| 940 WebContents* web_contents = dispatcher()->delegate()-> | 940 WebContents* web_contents = dispatcher()->delegate()-> |
| 941 GetAssociatedWebContents(); | 941 GetAssociatedWebContents(); |
| 942 | 942 |
| 943 select_file_dialog_ = ui::SelectFileDialog::Create( | 943 select_file_dialog_ = ui::SelectFileDialog::Create( |
| 944 this, new ChromeSelectFilePolicy(web_contents)); | 944 this, new ChromeSelectFilePolicy(web_contents)); |
| 945 ui::SelectFileDialog::FileTypeInfo file_type_info; | 945 ui::SelectFileDialog::FileTypeInfo file_type_info; |
| 946 file_type_info.extensions.resize(1); | 946 file_type_info.extensions.resize(1); |
| 947 file_type_info.extensions[0].push_back(FILE_PATH_LITERAL("html")); | 947 file_type_info.extensions[0].push_back(FILE_PATH_LITERAL("html")); |
| 948 // TODO(kinaba): http://crbug.com/140425. Turn file_type_info.support_drive | |
| 949 // on for saving once Google Drive client on ChromeOS supports it. | |
| 950 gfx::NativeWindow owning_window = web_contents ? | 948 gfx::NativeWindow owning_window = web_contents ? |
| 951 platform_util::GetTopLevel(web_contents->GetView()->GetNativeView()) | 949 platform_util::GetTopLevel(web_contents->GetView()->GetNativeView()) |
| 952 : NULL; | 950 : NULL; |
| 953 #if defined(OS_WIN) && defined(USE_AURA) | 951 #if defined(OS_WIN) && defined(USE_AURA) |
| 954 if (!owning_window && | 952 if (!owning_window && |
| 955 chrome::GetActiveDesktop() == chrome::HOST_DESKTOP_TYPE_ASH) | 953 chrome::GetActiveDesktop() == chrome::HOST_DESKTOP_TYPE_ASH) |
| 956 owning_window = aura::RemoteRootWindowHostWin::Instance()->GetAshWindow(); | 954 owning_window = aura::RemoteRootWindowHostWin::Instance()->GetAshWindow(); |
| 957 #endif | 955 #endif |
| 958 if (type == ui::SelectFileDialog::SELECT_OPEN_FILE) | |
| 959 file_type_info.support_drive = true; | |
| 960 // |web_contents| can be NULL (for background pages), which is fine. In such | 956 // |web_contents| can be NULL (for background pages), which is fine. In such |
| 961 // a case if file-selection dialogs are forbidden by policy, we will not | 957 // a case if file-selection dialogs are forbidden by policy, we will not |
| 962 // show an InfoBar, which is better than letting one appear out of the blue. | 958 // show an InfoBar, which is better than letting one appear out of the blue. |
| 963 select_file_dialog_->SelectFile(type, | 959 select_file_dialog_->SelectFile(type, |
| 964 string16(), | 960 string16(), |
| 965 default_path, | 961 default_path, |
| 966 &file_type_info, | 962 &file_type_info, |
| 967 0, | 963 0, |
| 968 base::FilePath::StringType(), | 964 base::FilePath::StringType(), |
| 969 owning_window, | 965 owning_window, |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1021 #if !defined(OS_ANDROID) | 1017 #if !defined(OS_ANDROID) |
| 1022 // Android does not have support for the standard exporter. | 1018 // Android does not have support for the standard exporter. |
| 1023 // TODO(jgreenwald): remove ifdef once extensions are no longer built on | 1019 // TODO(jgreenwald): remove ifdef once extensions are no longer built on |
| 1024 // Android. | 1020 // Android. |
| 1025 bookmark_html_writer::WriteBookmarks(profile(), path, NULL); | 1021 bookmark_html_writer::WriteBookmarks(profile(), path, NULL); |
| 1026 #endif | 1022 #endif |
| 1027 Release(); // Balanced in BookmarksIOFunction::SelectFile() | 1023 Release(); // Balanced in BookmarksIOFunction::SelectFile() |
| 1028 } | 1024 } |
| 1029 | 1025 |
| 1030 } // namespace extensions | 1026 } // namespace extensions |
| OLD | NEW |