diff options
Diffstat (limited to 'chrome/browser/ui/chrome_select_file_policy.cc')
-rw-r--r-- | chrome/browser/ui/chrome_select_file_policy.cc | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/chrome/browser/ui/chrome_select_file_policy.cc b/chrome/browser/ui/chrome_select_file_policy.cc index 116b52a..b41f060 100644 --- a/chrome/browser/ui/chrome_select_file_policy.cc +++ b/chrome/browser/ui/chrome_select_file_policy.cc @@ -24,16 +24,7 @@ ChromeSelectFilePolicy::ChromeSelectFilePolicy( ChromeSelectFilePolicy::~ChromeSelectFilePolicy() {} bool ChromeSelectFilePolicy::CanOpenSelectFileDialog() { - DCHECK(g_browser_process); - - // local_state() can return NULL for tests. - if (!g_browser_process->local_state()) - return false; - - return !g_browser_process->local_state()->FindPreference( - prefs::kAllowFileSelectionDialogs) || - g_browser_process->local_state()->GetBoolean( - prefs::kAllowFileSelectionDialogs); + return FileSelectDialogsAllowed(); } void ChromeSelectFilePolicy::SelectFileDenied() { @@ -52,3 +43,17 @@ void ChromeSelectFilePolicy::SelectFileDenied() { << "is given to display the InfoBar."; } } + +// static +bool ChromeSelectFilePolicy::FileSelectDialogsAllowed() { + DCHECK(g_browser_process); + + // local_state() can return NULL for tests. + if (!g_browser_process->local_state()) + return false; + + return !g_browser_process->local_state()->FindPreference( + prefs::kAllowFileSelectionDialogs) || + g_browser_process->local_state()->GetBoolean( + prefs::kAllowFileSelectionDialogs); +} |