Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2898)

Unified Diff: chrome/browser/guest_view/web_view/web_view_guest.cc

Issue 306473012: Plumb file system permission into WebviewGuest. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix worker Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/guest_view/web_view/web_view_guest.cc
diff --git a/chrome/browser/guest_view/web_view/web_view_guest.cc b/chrome/browser/guest_view/web_view/web_view_guest.cc
index 9f9ea466b834bb7667ae8d76cd3b6dcf6b5638ab..632781a294ebf45ba54898dc74b972ce327e15ec 100644
--- a/chrome/browser/guest_view/web_view/web_view_guest.cc
+++ b/chrome/browser/guest_view/web_view/web_view_guest.cc
@@ -134,6 +134,8 @@ static std::string PermissionTypeToString(WebViewPermissionType type) {
return webview::kPermissionTypeNewWindow;
case WEB_VIEW_PERMISSION_TYPE_POINTER_LOCK:
return webview::kPermissionTypePointerLock;
+ case WEB_VIEW_PERMISSION_TYPE_FILESYSTEM:
+ return webview::kPermissionTypeFileSystem;
default:
NOTREACHED();
return std::string();
@@ -257,6 +259,9 @@ void WebViewGuest::RecordUserInitiatedUMA(const PermissionResponseInfo& info,
content::RecordAction(
UserMetricsAction("WebView.PermissionAllow.PointerLock"));
break;
+ case WEB_VIEW_PERMISSION_TYPE_FILESYSTEM:
+ content::RecordAction(
+ UserMetricsAction("WebView.PermissionAllow.FileSystem"));
default:
break;
}
@@ -289,6 +294,10 @@ void WebViewGuest::RecordUserInitiatedUMA(const PermissionResponseInfo& info,
content::RecordAction(
UserMetricsAction("WebView.PermissionDeny.PointerLock"));
break;
+ case WEB_VIEW_PERMISSION_TYPE_FILESYSTEM:
+ content::RecordAction(
+ UserMetricsAction("WebView.PermissionDeny.FileSystem"));
+ break;
default:
break;
}
@@ -616,6 +625,27 @@ void WebViewGuest::Reload() {
guest_web_contents()->GetController().Reload(false);
}
+void WebViewGuest::RequestFileSystemPermission(
+ const GURL& url,
+ const base::Callback<void(bool)>& callback) {
+ base::DictionaryValue request_info;
+ request_info.Set(guestview::kUrl, base::Value::CreateStringValue(url.spec()));
+ RequestPermission(
+ WEB_VIEW_PERMISSION_TYPE_FILESYSTEM,
+ request_info,
+ base::Bind(&WebViewGuest::OnWebViewFileSystemPermissionResponse,
+ base::Unretained(this),
+ callback),
+ false /* allowed_by_default */);
+}
+
+void WebViewGuest::OnWebViewFileSystemPermissionResponse(
+ const base::Callback<void(bool)>& callback,
+ bool allow,
+ const std::string& user_input) {
+ callback.Run(!allow || !attached());
+}
+
void WebViewGuest::RequestGeolocationPermission(
int bridge_id,
const GURL& requesting_frame,

Powered by Google App Engine
This is Rietveld 408576698