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 <map> | 7 #include <map> |
8 #include <set> | 8 #include <set> |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
(...skipping 760 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
771 callback_.Run(); | 771 callback_.Run(); |
772 delete this; | 772 delete this; |
773 } | 773 } |
774 | 774 |
775 private: | 775 private: |
776 BrowsingDataRemover* remover_; | 776 BrowsingDataRemover* remover_; |
777 base::Closure callback_; | 777 base::Closure callback_; |
778 int count_; | 778 int count_; |
779 }; | 779 }; |
780 | 780 |
| 781 WebContents* GetWebContents(int render_process_id, int render_frame_id) { |
| 782 RenderFrameHost* rfh = |
| 783 RenderFrameHost::FromID(render_process_id, render_frame_id); |
| 784 return WebContents::FromRenderFrameHost(rfh); |
| 785 } |
| 786 |
781 } // namespace | 787 } // namespace |
782 | 788 |
783 ChromeContentBrowserClient::ChromeContentBrowserClient() | 789 ChromeContentBrowserClient::ChromeContentBrowserClient() |
784 : weak_factory_(this) { | 790 : weak_factory_(this) { |
785 #if defined(ENABLE_PLUGINS) | 791 #if defined(ENABLE_PLUGINS) |
786 for (size_t i = 0; i < arraysize(kPredefinedAllowedDevChannelOrigins); ++i) | 792 for (size_t i = 0; i < arraysize(kPredefinedAllowedDevChannelOrigins); ++i) |
787 allowed_dev_channel_origins_.insert(kPredefinedAllowedDevChannelOrigins[i]); | 793 allowed_dev_channel_origins_.insert(kPredefinedAllowedDevChannelOrigins[i]); |
788 for (size_t i = 0; i < arraysize(kPredefinedAllowedFileHandleOrigins); ++i) | 794 for (size_t i = 0; i < arraysize(kPredefinedAllowedFileHandleOrigins); ++i) |
789 allowed_file_handle_origins_.insert(kPredefinedAllowedFileHandleOrigins[i]); | 795 allowed_file_handle_origins_.insert(kPredefinedAllowedFileHandleOrigins[i]); |
790 for (size_t i = 0; i < arraysize(kPredefinedAllowedSocketOrigins); ++i) | 796 for (size_t i = 0; i < arraysize(kPredefinedAllowedSocketOrigins); ++i) |
(...skipping 1012 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1803 const GURL& first_party, | 1809 const GURL& first_party, |
1804 const net::CookieList& cookie_list, | 1810 const net::CookieList& cookie_list, |
1805 content::ResourceContext* context, | 1811 content::ResourceContext* context, |
1806 int render_process_id, | 1812 int render_process_id, |
1807 int render_frame_id) { | 1813 int render_frame_id) { |
1808 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 1814 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
1809 ProfileIOData* io_data = ProfileIOData::FromResourceContext(context); | 1815 ProfileIOData* io_data = ProfileIOData::FromResourceContext(context); |
1810 bool allow = io_data->GetCookieSettings()-> | 1816 bool allow = io_data->GetCookieSettings()-> |
1811 IsReadingCookieAllowed(url, first_party); | 1817 IsReadingCookieAllowed(url, first_party); |
1812 | 1818 |
| 1819 base::Callback<content::WebContents*(void)> wc_getter = |
| 1820 base::Bind(&GetWebContents, render_process_id, render_frame_id); |
1813 BrowserThread::PostTask( | 1821 BrowserThread::PostTask( |
1814 BrowserThread::UI, FROM_HERE, | 1822 BrowserThread::UI, FROM_HERE, |
1815 base::Bind(&TabSpecificContentSettings::CookiesRead, render_process_id, | 1823 base::Bind(&TabSpecificContentSettings::CookiesRead, wc_getter, url, |
1816 render_frame_id, url, first_party, cookie_list, !allow)); | 1824 first_party, cookie_list, !allow)); |
1817 return allow; | 1825 return allow; |
1818 } | 1826 } |
1819 | 1827 |
1820 bool ChromeContentBrowserClient::AllowSetCookie( | 1828 bool ChromeContentBrowserClient::AllowSetCookie( |
1821 const GURL& url, | 1829 const GURL& url, |
1822 const GURL& first_party, | 1830 const GURL& first_party, |
1823 const std::string& cookie_line, | 1831 const std::string& cookie_line, |
1824 content::ResourceContext* context, | 1832 content::ResourceContext* context, |
1825 int render_process_id, | 1833 int render_process_id, |
1826 int render_frame_id, | 1834 int render_frame_id, |
1827 const net::CookieOptions& options) { | 1835 const net::CookieOptions& options) { |
1828 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 1836 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
1829 ProfileIOData* io_data = ProfileIOData::FromResourceContext(context); | 1837 ProfileIOData* io_data = ProfileIOData::FromResourceContext(context); |
1830 content_settings::CookieSettings* cookie_settings = | 1838 content_settings::CookieSettings* cookie_settings = |
1831 io_data->GetCookieSettings(); | 1839 io_data->GetCookieSettings(); |
1832 bool allow = cookie_settings->IsSettingCookieAllowed(url, first_party); | 1840 bool allow = cookie_settings->IsSettingCookieAllowed(url, first_party); |
1833 | 1841 |
| 1842 base::Callback<content::WebContents*(void)> wc_getter = |
| 1843 base::Bind(&GetWebContents, render_process_id, render_frame_id); |
1834 BrowserThread::PostTask( | 1844 BrowserThread::PostTask( |
1835 BrowserThread::UI, FROM_HERE, | 1845 BrowserThread::UI, FROM_HERE, |
1836 base::Bind(&TabSpecificContentSettings::CookieChanged, render_process_id, | 1846 base::Bind(&TabSpecificContentSettings::CookieChanged, wc_getter, url, |
1837 render_frame_id, url, first_party, cookie_line, options, | 1847 first_party, cookie_line, options, !allow)); |
1838 !allow)); | |
1839 return allow; | 1848 return allow; |
1840 } | 1849 } |
1841 | 1850 |
1842 bool ChromeContentBrowserClient::AllowSaveLocalState( | 1851 bool ChromeContentBrowserClient::AllowSaveLocalState( |
1843 content::ResourceContext* context) { | 1852 content::ResourceContext* context) { |
1844 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 1853 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
1845 ProfileIOData* io_data = ProfileIOData::FromResourceContext(context); | 1854 ProfileIOData* io_data = ProfileIOData::FromResourceContext(context); |
1846 content_settings::CookieSettings* cookie_settings = | 1855 content_settings::CookieSettings* cookie_settings = |
1847 io_data->GetCookieSettings(); | 1856 io_data->GetCookieSettings(); |
1848 ContentSetting setting = cookie_settings->GetDefaultCookieSetting(NULL); | 1857 ContentSetting setting = cookie_settings->GetDefaultCookieSetting(NULL); |
(...skipping 1364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3213 if (channel <= kMaxDisableEncryptionChannel) { | 3222 if (channel <= kMaxDisableEncryptionChannel) { |
3214 static const char* const kWebRtcDevSwitchNames[] = { | 3223 static const char* const kWebRtcDevSwitchNames[] = { |
3215 switches::kDisableWebRtcEncryption, | 3224 switches::kDisableWebRtcEncryption, |
3216 }; | 3225 }; |
3217 to_command_line->CopySwitchesFrom(from_command_line, | 3226 to_command_line->CopySwitchesFrom(from_command_line, |
3218 kWebRtcDevSwitchNames, | 3227 kWebRtcDevSwitchNames, |
3219 arraysize(kWebRtcDevSwitchNames)); | 3228 arraysize(kWebRtcDevSwitchNames)); |
3220 } | 3229 } |
3221 } | 3230 } |
3222 #endif // defined(ENABLE_WEBRTC) | 3231 #endif // defined(ENABLE_WEBRTC) |
OLD | NEW |