Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 package org.chromium.content.browser; | |
| 6 | |
| 7 import java.util.ArrayList; | |
| 8 import java.util.Arrays; | |
| 9 import java.util.Collections; | |
| 10 import java.util.List; | |
| 11 | |
| 12 /** | |
| 13 * Parameters used by ContentViewClient when a file chooser is to be opened. | |
| 14 * Java equivalent of the native content/public/common/file_chooser_params.h, th ey should be kept in | |
| 15 * sync. | |
| 16 * See ContentUtil.java for conversion methods between the Java and native types . | |
|
Yaron
2012/06/09 01:02:11
content_util.cc
| |
| 17 */ | |
| 18 | |
| 19 public class FileChooserParams { | |
| 20 // Requires that the file exists before allowing the user to pick it. | |
| 21 public static final int OPEN_MODE = 0; | |
| 22 | |
| 23 // Like Open, but allows picking multiple files to open. | |
| 24 public static final int OPEN_MULTIPLE_MODE = 1; | |
| 25 | |
| 26 // Like Open, but selects a folder. | |
| 27 public static final int OPEN_FOLDER_MODE = 2; | |
| 28 | |
| 29 // Allows picking a nonexistent file, and prompts to overwrite if the file a lready exists. | |
| 30 public static final int SAVE_MODE = 3; | |
| 31 | |
| 32 private int mMode; | |
| 33 | |
| 34 // Title to be used for the dialog. This may be empty for the default title, which will be | |
| 35 // either "Open" or "Save" depending on the mode. | |
| 36 private String mTitle; | |
| 37 | |
| 38 // Default file name to select in the dialog. | |
| 39 private String mDefaultFileName; | |
| 40 | |
| 41 // A list of valid lower-cased MIME types specified in an input element. It is used to restrict | |
| 42 // selectable files to such types. | |
| 43 private List<String> mAcceptTypes; | |
| 44 | |
| 45 private String mCapture; | |
| 46 | |
| 47 public FileChooserParams(int mode, String title, String defaultFileName, Str ing[] acceptTypes, | |
| 48 String capture) { | |
| 49 mMode = mode; | |
| 50 mTitle = title; | |
| 51 mDefaultFileName = defaultFileName; | |
| 52 mAcceptTypes = Collections.unmodifiableList( | |
| 53 new ArrayList<String>(Arrays.asList(acceptTypes))); | |
| 54 mCapture = capture; | |
| 55 } | |
| 56 | |
| 57 public int getMode() { | |
| 58 return mMode; | |
| 59 } | |
| 60 | |
| 61 public String getTitle() { | |
| 62 return mTitle; | |
| 63 } | |
| 64 | |
| 65 public String getDefaultFileName() { | |
| 66 return mDefaultFileName; | |
| 67 } | |
| 68 | |
| 69 public List<String> getAcceptTypes() { | |
| 70 return mAcceptTypes; | |
| 71 } | |
| 72 | |
| 73 public String getCapture() { | |
| 74 return mCapture; | |
| 75 } | |
| 76 } | |
| OLD | NEW |