From d9898919b7f2e479c84caa3ec6f214f2e10bdddb Mon Sep 17 00:00:00 2001 From: "pastarmovj@chromium.org" Date: Fri, 15 Apr 2011 21:10:00 +0000 Subject: 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 . git-svn-id: svn://svn.chromium.org/chrome/trunk/src@81804 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/file_select_helper.cc | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'chrome/browser/file_select_helper.cc') 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); } -- cgit v1.1