Commit 0e6871ab authored by Marijn Kruisselbrink's avatar Marijn Kruisselbrink Committed by Commit Bot

Move Native File System API specific methods out of browser_dialogs.h

Instead have a separate nataive_file_system_dialogs.h file for these methods.

Bug: none
Change-Id: I3c752c604cd29d4f7703503673b9b8530a04cd20
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2091724Reviewed-by: default avatarElly Fong-Jones <ellyjones@chromium.org>
Commit-Queue: Marijn Kruisselbrink <mek@chromium.org>
Cr-Commit-Position: refs/heads/master@{#747898}
parent 5398bc16
......@@ -20,7 +20,7 @@
#include "chrome/browser/native_file_system/native_file_system_permission_request_manager.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/safe_browsing/download_protection/download_protection_service.h"
#include "chrome/browser/ui/browser_dialogs.h"
#include "chrome/browser/ui/native_file_system_dialogs.h"
#include "chrome/common/chrome_paths.h"
#include "components/content_settings/core/browser/host_content_settings_map.h"
#include "components/content_settings/core/common/content_settings.h"
......
......@@ -6,7 +6,7 @@
#include "base/command_line.h"
#include "base/task/post_task.h"
#include "chrome/browser/ui/browser_dialogs.h"
#include "chrome/browser/ui/native_file_system_dialogs.h"
#include "components/permissions/permission_util.h"
#include "components/permissions/switches.h"
#include "content/public/browser/browser_task_traits.h"
......
......@@ -9,7 +9,7 @@
#include "build/build_config.h"
#include "chrome/browser/native_file_system/native_file_system_permission_request_manager.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser_dialogs.h"
#include "chrome/browser/ui/native_file_system_dialogs.h"
#if !defined(OS_ANDROID)
#include "chrome/browser/ui/browser.h"
......
......@@ -19,7 +19,7 @@
#include "chrome/browser/native_file_system/native_file_system_permission_request_manager.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/safe_browsing/download_protection/download_protection_service.h"
#include "chrome/browser/ui/browser_dialogs.h"
#include "chrome/browser/ui/native_file_system_dialogs.h"
#include "chrome/common/chrome_paths.h"
#include "components/content_settings/core/browser/host_content_settings_map.h"
#include "components/content_settings/core/common/content_settings.h"
......
......@@ -122,6 +122,8 @@ jumbo_static_library("ui") {
"login/login_navigation_throttle.h",
"login/login_tab_helper.cc",
"login/login_tab_helper.h",
"native_file_system_dialogs.cc",
"native_file_system_dialogs.h",
"navigation_correction_tab_observer.cc",
"navigation_correction_tab_observer.h",
"page_info/page_info.cc",
......
......@@ -27,4 +27,6 @@ per-file ui_features.h=*
per-file settings_window_manager*chromeos*=file://chrome/browser/ui/ash/OWNERS
per-file native_file_system*=file://content/browser/native_file_system/OWNERS
# COMPONENT: UI>Browser
......@@ -5,7 +5,6 @@
#include "chrome/browser/ui/browser_dialogs.h"
#include "base/metrics/histogram_macros.h"
#include "components/permissions/permission_util.h"
namespace chrome {
......@@ -26,40 +25,4 @@ void ShowFolderUploadConfirmationDialog(
content::WebContents* web_contents) {
std::move(callback).Run(selected_files);
}
void ShowNativeFileSystemPermissionDialog(
const url::Origin& origin,
const base::FilePath& path,
bool is_directory,
base::OnceCallback<void(permissions::PermissionAction result)> callback,
content::WebContents* web_contents) {
// There's no dialog version of this available outside views, run callback as
// if the dialog was instantly cancelled.
std::move(callback).Run(permissions::PermissionAction::DISMISSED);
}
void ShowNativeFileSystemRestrictedDirectoryDialog(
const url::Origin& origin,
const base::FilePath& path,
bool is_directory,
base::OnceCallback<void(
content::NativeFileSystemPermissionContext::SensitiveDirectoryResult)>
callback,
content::WebContents* web_contents) {
// There's no dialog version of this available outside views, run callback as
// if the dialog was instantly dismissed.
std::move(callback).Run(content::NativeFileSystemPermissionContext::
SensitiveDirectoryResult::kAbort);
}
void ShowNativeFileSystemDirectoryAccessConfirmationDialog(
const url::Origin& origin,
const base::FilePath& path,
base::OnceCallback<void(permissions::PermissionAction result)> callback,
content::WebContents* web_contents) {
// There's no dialog version of this available outside views, run callback as
// if the dialog was instantly dismissed.
std::move(callback).Run(permissions::PermissionAction::DISMISSED);
}
#endif // !defined(TOOLKIT_VIEWS)
......@@ -16,7 +16,6 @@
#include "build/build_config.h"
#include "chrome/browser/ui/bookmarks/bookmark_editor.h"
#include "content/public/browser/content_browser_client.h"
#include "content/public/browser/native_file_system_permission_context.h"
#include "third_party/skia/include/core/SkColor.h"
#include "ui/gfx/native_widget_types.h"
......@@ -62,10 +61,6 @@ class WebDialogDelegate;
struct SelectedFileInfo;
} // namespace ui
namespace url {
class Origin;
} // namespace url
namespace chrome {
// Shows or hides the Task Manager. |browser| can be NULL when called from Ash.
......@@ -312,35 +307,4 @@ void ShowFolderUploadConfirmationDialog(
std::vector<ui::SelectedFileInfo> selected_files,
content::WebContents* web_contents);
// Displays a dialog to ask for write access to the given file or directory for
// the native file system API.
void ShowNativeFileSystemPermissionDialog(
const url::Origin& origin,
const base::FilePath& path,
bool is_directory,
base::OnceCallback<void(permissions::PermissionAction result)> callback,
content::WebContents* web_contents);
// Displays a dialog to inform the user that the |path| they picked using the
// native file system API is blocked by chrome. |is_directory| is true if the
// user was selecting a directory, otherwise the user was selecting files within
// a directory. |callback| is called when the user has dismissed the dialog.
void ShowNativeFileSystemRestrictedDirectoryDialog(
const url::Origin& origin,
const base::FilePath& path,
bool is_directory,
base::OnceCallback<void(
content::NativeFileSystemPermissionContext::SensitiveDirectoryResult)>
callback,
content::WebContents* web_contents);
// Displays a dialog to confirm that the user intended to give read access to a
// specific directory. Similar to ShowFolderUploadConfirmationDialog above,
// except for use by the Native File System API.
void ShowNativeFileSystemDirectoryAccessConfirmationDialog(
const url::Origin& origin,
const base::FilePath& path,
base::OnceCallback<void(permissions::PermissionAction result)> callback,
content::WebContents* web_contents);
#endif // CHROME_BROWSER_UI_BROWSER_DIALOGS_H_
// Copyright 2020 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/ui/native_file_system_dialogs.h"
#include "components/permissions/permission_util.h"
#if !defined(TOOLKIT_VIEWS)
void ShowNativeFileSystemPermissionDialog(
const url::Origin& origin,
const base::FilePath& path,
bool is_directory,
base::OnceCallback<void(permissions::PermissionAction result)> callback,
content::WebContents* web_contents) {
// There's no dialog version of this available outside views, run callback as
// if the dialog was instantly cancelled.
std::move(callback).Run(permissions::PermissionAction::DISMISSED);
}
void ShowNativeFileSystemRestrictedDirectoryDialog(
const url::Origin& origin,
const base::FilePath& path,
bool is_directory,
base::OnceCallback<void(
content::NativeFileSystemPermissionContext::SensitiveDirectoryResult)>
callback,
content::WebContents* web_contents) {
// There's no dialog version of this available outside views, run callback as
// if the dialog was instantly dismissed.
std::move(callback).Run(content::NativeFileSystemPermissionContext::
SensitiveDirectoryResult::kAbort);
}
void ShowNativeFileSystemDirectoryAccessConfirmationDialog(
const url::Origin& origin,
const base::FilePath& path,
base::OnceCallback<void(permissions::PermissionAction result)> callback,
content::WebContents* web_contents) {
// There's no dialog version of this available outside views, run callback as
// if the dialog was instantly dismissed.
std::move(callback).Run(permissions::PermissionAction::DISMISSED);
}
#endif // !defined(TOOLKIT_VIEWS)
// Copyright 2020 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_UI_NATIVE_FILE_SYSTEM_DIALOGS_H_
#define CHROME_BROWSER_UI_NATIVE_FILE_SYSTEM_DIALOGS_H_
#include <string>
#include <vector>
#include "base/callback.h"
#include "build/build_config.h"
#include "content/public/browser/native_file_system_permission_context.h"
namespace base {
class FilePath;
}
namespace content {
class WebContents;
}
namespace permissions {
enum class PermissionAction;
}
namespace url {
class Origin;
} // namespace url
// Displays a dialog to ask for write access to the given file or directory for
// the native file system API.
void ShowNativeFileSystemPermissionDialog(
const url::Origin& origin,
const base::FilePath& path,
bool is_directory,
base::OnceCallback<void(permissions::PermissionAction result)> callback,
content::WebContents* web_contents);
// Displays a dialog to inform the user that the |path| they picked using the
// native file system API is blocked by chrome. |is_directory| is true if the
// user was selecting a directory, otherwise the user was selecting files within
// a directory. |callback| is called when the user has dismissed the dialog.
void ShowNativeFileSystemRestrictedDirectoryDialog(
const url::Origin& origin,
const base::FilePath& path,
bool is_directory,
base::OnceCallback<void(
content::NativeFileSystemPermissionContext::SensitiveDirectoryResult)>
callback,
content::WebContents* web_contents);
// Displays a dialog to confirm that the user intended to give read access to a
// specific directory. Similar to ShowFolderUploadConfirmationDialog above,
// except for use by the Native File System API.
void ShowNativeFileSystemDirectoryAccessConfirmationDialog(
const url::Origin& origin,
const base::FilePath& path,
base::OnceCallback<void(permissions::PermissionAction result)> callback,
content::WebContents* web_contents);
#endif // CHROME_BROWSER_UI_NATIVE_FILE_SYSTEM_DIALOGS_H_
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment