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

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: Initial patch 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 1861 matching lines...) Expand 10 before | Expand all | Expand 10 after
1872 for (i = render_frames.begin(); i != render_frames.end(); ++i) { 1872 for (i = render_frames.begin(); i != render_frames.end(); ++i) {
1873 BrowserThread::PostTask( 1873 BrowserThread::PostTask(
1874 BrowserThread::UI, FROM_HERE, 1874 BrowserThread::UI, FROM_HERE,
1875 base::Bind(&TabSpecificContentSettings::WebDatabaseAccessed, 1875 base::Bind(&TabSpecificContentSettings::WebDatabaseAccessed,
1876 i->first, i->second, url, name, display_name, !allow)); 1876 i->first, i->second, url, name, display_name, !allow));
1877 } 1877 }
1878 1878
1879 return allow; 1879 return allow;
1880 } 1880 }
1881 1881
1882 bool ChromeContentBrowserClient::AllowWorkerFileSystem( 1882 void ChromeContentBrowserClient::RequestWorkerFileSystemAccessSync(
1883 const GURL& url, 1883 const GURL& url,
1884 content::ResourceContext* context, 1884 content::ResourceContext* context,
1885 const std::vector<std::pair<int, int> >& render_frames) { 1885 const std::vector<std::pair<int, int> >& render_frames,
1886 base::Callback<void(bool)> callback) {
1886 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 1887 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
1887 ProfileIOData* io_data = ProfileIOData::FromResourceContext(context); 1888 ProfileIOData* io_data = ProfileIOData::FromResourceContext(context);
1888 CookieSettings* cookie_settings = io_data->GetCookieSettings(); 1889 CookieSettings* cookie_settings = io_data->GetCookieSettings();
1889 bool allow = cookie_settings->IsSettingCookieAllowed(url, url); 1890 bool allow = cookie_settings->IsSettingCookieAllowed(url, url);
1890 1891
1891 // Record access to file system for potential display in UI. 1892 // Record access to file system for potential display in UI.
1892 std::vector<std::pair<int, int> >::const_iterator i; 1893 std::vector<std::pair<int, int> >::const_iterator i;
1893 for (i = render_frames.begin(); i != render_frames.end(); ++i) { 1894 for (i = render_frames.begin(); i != render_frames.end(); ++i) {
1895 #if defined(ENABLE_EXTENSIONS)
1896 bool is_web_view_guest =
1897 ExtensionRendererState::GetInstance()->IsWebViewRenderer(i->first);
1898 if (is_web_view_guest) {
1899 BrowserThread::PostTask(BrowserThread::UI,
1900 FROM_HERE,
1901 base::Bind(&WebViewGuest::FileSystemAccessedSync,
1902 i->first,
1903 i->second,
1904 url,
1905 !allow,
1906 callback));
1907 continue;
1908 }
1909 #endif
1910 callback.Run(allow);
1894 BrowserThread::PostTask( 1911 BrowserThread::PostTask(
1895 BrowserThread::UI, FROM_HERE, 1912 BrowserThread::UI,
1913 FROM_HERE,
1896 base::Bind(&TabSpecificContentSettings::FileSystemAccessed, 1914 base::Bind(&TabSpecificContentSettings::FileSystemAccessed,
1897 i->first, i->second, url, !allow)); 1915 i->first,
1916 i->second,
1917 url,
1918 !allow));
1898 } 1919 }
1899
1900 return allow;
1901 } 1920 }
1902 1921
1903 bool ChromeContentBrowserClient::AllowWorkerIndexedDB( 1922 bool ChromeContentBrowserClient::AllowWorkerIndexedDB(
1904 const GURL& url, 1923 const GURL& url,
1905 const base::string16& name, 1924 const base::string16& name,
1906 content::ResourceContext* context, 1925 content::ResourceContext* context,
1907 const std::vector<std::pair<int, int> >& render_frames) { 1926 const std::vector<std::pair<int, int> >& render_frames) {
1908 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 1927 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
1909 ProfileIOData* io_data = ProfileIOData::FromResourceContext(context); 1928 ProfileIOData* io_data = ProfileIOData::FromResourceContext(context);
1910 CookieSettings* cookie_settings = io_data->GetCookieSettings(); 1929 CookieSettings* cookie_settings = io_data->GetCookieSettings();
(...skipping 940 matching lines...) Expand 10 before | Expand all | Expand 10 after
2851 switches::kDisableWebRtcEncryption, 2870 switches::kDisableWebRtcEncryption,
2852 }; 2871 };
2853 to_command_line->CopySwitchesFrom(from_command_line, 2872 to_command_line->CopySwitchesFrom(from_command_line,
2854 kWebRtcDevSwitchNames, 2873 kWebRtcDevSwitchNames,
2855 arraysize(kWebRtcDevSwitchNames)); 2874 arraysize(kWebRtcDevSwitchNames));
2856 } 2875 }
2857 } 2876 }
2858 #endif // defined(ENABLE_WEBRTC) 2877 #endif // defined(ENABLE_WEBRTC)
2859 2878
2860 } // namespace chrome 2879 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698