summaryrefslogtreecommitdiffstats
path: root/chrome/browser/file_select_helper.cc
diff options
context:
space:
mode:
authorpastarmovj@chromium.org <pastarmovj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-15 21:10:00 +0000
committerpastarmovj@chromium.org <pastarmovj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-15 21:10:00 +0000
commitd9898919b7f2e479c84caa3ec6f214f2e10bdddb (patch)
tree485ae6bc95b819467b87a3266b745acf688886da /chrome/browser/file_select_helper.cc
parent79d68c6ea3f0ee22789e04bcdcdf64841618f2c1 (diff)
downloadchromium_src-d9898919b7f2e479c84caa3ec6f214f2e10bdddb.zip
chromium_src-d9898919b7f2e479c84caa3ec6f214f2e10bdddb.tar.gz
chromium_src-d9898919b7f2e479c84caa3ec6f214f2e10bdddb.tar.bz2
Policy to manage file selection dialogs.
Adds a policy to allow/disallow file selection dialogs from wherever they can be launched (Save Link As, Import Bookmarks, etc.). In case file selection dialogs are disallowed by policy a InfoBar informs the user whenever he triggers a file selection dialog. BUG=73174 TEST=Manually set the policy and check if the corresponding file selection are not shown and the InfoBar appears. Review URL: http://codereview.chromium.org/6814011 Patch from Sandro Feuz <sfeuz@google.com>. git-svn-id: svn://svn.chromium.org/chrome/trunk/src@81804 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/file_select_helper.cc')
-rw-r--r--chrome/browser/file_select_helper.cc6
1 files changed, 6 insertions, 0 deletions
diff --git a/chrome/browser/file_select_helper.cc b/chrome/browser/file_select_helper.cc
index a4545ad..3ee8c5a 100644
--- a/chrome/browser/file_select_helper.cc
+++ b/chrome/browser/file_select_helper.cc
@@ -17,6 +17,8 @@
#include "content/browser/renderer_host/render_view_host.h"
#include "content/browser/renderer_host/render_widget_host_view.h"
#include "content/browser/tab_contents/tab_contents.h"
+#include "chrome/browser/ui/browser.h"
+#include "chrome/browser/ui/browser_list.h"
#include "content/common/notification_details.h"
#include "content/common/notification_source.h"
#include "content/common/view_messages.h"
@@ -234,6 +236,7 @@ SelectFileDialog::FileTypeInfo* FileSelectHelper::GetFileTypesFromAcceptType(
void FileSelectHelper::RunFileChooser(
RenderViewHost* render_view_host,
+ TabContents* tab_contents,
const ViewHostMsg_RunFileChooser_Params& params) {
DCHECK(!render_view_host_);
render_view_host_ = render_view_host;
@@ -270,12 +273,14 @@ void FileSelectHelper::RunFileChooser(
gfx::NativeWindow owning_window =
platform_util::GetTopLevel(render_view_host_->view()->GetNativeView());
+
select_file_dialog_->SelectFile(dialog_type_,
params.title,
default_file_name,
file_types.get(),
file_types.get() ? 1 : 0, // 1-based index.
FILE_PATH_LITERAL(""),
+ tab_contents,
owning_window,
NULL);
}
@@ -318,6 +323,7 @@ void FileSelectObserver::OnRunFileChooser(
if (!file_select_helper_.get())
file_select_helper_.reset(new FileSelectHelper(tab_contents()->profile()));
file_select_helper_->RunFileChooser(tab_contents()->render_view_host(),
+ tab_contents(),
params);
}