Updating trunk VERSION from 2139.0 to 2140.0
[chromium-blink-merge.git] / ui / shell_dialogs / select_file_dialog_android.h
bloba9d0d5432e7198965c4cd7c5aa8ad13cd1604ca4
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef UI_SHELL_DIALOGS_ANDROID_SELECT_FILE_DIALOG_ANDROID_H_
6 #define UI_SHELL_DIALOGS_ANDROID_SELECT_FILE_DIALOG_ANDROID_H_
8 #include <jni.h>
10 #include "base/android/scoped_java_ref.h"
11 #include "base/files/file_path.h"
12 #include "ui/shell_dialogs/select_file_dialog.h"
14 namespace ui {
16 class SelectFileDialogImpl : public SelectFileDialog {
17 public:
18 static SelectFileDialogImpl* Create(Listener* listener,
19 SelectFilePolicy* policy);
21 void OnFileSelected(JNIEnv* env,
22 jobject java_object,
23 jstring filepath,
24 jstring display_name);
26 void OnMultipleFilesSelected(JNIEnv* env,
27 jobject java_object,
28 jobjectArray filepaths,
29 jobjectArray display_names);
31 void OnFileNotSelected(JNIEnv* env, jobject java_object);
33 // From SelectFileDialog
34 virtual bool IsRunning(gfx::NativeWindow) const OVERRIDE;
35 virtual void ListenerDestroyed() OVERRIDE;
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 virtual void SelectFileImpl(
41 SelectFileDialog::Type type,
42 const base::string16& title,
43 const base::FilePath& default_path,
44 const SelectFileDialog::FileTypeInfo* file_types,
45 int file_type_index,
46 const std::string& default_extension,
47 gfx::NativeWindow owning_window,
48 void* params) OVERRIDE;
50 static bool RegisterSelectFileDialog(JNIEnv* env);
52 protected:
53 virtual ~SelectFileDialogImpl();
55 private:
56 SelectFileDialogImpl(Listener* listener, SelectFilePolicy* policy);
58 virtual bool HasMultipleFileTypeChoicesImpl() OVERRIDE;
60 base::android::ScopedJavaGlobalRef<jobject> java_object_;
62 DISALLOW_COPY_AND_ASSIGN(SelectFileDialogImpl);
65 SelectFileDialog* CreateAndroidSelectFileDialog(
66 SelectFileDialog::Listener* listener,
67 SelectFilePolicy* policy);
69 } // namespace ui
71 #endif // UI_SHELL_DIALOGS_ANDROID_SELECT_FILE_DIALOG_ANDROID_H_