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

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

Powered by Google App Engine
This is Rietveld 408576698