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

Side by Side Diff: chrome/browser/chrome_content_browser_client.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: Use scoped_refptr. 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/chrome_content_browser_client.h" 5 #include "chrome/browser/chrome_content_browser_client.h"
6 6
7 #include <set> 7 #include <set>
8 #include <utility> 8 #include <utility>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 1799 matching lines...) Expand 10 before | Expand all | Expand 10 after
1810 for (i = render_frames.begin(); i != render_frames.end(); ++i) { 1810 for (i = render_frames.begin(); i != render_frames.end(); ++i) {
1811 BrowserThread::PostTask( 1811 BrowserThread::PostTask(
1812 BrowserThread::UI, FROM_HERE, 1812 BrowserThread::UI, FROM_HERE,
1813 base::Bind(&TabSpecificContentSettings::WebDatabaseAccessed, 1813 base::Bind(&TabSpecificContentSettings::WebDatabaseAccessed,
1814 i->first, i->second, url, name, display_name, !allow)); 1814 i->first, i->second, url, name, display_name, !allow));
1815 } 1815 }
1816 1816
1817 return allow; 1817 return allow;
1818 } 1818 }
1819 1819
1820 bool ChromeContentBrowserClient::AllowWorkerFileSystem( 1820 void ChromeContentBrowserClient::RequestWorkerFileSystemAccess(
1821 const GURL& url, 1821 const GURL& url,
1822 content::ResourceContext* context, 1822 content::ResourceContext* context,
1823 const std::vector<std::pair<int, int> >& render_frames) { 1823 const std::vector<std::pair<int, int> >& render_frames,
1824 base::Callback<void(bool)> callback) {
1824 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 1825 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
1825 ProfileIOData* io_data = ProfileIOData::FromResourceContext(context); 1826 ProfileIOData* io_data = ProfileIOData::FromResourceContext(context);
1826 CookieSettings* cookie_settings = io_data->GetCookieSettings(); 1827 CookieSettings* cookie_settings = io_data->GetCookieSettings();
1827 bool allow = cookie_settings->IsSettingCookieAllowed(url, url); 1828 bool allow = cookie_settings->IsSettingCookieAllowed(url, url);
1828 1829
1829 // Record access to file system for potential display in UI. 1830 // Record access to file system for potential display in UI.
1830 std::vector<std::pair<int, int> >::const_iterator i; 1831 std::vector<std::pair<int, int> >::const_iterator i;
1831 for (i = render_frames.begin(); i != render_frames.end(); ++i) { 1832 for (i = render_frames.begin(); i != render_frames.end(); ++i) {
1833 #if defined(ENABLE_EXTENSIONS)
1834 bool is_web_view_guest =
1835 ExtensionRendererState::GetInstance()->IsWebViewRenderer(i->first);
1836 if (is_web_view_guest) {
1837 BrowserThread::PostTask(BrowserThread::UI,
1838 FROM_HERE,
1839 base::Bind(&WebViewGuest::FileSystemAccessed,
1840 i->first,
1841 i->second,
1842 url,
1843 !allow,
1844 callback));
1845 continue;
1846 }
1847 #endif
1848 callback.Run(allow);
1832 BrowserThread::PostTask( 1849 BrowserThread::PostTask(
1833 BrowserThread::UI, FROM_HERE, 1850 BrowserThread::UI,
1851 FROM_HERE,
1834 base::Bind(&TabSpecificContentSettings::FileSystemAccessed, 1852 base::Bind(&TabSpecificContentSettings::FileSystemAccessed,
1835 i->first, i->second, url, !allow)); 1853 i->first,
1854 i->second,
1855 url,
1856 !allow));
1836 } 1857 }
1837
1838 return allow;
1839 } 1858 }
1840 1859
1841 bool ChromeContentBrowserClient::AllowWorkerIndexedDB( 1860 bool ChromeContentBrowserClient::AllowWorkerIndexedDB(
1842 const GURL& url, 1861 const GURL& url,
1843 const base::string16& name, 1862 const base::string16& name,
1844 content::ResourceContext* context, 1863 content::ResourceContext* context,
1845 const std::vector<std::pair<int, int> >& render_frames) { 1864 const std::vector<std::pair<int, int> >& render_frames) {
1846 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 1865 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
1847 ProfileIOData* io_data = ProfileIOData::FromResourceContext(context); 1866 ProfileIOData* io_data = ProfileIOData::FromResourceContext(context);
1848 CookieSettings* cookie_settings = io_data->GetCookieSettings(); 1867 CookieSettings* cookie_settings = io_data->GetCookieSettings();
(...skipping 954 matching lines...) Expand 10 before | Expand all | Expand 10 after
2803 switches::kDisableWebRtcEncryption, 2822 switches::kDisableWebRtcEncryption,
2804 }; 2823 };
2805 to_command_line->CopySwitchesFrom(from_command_line, 2824 to_command_line->CopySwitchesFrom(from_command_line,
2806 kWebRtcDevSwitchNames, 2825 kWebRtcDevSwitchNames,
2807 arraysize(kWebRtcDevSwitchNames)); 2826 arraysize(kWebRtcDevSwitchNames));
2808 } 2827 }
2809 } 2828 }
2810 #endif // defined(ENABLE_WEBRTC) 2829 #endif // defined(ENABLE_WEBRTC)
2811 2830
2812 } // namespace chrome 2831 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698