| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #ifndef UI_SHELL_DIALOGS_ANDROID_SELECT_FILE_DIALOG_ANDROID_H_ | 5 #ifndef UI_SHELL_DIALOGS_ANDROID_SELECT_FILE_DIALOG_ANDROID_H_ |
| 6 #define UI_SHELL_DIALOGS_ANDROID_SELECT_FILE_DIALOG_ANDROID_H_ | 6 #define UI_SHELL_DIALOGS_ANDROID_SELECT_FILE_DIALOG_ANDROID_H_ |
| 7 | 7 |
| 8 #include <jni.h> | 8 #include "base/macros.h" |
| 9 | |
| 10 #include "base/android/scoped_java_ref.h" | |
| 11 #include "base/files/file_path.h" | |
| 12 #include "ui/shell_dialogs/select_file_dialog.h" | 9 #include "ui/shell_dialogs/select_file_dialog.h" |
| 13 | 10 |
| 14 namespace ui { | 11 namespace ui { |
| 15 | 12 |
| 16 class SelectFileDialogImpl : public SelectFileDialog { | 13 class SelectFileDialogImpl : public SelectFileDialog { |
| 17 public: | 14 public: |
| 18 static SelectFileDialogImpl* Create(Listener* listener, | 15 static SelectFileDialogImpl* Create(Listener* listener, |
| 19 SelectFilePolicy* policy); | 16 SelectFilePolicy* policy); |
| 20 | 17 |
| 21 void OnFileSelected(JNIEnv* env, | |
| 22 jobject java_object, | |
| 23 jstring filepath, | |
| 24 jstring display_name); | |
| 25 | |
| 26 void OnMultipleFilesSelected(JNIEnv* env, | |
| 27 jobject java_object, | |
| 28 jobjectArray filepaths, | |
| 29 jobjectArray display_names); | |
| 30 | |
| 31 void OnFileNotSelected(JNIEnv* env, jobject java_object); | |
| 32 | |
| 33 // From SelectFileDialog | 18 // From SelectFileDialog |
| 34 bool IsRunning(gfx::NativeWindow) const override; | 19 bool IsRunning(gfx::NativeWindow) const override; |
| 35 void ListenerDestroyed() override; | 20 void ListenerDestroyed() override; |
| 36 | |
| 37 // Called when it is time to display the file picker. | |
| 38 // params is expected to be a vector<string16> with accept_types first and | |
| 39 // the capture value as the last element of the vector. | |
| 40 void SelectFileImpl(SelectFileDialog::Type type, | 21 void SelectFileImpl(SelectFileDialog::Type type, |
| 41 const base::string16& title, | 22 const base::string16& title, |
| 42 const base::FilePath& default_path, | 23 const base::FilePath& default_path, |
| 43 const SelectFileDialog::FileTypeInfo* file_types, | 24 const SelectFileDialog::FileTypeInfo* file_types, |
| 44 int file_type_index, | 25 int file_type_index, |
| 45 const std::string& default_extension, | 26 const std::string& default_extension, |
| 46 gfx::NativeWindow owning_window, | 27 gfx::NativeWindow owning_window, |
| 47 void* params) override; | 28 void* params) override; |
| 48 | 29 |
| 49 static bool RegisterSelectFileDialog(JNIEnv* env); | |
| 50 | |
| 51 protected: | 30 protected: |
| 52 ~SelectFileDialogImpl() override; | 31 ~SelectFileDialogImpl() override; |
| 53 | 32 |
| 54 private: | 33 private: |
| 55 SelectFileDialogImpl(Listener* listener, SelectFilePolicy* policy); | 34 SelectFileDialogImpl(Listener* listener, SelectFilePolicy* policy); |
| 56 | 35 |
| 57 bool HasMultipleFileTypeChoicesImpl() override; | 36 bool HasMultipleFileTypeChoicesImpl() override; |
| 58 | 37 |
| 59 base::android::ScopedJavaGlobalRef<jobject> java_object_; | |
| 60 | |
| 61 DISALLOW_COPY_AND_ASSIGN(SelectFileDialogImpl); | 38 DISALLOW_COPY_AND_ASSIGN(SelectFileDialogImpl); |
| 62 }; | 39 }; |
| 63 | 40 |
| 64 SelectFileDialog* CreateAndroidSelectFileDialog( | 41 SelectFileDialog* CreateAndroidSelectFileDialog( |
| 65 SelectFileDialog::Listener* listener, | 42 SelectFileDialog::Listener* listener, |
| 66 SelectFilePolicy* policy); | 43 SelectFilePolicy* policy); |
| 67 | 44 |
| 68 } // namespace ui | 45 } // namespace ui |
| 69 | 46 |
| 70 #endif // UI_SHELL_DIALOGS_ANDROID_SELECT_FILE_DIALOG_ANDROID_H_ | 47 #endif // UI_SHELL_DIALOGS_ANDROID_SELECT_FILE_DIALOG_ANDROID_H_ |
| 71 | 48 |
| OLD | NEW |