blob: b900cdcf97026443f6763ab132ef0c4dfdaf2c5c [file] [log] [blame]
[email protected]4344a3c2013-01-17 23:49:201// Copyright (c) 2013 The Chromium Authors. All rights reserved.
[email protected]e8c62b92013-01-16 23:08:272// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
[email protected]4344a3c2013-01-17 23:49:205#ifndef UI_SHELL_DIALOGS_ANDROID_SELECT_FILE_DIALOG_ANDROID_H_
6#define UI_SHELL_DIALOGS_ANDROID_SELECT_FILE_DIALOG_ANDROID_H_
[email protected]e8c62b92013-01-16 23:08:277
8#include <jni.h>
9
10#include "base/android/scoped_java_ref.h"
11#include "base/file_path.h"
[email protected]4344a3c2013-01-17 23:49:2012#include "ui/shell_dialogs/select_file_dialog.h"
[email protected]e8c62b92013-01-16 23:08:2713
14namespace ui {
15
16class SelectFileDialogImpl : public ui::SelectFileDialog {
17 public:
18 static SelectFileDialogImpl* Create(
19 Listener* listener,
20 ui::SelectFilePolicy* policy);
21
22 void OnFileSelected(JNIEnv* env, jobject java_object, jstring filepath);
23 void OnFileNotSelected(JNIEnv* env, jobject java_object);
24
25 // From SelectFileDialog
26 virtual bool IsRunning(gfx::NativeWindow) const OVERRIDE;
27 virtual void ListenerDestroyed() OVERRIDE;
28
29 // Called when it is time to display the file picker.
30 // params is expected to be a Vector<string16> with accept_types first and
31 // the capture value as the last element of the vector.
32 virtual void SelectFileImpl(
33 ui::SelectFileDialog::Type type,
34 const string16& title,
35 const FilePath& default_path,
36 const ui::SelectFileDialog::FileTypeInfo* file_types,
37 int file_type_index,
38 const std::string& default_extension,
39 gfx::NativeWindow owning_window,
40 void* params) OVERRIDE;
41
42 static bool RegisterSelectFileDialog(JNIEnv* env);
43
44 protected:
45 virtual ~SelectFileDialogImpl();
46
47 private:
48 SelectFileDialogImpl(Listener* listener, ui::SelectFilePolicy* policy);
49
50 virtual bool HasMultipleFileTypeChoicesImpl() OVERRIDE;
51
52 base::android::ScopedJavaGlobalRef<jobject> java_object_;
53
54 // Stores the state whether select_file_dialog is running.
55 bool is_running_;
56
57 DISALLOW_COPY_AND_ASSIGN(SelectFileDialogImpl);
58};
59
60SelectFileDialog* CreateAndroidSelectFileDialog(
61 SelectFileDialog::Listener* listener,
62 SelectFilePolicy* policy);
63
64} // namespace ui
65
[email protected]4344a3c2013-01-17 23:49:2066#endif // UI_SHELL_DIALOGS_ANDROID_SELECT_FILE_DIALOG_ANDROID_H_
67