Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 630 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 641 return ratio * (kMaxFSM - kMinFSM) + kMinFSM; | 641 return ratio * (kMaxFSM - kMinFSM) + kMinFSM; |
| 642 } | 642 } |
| 643 | 643 |
| 644 #endif // defined(OS_ANDROID) | 644 #endif // defined(OS_ANDROID) |
| 645 | 645 |
| 646 } // namespace | 646 } // namespace |
| 647 | 647 |
| 648 namespace chrome { | 648 namespace chrome { |
| 649 | 649 |
| 650 ChromeContentBrowserClient::ChromeContentBrowserClient() | 650 ChromeContentBrowserClient::ChromeContentBrowserClient() |
| 651 : prerender_tracker_(NULL) { | 651 : prerender_tracker_(NULL), |
| 652 weak_factory_(this) { | |
| 652 #if defined(ENABLE_PLUGINS) | 653 #if defined(ENABLE_PLUGINS) |
| 653 for (size_t i = 0; i < arraysize(kPredefinedAllowedDevChannelOrigins); ++i) | 654 for (size_t i = 0; i < arraysize(kPredefinedAllowedDevChannelOrigins); ++i) |
| 654 allowed_dev_channel_origins_.insert(kPredefinedAllowedDevChannelOrigins[i]); | 655 allowed_dev_channel_origins_.insert(kPredefinedAllowedDevChannelOrigins[i]); |
| 655 for (size_t i = 0; i < arraysize(kPredefinedAllowedFileHandleOrigins); ++i) | 656 for (size_t i = 0; i < arraysize(kPredefinedAllowedFileHandleOrigins); ++i) |
| 656 allowed_file_handle_origins_.insert(kPredefinedAllowedFileHandleOrigins[i]); | 657 allowed_file_handle_origins_.insert(kPredefinedAllowedFileHandleOrigins[i]); |
| 657 for (size_t i = 0; i < arraysize(kPredefinedAllowedSocketOrigins); ++i) | 658 for (size_t i = 0; i < arraysize(kPredefinedAllowedSocketOrigins); ++i) |
| 658 allowed_socket_origins_.insert(kPredefinedAllowedSocketOrigins[i]); | 659 allowed_socket_origins_.insert(kPredefinedAllowedSocketOrigins[i]); |
| 659 #endif | 660 #endif |
| 660 | 661 |
| 661 permissions_policy_delegate_.reset( | 662 permissions_policy_delegate_.reset( |
| (...skipping 1149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1811 for (i = render_frames.begin(); i != render_frames.end(); ++i) { | 1812 for (i = render_frames.begin(); i != render_frames.end(); ++i) { |
| 1812 BrowserThread::PostTask( | 1813 BrowserThread::PostTask( |
| 1813 BrowserThread::UI, FROM_HERE, | 1814 BrowserThread::UI, FROM_HERE, |
| 1814 base::Bind(&TabSpecificContentSettings::WebDatabaseAccessed, | 1815 base::Bind(&TabSpecificContentSettings::WebDatabaseAccessed, |
| 1815 i->first, i->second, url, name, display_name, !allow)); | 1816 i->first, i->second, url, name, display_name, !allow)); |
| 1816 } | 1817 } |
| 1817 | 1818 |
| 1818 return allow; | 1819 return allow; |
| 1819 } | 1820 } |
| 1820 | 1821 |
| 1821 bool ChromeContentBrowserClient::AllowWorkerFileSystem( | 1822 void ChromeContentBrowserClient::AllowWorkerFileSystem( |
| 1822 const GURL& url, | 1823 const GURL& url, |
| 1823 content::ResourceContext* context, | 1824 content::ResourceContext* context, |
| 1824 const std::vector<std::pair<int, int> >& render_frames) { | 1825 const std::vector<std::pair<int, int> >& render_frames, |
| 1826 base::Callback<void(bool)> callback) { | |
| 1825 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 1827 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 1826 ProfileIOData* io_data = ProfileIOData::FromResourceContext(context); | 1828 ProfileIOData* io_data = ProfileIOData::FromResourceContext(context); |
| 1827 CookieSettings* cookie_settings = io_data->GetCookieSettings(); | 1829 CookieSettings* cookie_settings = io_data->GetCookieSettings(); |
| 1828 bool allow = cookie_settings->IsSettingCookieAllowed(url, url); | 1830 bool allow = cookie_settings->IsSettingCookieAllowed(url, url); |
| 1829 | 1831 |
| 1832 #if defined(ENABLE_EXTENSIONS) | |
| 1833 // Record access to file system for potential display in UI. | |
| 1834 std::vector<std::pair<int, int> >::const_iterator i; | |
| 1835 for (i = render_frames.begin(); i != render_frames.end(); ++i) { | |
|
Xi Han
2014/07/03 15:02:51
With this implementation, we will guaranty the cal
| |
| 1836 bool is_web_view_guest = | |
| 1837 WebViewRendererState::GetInstance()->IsGuest(i->first); | |
| 1838 if (is_web_view_guest) { | |
| 1839 BrowserThread::PostTask( | |
| 1840 BrowserThread::UI, | |
| 1841 FROM_HERE, | |
| 1842 base::Bind(&WebViewGuest::RequestFileSystemAccessPermission, | |
|
Fady Samuel
2014/07/08 14:42:46
RequestFileSystemPermissionFromIOThread
Xi Han
2014/07/08 21:28:24
I declare a static function in ChromeContentBrowse
| |
| 1843 i->first, | |
| 1844 i->second, | |
| 1845 url, | |
| 1846 !allow, | |
| 1847 base::Bind(&ChromeContentBrowserClient::FileSystemAccessed, | |
| 1848 weak_factory_.GetWeakPtr(), | |
| 1849 url, | |
| 1850 render_frames, | |
| 1851 callback))); | |
| 1852 break; | |
| 1853 } | |
| 1854 } | |
| 1855 #else | |
| 1856 FileSystemAccessed(url, render_frames, callback, allow); | |
| 1857 #endif | |
| 1858 | |
| 1859 } | |
| 1860 | |
| 1861 void ChromeContentBrowserClient::FileSystemAccessed( | |
| 1862 const GURL& url, | |
| 1863 const std::vector<std::pair<int, int> >& render_frames, | |
| 1864 base::Callback<void(bool)> callback, | |
| 1865 bool allow) { | |
| 1830 // Record access to file system for potential display in UI. | 1866 // Record access to file system for potential display in UI. |
| 1831 std::vector<std::pair<int, int> >::const_iterator i; | 1867 std::vector<std::pair<int, int> >::const_iterator i; |
| 1832 for (i = render_frames.begin(); i != render_frames.end(); ++i) { | 1868 for (i = render_frames.begin(); i != render_frames.end(); ++i) { |
| 1833 BrowserThread::PostTask( | 1869 BrowserThread::PostTask( |
| 1834 BrowserThread::UI, FROM_HERE, | 1870 BrowserThread::UI, |
| 1871 FROM_HERE, | |
| 1835 base::Bind(&TabSpecificContentSettings::FileSystemAccessed, | 1872 base::Bind(&TabSpecificContentSettings::FileSystemAccessed, |
| 1836 i->first, i->second, url, !allow)); | 1873 i->first, |
| 1874 i->second, | |
| 1875 url, | |
| 1876 !allow)); | |
| 1837 } | 1877 } |
| 1838 | 1878 callback.Run(allow); |
| 1839 return allow; | |
| 1840 } | 1879 } |
| 1841 | 1880 |
| 1842 bool ChromeContentBrowserClient::AllowWorkerIndexedDB( | 1881 bool ChromeContentBrowserClient::AllowWorkerIndexedDB( |
| 1843 const GURL& url, | 1882 const GURL& url, |
| 1844 const base::string16& name, | 1883 const base::string16& name, |
| 1845 content::ResourceContext* context, | 1884 content::ResourceContext* context, |
| 1846 const std::vector<std::pair<int, int> >& render_frames) { | 1885 const std::vector<std::pair<int, int> >& render_frames) { |
| 1847 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 1886 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 1848 ProfileIOData* io_data = ProfileIOData::FromResourceContext(context); | 1887 ProfileIOData* io_data = ProfileIOData::FromResourceContext(context); |
| 1849 CookieSettings* cookie_settings = io_data->GetCookieSettings(); | 1888 CookieSettings* cookie_settings = io_data->GetCookieSettings(); |
| (...skipping 950 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2800 switches::kDisableWebRtcEncryption, | 2839 switches::kDisableWebRtcEncryption, |
| 2801 }; | 2840 }; |
| 2802 to_command_line->CopySwitchesFrom(from_command_line, | 2841 to_command_line->CopySwitchesFrom(from_command_line, |
| 2803 kWebRtcDevSwitchNames, | 2842 kWebRtcDevSwitchNames, |
| 2804 arraysize(kWebRtcDevSwitchNames)); | 2843 arraysize(kWebRtcDevSwitchNames)); |
| 2805 } | 2844 } |
| 2806 } | 2845 } |
| 2807 #endif // defined(ENABLE_WEBRTC) | 2846 #endif // defined(ENABLE_WEBRTC) |
| 2808 | 2847 |
| 2809 } // namespace chrome | 2848 } // namespace chrome |
| OLD | NEW |