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 783 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
794 callback_.Run(); | 794 callback_.Run(); |
795 delete this; | 795 delete this; |
796 } | 796 } |
797 | 797 |
798 private: | 798 private: |
799 BrowsingDataRemover* remover_; | 799 BrowsingDataRemover* remover_; |
800 base::Closure callback_; | 800 base::Closure callback_; |
801 int count_; | 801 int count_; |
802 }; | 802 }; |
803 | 803 |
804 WebContents* GetWebContents(int render_process_id, int render_frame_id) { | |
805 RenderFrameHost* rfh = | |
806 RenderFrameHost::FromID(render_process_id, render_frame_id); | |
807 return WebContents::FromRenderFrameHost(rfh); | |
808 } | |
809 | |
810 } // namespace | 804 } // namespace |
811 | 805 |
812 ChromeContentBrowserClient::ChromeContentBrowserClient() | 806 ChromeContentBrowserClient::ChromeContentBrowserClient() |
813 : weak_factory_(this) { | 807 : weak_factory_(this) { |
814 #if defined(ENABLE_PLUGINS) | 808 #if defined(ENABLE_PLUGINS) |
815 for (size_t i = 0; i < arraysize(kPredefinedAllowedDevChannelOrigins); ++i) | 809 for (size_t i = 0; i < arraysize(kPredefinedAllowedDevChannelOrigins); ++i) |
816 allowed_dev_channel_origins_.insert(kPredefinedAllowedDevChannelOrigins[i]); | 810 allowed_dev_channel_origins_.insert(kPredefinedAllowedDevChannelOrigins[i]); |
817 for (size_t i = 0; i < arraysize(kPredefinedAllowedFileHandleOrigins); ++i) | 811 for (size_t i = 0; i < arraysize(kPredefinedAllowedFileHandleOrigins); ++i) |
818 allowed_file_handle_origins_.insert(kPredefinedAllowedFileHandleOrigins[i]); | 812 allowed_file_handle_origins_.insert(kPredefinedAllowedFileHandleOrigins[i]); |
819 for (size_t i = 0; i < arraysize(kPredefinedAllowedSocketOrigins); ++i) | 813 for (size_t i = 0; i < arraysize(kPredefinedAllowedSocketOrigins); ++i) |
(...skipping 1034 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1854 const GURL& first_party, | 1848 const GURL& first_party, |
1855 const net::CookieList& cookie_list, | 1849 const net::CookieList& cookie_list, |
1856 content::ResourceContext* context, | 1850 content::ResourceContext* context, |
1857 int render_process_id, | 1851 int render_process_id, |
1858 int render_frame_id) { | 1852 int render_frame_id) { |
1859 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 1853 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
1860 ProfileIOData* io_data = ProfileIOData::FromResourceContext(context); | 1854 ProfileIOData* io_data = ProfileIOData::FromResourceContext(context); |
1861 bool allow = io_data->GetCookieSettings()-> | 1855 bool allow = io_data->GetCookieSettings()-> |
1862 IsReadingCookieAllowed(url, first_party); | 1856 IsReadingCookieAllowed(url, first_party); |
1863 | 1857 |
1864 base::Callback<content::WebContents*(void)> wc_getter = | |
1865 base::Bind(&GetWebContents, render_process_id, render_frame_id); | |
1866 BrowserThread::PostTask( | 1858 BrowserThread::PostTask( |
1867 BrowserThread::UI, FROM_HERE, | 1859 BrowserThread::UI, FROM_HERE, |
1868 base::Bind(&TabSpecificContentSettings::CookiesRead, wc_getter, url, | 1860 base::Bind(&TabSpecificContentSettings::CookiesRead, render_process_id, |
1869 first_party, cookie_list, !allow)); | 1861 render_frame_id, url, first_party, cookie_list, !allow)); |
1870 return allow; | 1862 return allow; |
1871 } | 1863 } |
1872 | 1864 |
1873 bool ChromeContentBrowserClient::AllowSetCookie( | 1865 bool ChromeContentBrowserClient::AllowSetCookie( |
1874 const GURL& url, | 1866 const GURL& url, |
1875 const GURL& first_party, | 1867 const GURL& first_party, |
1876 const std::string& cookie_line, | 1868 const std::string& cookie_line, |
1877 content::ResourceContext* context, | 1869 content::ResourceContext* context, |
1878 int render_process_id, | 1870 int render_process_id, |
1879 int render_frame_id, | 1871 int render_frame_id, |
1880 const net::CookieOptions& options) { | 1872 const net::CookieOptions& options) { |
1881 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 1873 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
1882 ProfileIOData* io_data = ProfileIOData::FromResourceContext(context); | 1874 ProfileIOData* io_data = ProfileIOData::FromResourceContext(context); |
1883 content_settings::CookieSettings* cookie_settings = | 1875 content_settings::CookieSettings* cookie_settings = |
1884 io_data->GetCookieSettings(); | 1876 io_data->GetCookieSettings(); |
1885 bool allow = cookie_settings->IsSettingCookieAllowed(url, first_party); | 1877 bool allow = cookie_settings->IsSettingCookieAllowed(url, first_party); |
1886 | 1878 |
1887 base::Callback<content::WebContents*(void)> wc_getter = | |
1888 base::Bind(&GetWebContents, render_process_id, render_frame_id); | |
1889 BrowserThread::PostTask( | 1879 BrowserThread::PostTask( |
1890 BrowserThread::UI, FROM_HERE, | 1880 BrowserThread::UI, FROM_HERE, |
1891 base::Bind(&TabSpecificContentSettings::CookieChanged, wc_getter, url, | 1881 base::Bind(&TabSpecificContentSettings::CookieChanged, render_process_id, |
1892 first_party, cookie_line, options, !allow)); | 1882 render_frame_id, url, first_party, cookie_line, options, |
| 1883 !allow)); |
1893 return allow; | 1884 return allow; |
1894 } | 1885 } |
1895 | 1886 |
1896 bool ChromeContentBrowserClient::AllowSaveLocalState( | 1887 bool ChromeContentBrowserClient::AllowSaveLocalState( |
1897 content::ResourceContext* context) { | 1888 content::ResourceContext* context) { |
1898 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 1889 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
1899 ProfileIOData* io_data = ProfileIOData::FromResourceContext(context); | 1890 ProfileIOData* io_data = ProfileIOData::FromResourceContext(context); |
1900 content_settings::CookieSettings* cookie_settings = | 1891 content_settings::CookieSettings* cookie_settings = |
1901 io_data->GetCookieSettings(); | 1892 io_data->GetCookieSettings(); |
1902 ContentSetting setting = cookie_settings->GetDefaultCookieSetting(NULL); | 1893 ContentSetting setting = cookie_settings->GetDefaultCookieSetting(NULL); |
(...skipping 1384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3287 if (channel <= kMaxDisableEncryptionChannel) { | 3278 if (channel <= kMaxDisableEncryptionChannel) { |
3288 static const char* const kWebRtcDevSwitchNames[] = { | 3279 static const char* const kWebRtcDevSwitchNames[] = { |
3289 switches::kDisableWebRtcEncryption, | 3280 switches::kDisableWebRtcEncryption, |
3290 }; | 3281 }; |
3291 to_command_line->CopySwitchesFrom(from_command_line, | 3282 to_command_line->CopySwitchesFrom(from_command_line, |
3292 kWebRtcDevSwitchNames, | 3283 kWebRtcDevSwitchNames, |
3293 arraysize(kWebRtcDevSwitchNames)); | 3284 arraysize(kWebRtcDevSwitchNames)); |
3294 } | 3285 } |
3295 } | 3286 } |
3296 #endif // defined(ENABLE_WEBRTC) | 3287 #endif // defined(ENABLE_WEBRTC) |
OLD | NEW |