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

Side by Side Diff: chrome/browser/guest_view/web_view/web_view_guest.cc

Issue 338353007: Implementation of shared worker code path for WebView file system permission. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master_sharedworker
Patch Set: rebase Created 6 years, 6 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/guest_view/web_view/web_view_guest.h" 5 #include "chrome/browser/guest_view/web_view/web_view_guest.h"
6 6
7 #include "base/message_loop/message_loop.h" 7 #include "base/message_loop/message_loop.h"
8 #include "base/strings/stringprintf.h" 8 #include "base/strings/stringprintf.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "chrome/browser/chrome_notification_types.h" 10 #include "chrome/browser/chrome_notification_types.h"
(...skipping 910 matching lines...) Expand 10 before | Expand all | Expand 10 after
921 render_frame_host->Send( 921 render_frame_host->Send(
922 new ChromeViewMsg_RequestFileSystemAccessAsyncResponse( 922 new ChromeViewMsg_RequestFileSystemAccessAsyncResponse(
923 render_frame_id, request_id, allowed)); 923 render_frame_id, request_id, allowed));
924 } 924 }
925 925
926 // static 926 // static
927 void WebViewGuest::FileSystemAccessedSync(int render_process_id, 927 void WebViewGuest::FileSystemAccessedSync(int render_process_id,
928 int render_frame_id, 928 int render_frame_id,
929 const GURL& url, 929 const GURL& url,
930 bool blocked_by_policy, 930 bool blocked_by_policy,
931 IPC::Message* reply_msg) { 931 base::Callback<void(bool)> callback) {
932 WebViewGuest* guest = 932 WebViewGuest* guest =
933 WebViewGuest::FromFrameID(render_process_id, render_frame_id); 933 WebViewGuest::FromFrameID(render_process_id, render_frame_id);
934 DCHECK(guest); 934 DCHECK(guest);
935 guest->RequestFileSystemPermission( 935 guest->RequestFileSystemPermission(
936 url, 936 url,
937 !blocked_by_policy, 937 !blocked_by_policy,
938 base::Bind(&WebViewGuest::FileSystemAccessedSyncResponse, 938 base::Bind(&WebViewGuest::FileSystemAccessedSyncResponse,
939 render_process_id, 939 render_process_id,
940 render_frame_id, 940 render_frame_id,
941 url, 941 url,
942 reply_msg)); 942 callback));
943 } 943 }
944 944
945 // static 945 // static
946 void WebViewGuest::FileSystemAccessedSyncResponse(int render_process_id, 946 void WebViewGuest::FileSystemAccessedSyncResponse(
947 int render_frame_id, 947 int render_process_id,
948 const GURL& url, 948 int render_frame_id,
949 IPC::Message* reply_msg, 949 const GURL& url,
950 bool allowed) { 950 base::Callback<void(bool)> callback,
951 bool allowed) {
951 TabSpecificContentSettings::FileSystemAccessed( 952 TabSpecificContentSettings::FileSystemAccessed(
952 render_process_id, render_frame_id, url, !allowed); 953 render_process_id, render_frame_id, url, !allowed);
953 ChromeViewHostMsg_RequestFileSystemAccessSync::WriteReplyParams(reply_msg, 954 callback.Run(allowed);
954 allowed);
955 content::RenderFrameHost* render_frame_host =
956 content::RenderFrameHost::FromID(render_process_id, render_frame_id);
957 if (!render_frame_id)
958 return;
959 render_frame_host->Send(reply_msg);
960 } 955 }
961 956
962 WebViewGuest::~WebViewGuest() { 957 WebViewGuest::~WebViewGuest() {
963 } 958 }
964 959
965 void WebViewGuest::DidCommitProvisionalLoadForFrame( 960 void WebViewGuest::DidCommitProvisionalLoadForFrame(
966 int64 frame_id, 961 int64 frame_id,
967 const base::string16& frame_unique_name, 962 const base::string16& frame_unique_name,
968 bool is_main_frame, 963 bool is_main_frame,
969 const GURL& url, 964 const GURL& url,
(...skipping 621 matching lines...) Expand 10 before | Expand all | Expand 10 after
1591 bool allow, 1586 bool allow,
1592 const std::string& user_input) { 1587 const std::string& user_input) {
1593 WebViewGuest* guest = 1588 WebViewGuest* guest =
1594 WebViewGuest::From(embedder_render_process_id(), new_window_instance_id); 1589 WebViewGuest::From(embedder_render_process_id(), new_window_instance_id);
1595 if (!guest) 1590 if (!guest)
1596 return; 1591 return;
1597 1592
1598 if (!allow) 1593 if (!allow)
1599 guest->Destroy(); 1594 guest->Destroy();
1600 } 1595 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698