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

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: Update thread hops. Created 6 years, 5 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 925 matching lines...) Expand 10 before | Expand all | Expand 10 after
936 removal_mask, 936 removal_mask,
937 content::StoragePartition::QUOTA_MANAGED_STORAGE_MASK_ALL, 937 content::StoragePartition::QUOTA_MANAGED_STORAGE_MASK_ALL,
938 GURL(), 938 GURL(),
939 content::StoragePartition::OriginMatcherFunction(), 939 content::StoragePartition::OriginMatcherFunction(),
940 remove_since, 940 remove_since,
941 base::Time::Now(), 941 base::Time::Now(),
942 callback); 942 callback);
943 return true; 943 return true;
944 } 944 }
945 945
946 // static
947 void WebViewGuest::FileSystemAccessedAsync(int render_process_id,
948 int render_frame_id,
949 int request_id,
950 const GURL& url,
951 bool blocked_by_policy) {
952 WebViewGuest* guest =
953 WebViewGuest::FromFrameID(render_process_id, render_frame_id);
954 DCHECK(guest);
955 guest->RequestFileSystemPermission(
956 url,
957 !blocked_by_policy,
958 base::Bind(&WebViewGuest::FileSystemAccessedAsyncResponse,
959 render_process_id,
960 render_frame_id,
961 request_id,
962 url));
963 }
964
965 // static
966 void WebViewGuest::FileSystemAccessedAsyncResponse(int render_process_id,
967 int render_frame_id,
968 int request_id,
969 const GURL& url,
970 bool allowed) {
971 TabSpecificContentSettings::FileSystemAccessed(
972 render_process_id, render_frame_id, url, !allowed);
973 content::RenderFrameHost* render_frame_host =
974 content::RenderFrameHost::FromID(render_process_id, render_frame_id);
975 if (!render_frame_host)
976 return;
977 render_frame_host->Send(
978 new ChromeViewMsg_RequestFileSystemAccessAsyncResponse(
979 render_frame_id, request_id, allowed));
980 }
981
982 // static
983 void WebViewGuest::FileSystemAccessedSync(int render_process_id,
984 int render_frame_id,
985 const GURL& url,
986 bool blocked_by_policy,
987 IPC::Message* reply_msg) {
988 WebViewGuest* guest =
989 WebViewGuest::FromFrameID(render_process_id, render_frame_id);
990 DCHECK(guest);
991 guest->RequestFileSystemPermission(
992 url,
993 !blocked_by_policy,
994 base::Bind(&WebViewGuest::FileSystemAccessedSyncResponse,
995 render_process_id,
996 render_frame_id,
997 url,
998 reply_msg));
999 }
1000
1001 // static
1002 void WebViewGuest::FileSystemAccessedSyncResponse(int render_process_id,
1003 int render_frame_id,
1004 const GURL& url,
1005 IPC::Message* reply_msg,
1006 bool allowed) {
1007 TabSpecificContentSettings::FileSystemAccessed(
1008 render_process_id, render_frame_id, url, !allowed);
1009 ChromeViewHostMsg_RequestFileSystemAccessSync::WriteReplyParams(reply_msg,
1010 allowed);
1011 content::RenderFrameHost* render_frame_host =
1012 content::RenderFrameHost::FromID(render_process_id, render_frame_id);
1013 if (!render_frame_id)
1014 return;
1015 render_frame_host->Send(reply_msg);
1016 }
1017
1018 WebViewGuest::~WebViewGuest() { 946 WebViewGuest::~WebViewGuest() {
1019 } 947 }
1020 948
1021 void WebViewGuest::DidCommitProvisionalLoadForFrame( 949 void WebViewGuest::DidCommitProvisionalLoadForFrame(
1022 content::RenderFrameHost* render_frame_host, 950 content::RenderFrameHost* render_frame_host,
1023 const GURL& url, 951 const GURL& url,
1024 content::PageTransition transition_type) { 952 content::PageTransition transition_type) {
1025 find_helper_.CancelAllFindSessions(); 953 find_helper_.CancelAllFindSessions();
1026 954
1027 scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue()); 955 scoped_ptr<base::DictionaryValue> args(new base::DictionaryValue());
(...skipping 632 matching lines...) Expand 10 before | Expand all | Expand 10 after
1660 bool allow, 1588 bool allow,
1661 const std::string& user_input) { 1589 const std::string& user_input) {
1662 WebViewGuest* guest = 1590 WebViewGuest* guest =
1663 WebViewGuest::From(embedder_render_process_id(), new_window_instance_id); 1591 WebViewGuest::From(embedder_render_process_id(), new_window_instance_id);
1664 if (!guest) 1592 if (!guest)
1665 return; 1593 return;
1666 1594
1667 if (!allow) 1595 if (!allow)
1668 guest->Destroy(); 1596 guest->Destroy();
1669 } 1597 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698