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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 #include "chrome/browser/search/instant_service_factory.h" | 74 #include "chrome/browser/search/instant_service_factory.h" |
75 #include "chrome/browser/search/search.h" | 75 #include "chrome/browser/search/search.h" |
76 #include "chrome/browser/search_engines/search_provider_install_state_message_fi
lter.h" | 76 #include "chrome/browser/search_engines/search_provider_install_state_message_fi
lter.h" |
77 #include "chrome/browser/speech/chrome_speech_recognition_manager_delegate.h" | 77 #include "chrome/browser/speech/chrome_speech_recognition_manager_delegate.h" |
78 #include "chrome/browser/speech/tts_message_filter.h" | 78 #include "chrome/browser/speech/tts_message_filter.h" |
79 #include "chrome/browser/ssl/ssl_add_certificate.h" | 79 #include "chrome/browser/ssl/ssl_add_certificate.h" |
80 #include "chrome/browser/ssl/ssl_blocking_page.h" | 80 #include "chrome/browser/ssl/ssl_blocking_page.h" |
81 #include "chrome/browser/ssl/ssl_tab_helper.h" | 81 #include "chrome/browser/ssl/ssl_tab_helper.h" |
82 #include "chrome/browser/sync_file_system/local/sync_file_system_backend.h" | 82 #include "chrome/browser/sync_file_system/local/sync_file_system_backend.h" |
83 #include "chrome/browser/tab_contents/tab_util.h" | 83 #include "chrome/browser/tab_contents/tab_util.h" |
| 84 #include "chrome/browser/ui/blocked_content/popup_blocker_tab_helper.h" |
84 #include "chrome/browser/ui/chrome_select_file_policy.h" | 85 #include "chrome/browser/ui/chrome_select_file_policy.h" |
85 #include "chrome/browser/ui/sync/sync_promo_ui.h" | 86 #include "chrome/browser/ui/sync/sync_promo_ui.h" |
86 #include "chrome/browser/ui/tab_contents/chrome_web_contents_view_delegate.h" | 87 #include "chrome/browser/ui/tab_contents/chrome_web_contents_view_delegate.h" |
87 #include "chrome/browser/ui/webui/chrome_web_ui_controller_factory.h" | 88 #include "chrome/browser/ui/webui/chrome_web_ui_controller_factory.h" |
88 #include "chrome/browser/user_style_sheet_watcher.h" | 89 #include "chrome/browser/user_style_sheet_watcher.h" |
89 #include "chrome/browser/user_style_sheet_watcher_factory.h" | 90 #include "chrome/browser/user_style_sheet_watcher_factory.h" |
90 #include "chrome/browser/validation_message_message_filter.h" | 91 #include "chrome/browser/validation_message_message_filter.h" |
91 #include "chrome/common/child_process_logging.h" | 92 #include "chrome/common/child_process_logging.h" |
92 #include "chrome/common/chrome_constants.h" | 93 #include "chrome/common/chrome_constants.h" |
93 #include "chrome/common/chrome_paths.h" | 94 #include "chrome/common/chrome_paths.h" |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 #include "chrome/common/descriptors_android.h" | 164 #include "chrome/common/descriptors_android.h" |
164 #elif defined(OS_POSIX) | 165 #elif defined(OS_POSIX) |
165 #include "chrome/browser/chrome_browser_main_posix.h" | 166 #include "chrome/browser/chrome_browser_main_posix.h" |
166 #endif | 167 #endif |
167 | 168 |
168 #if defined(OS_LINUX) || defined(OS_OPENBSD) || defined(OS_ANDROID) | 169 #if defined(OS_LINUX) || defined(OS_OPENBSD) || defined(OS_ANDROID) |
169 #include "base/linux_util.h" | 170 #include "base/linux_util.h" |
170 #include "chrome/browser/crash_handler_host_linux.h" | 171 #include "chrome/browser/crash_handler_host_linux.h" |
171 #endif | 172 #endif |
172 | 173 |
173 #if !defined(OS_ANDROID) | |
174 #include "chrome/browser/ui/blocked_content/popup_blocker_tab_helper.h" | |
175 #endif | |
176 | |
177 #if defined(ENABLE_CAPTIVE_PORTAL_DETECTION) | 174 #if defined(ENABLE_CAPTIVE_PORTAL_DETECTION) |
178 #include "chrome/browser/captive_portal/captive_portal_tab_helper.h" | 175 #include "chrome/browser/captive_portal/captive_portal_tab_helper.h" |
179 #endif | 176 #endif |
180 | 177 |
181 #if defined(OS_ANDROID) | 178 #if defined(OS_ANDROID) |
182 #include "ui/base/ui_base_paths.h" | 179 #include "ui/base/ui_base_paths.h" |
183 #endif | 180 #endif |
184 | 181 |
185 #if defined(USE_NSS) | 182 #if defined(USE_NSS) |
186 #include "chrome/browser/ui/crypto_module_password_dialog.h" | 183 #include "chrome/browser/ui/crypto_module_password_dialog.h" |
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
519 effective_url = effective_url.ReplaceComponents(replacements); | 516 effective_url = effective_url.ReplaceComponents(replacements); |
520 return effective_url; | 517 return effective_url; |
521 } | 518 } |
522 #endif | 519 #endif |
523 | 520 |
524 void SetApplicationLocaleOnIOThread(const std::string& locale) { | 521 void SetApplicationLocaleOnIOThread(const std::string& locale) { |
525 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 522 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
526 g_io_thread_application_locale.Get() = locale; | 523 g_io_thread_application_locale.Get() = locale; |
527 } | 524 } |
528 | 525 |
529 #if !defined(OS_ANDROID) | |
530 struct BlockedPopupParams { | 526 struct BlockedPopupParams { |
531 BlockedPopupParams(const GURL& target_url, | 527 BlockedPopupParams(const GURL& target_url, |
532 const content::Referrer& referrer, | 528 const content::Referrer& referrer, |
533 WindowOpenDisposition disposition, | 529 WindowOpenDisposition disposition, |
534 const WebWindowFeatures& features, | 530 const WebWindowFeatures& features, |
535 bool user_gesture, | 531 bool user_gesture, |
536 bool opener_suppressed, | 532 bool opener_suppressed, |
537 int render_process_id, | 533 int render_process_id, |
538 int opener_id) | 534 int opener_id) |
539 : target_url(target_url), | 535 : target_url(target_url), |
(...skipping 26 matching lines...) Expand all Loading... |
566 PopupBlockerTabHelper::FromWebContents(tab); | 562 PopupBlockerTabHelper::FromWebContents(tab); |
567 if (!popup_helper) | 563 if (!popup_helper) |
568 return; | 564 return; |
569 popup_helper->AddBlockedPopup(params.target_url, | 565 popup_helper->AddBlockedPopup(params.target_url, |
570 params.referrer, | 566 params.referrer, |
571 params.disposition, | 567 params.disposition, |
572 params.features, | 568 params.features, |
573 params.user_gesture, | 569 params.user_gesture, |
574 params.opener_suppressed); | 570 params.opener_suppressed); |
575 } | 571 } |
576 #endif | |
577 | 572 |
578 } // namespace | 573 } // namespace |
579 | 574 |
580 namespace chrome { | 575 namespace chrome { |
581 | 576 |
582 ChromeContentBrowserClient::ChromeContentBrowserClient() { | 577 ChromeContentBrowserClient::ChromeContentBrowserClient() { |
583 #if defined(ENABLE_PLUGINS) | 578 #if defined(ENABLE_PLUGINS) |
584 for (size_t i = 0; i < arraysize(kPredefinedAllowedSocketOrigins); ++i) | 579 for (size_t i = 0; i < arraysize(kPredefinedAllowedSocketOrigins); ++i) |
585 allowed_socket_origins_.insert(kPredefinedAllowedSocketOrigins[i]); | 580 allowed_socket_origins_.insert(kPredefinedAllowedSocketOrigins[i]); |
586 #endif | 581 #endif |
(...skipping 1408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1995 } | 1990 } |
1996 | 1991 |
1997 if (g_browser_process->prerender_tracker() && | 1992 if (g_browser_process->prerender_tracker() && |
1998 g_browser_process->prerender_tracker()->TryCancelOnIOThread( | 1993 g_browser_process->prerender_tracker()->TryCancelOnIOThread( |
1999 render_process_id, | 1994 render_process_id, |
2000 opener_id, | 1995 opener_id, |
2001 prerender::FINAL_STATUS_CREATE_NEW_WINDOW)) { | 1996 prerender::FINAL_STATUS_CREATE_NEW_WINDOW)) { |
2002 return false; | 1997 return false; |
2003 } | 1998 } |
2004 | 1999 |
2005 #if !defined(OS_ANDROID) | |
2006 if (is_guest) | 2000 if (is_guest) |
2007 return true; | 2001 return true; |
2008 | 2002 |
2009 HostContentSettingsMap* content_settings = | 2003 HostContentSettingsMap* content_settings = |
2010 ProfileIOData::FromResourceContext(context)->GetHostContentSettingsMap(); | 2004 ProfileIOData::FromResourceContext(context)->GetHostContentSettingsMap(); |
2011 | 2005 |
2012 if (!user_gesture && !CommandLine::ForCurrentProcess()->HasSwitch( | 2006 if (!user_gesture && !CommandLine::ForCurrentProcess()->HasSwitch( |
2013 switches::kDisablePopupBlocking)) { | 2007 switches::kDisablePopupBlocking)) { |
2014 if (content_settings->GetContentSetting(opener_url, | 2008 if (content_settings->GetContentSetting(opener_url, |
2015 opener_url, | 2009 opener_url, |
2016 CONTENT_SETTINGS_TYPE_POPUPS, | 2010 CONTENT_SETTINGS_TYPE_POPUPS, |
2017 std::string()) == | 2011 std::string()) == |
2018 CONTENT_SETTING_ALLOW) { | 2012 CONTENT_SETTING_ALLOW) { |
2019 return true; | 2013 return true; |
2020 } | 2014 } |
2021 | 2015 |
2022 BrowserThread::PostTask(BrowserThread::UI, | 2016 BrowserThread::PostTask(BrowserThread::UI, |
2023 FROM_HERE, | 2017 FROM_HERE, |
2024 base::Bind(&HandleBlockedPopupOnUIThread, | 2018 base::Bind(&HandleBlockedPopupOnUIThread, |
2025 BlockedPopupParams(target_url, | 2019 BlockedPopupParams(target_url, |
2026 referrer, | 2020 referrer, |
2027 disposition, | 2021 disposition, |
2028 features, | 2022 features, |
2029 user_gesture, | 2023 user_gesture, |
2030 opener_suppressed, | 2024 opener_suppressed, |
2031 render_process_id, | 2025 render_process_id, |
2032 opener_id))); | 2026 opener_id))); |
2033 return false; | 2027 return false; |
2034 } | 2028 } |
2035 #endif | |
2036 | 2029 |
2037 return true; | 2030 return true; |
2038 } | 2031 } |
2039 | 2032 |
2040 std::string ChromeContentBrowserClient::GetWorkerProcessTitle( | 2033 std::string ChromeContentBrowserClient::GetWorkerProcessTitle( |
2041 const GURL& url, content::ResourceContext* context) { | 2034 const GURL& url, content::ResourceContext* context) { |
2042 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 2035 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
2043 // Check if it's an extension-created worker, in which case we want to use | 2036 // Check if it's an extension-created worker, in which case we want to use |
2044 // the name of the extension. | 2037 // the name of the extension. |
2045 ProfileIOData* io_data = ProfileIOData::FromResourceContext(context); | 2038 ProfileIOData* io_data = ProfileIOData::FromResourceContext(context); |
(...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2539 #if defined(USE_NSS) | 2532 #if defined(USE_NSS) |
2540 crypto::CryptoModuleBlockingPasswordDelegate* | 2533 crypto::CryptoModuleBlockingPasswordDelegate* |
2541 ChromeContentBrowserClient::GetCryptoPasswordDelegate( | 2534 ChromeContentBrowserClient::GetCryptoPasswordDelegate( |
2542 const GURL& url) { | 2535 const GURL& url) { |
2543 return chrome::NewCryptoModuleBlockingDialogDelegate( | 2536 return chrome::NewCryptoModuleBlockingDialogDelegate( |
2544 chrome::kCryptoModulePasswordKeygen, url.host()); | 2537 chrome::kCryptoModulePasswordKeygen, url.host()); |
2545 } | 2538 } |
2546 #endif | 2539 #endif |
2547 | 2540 |
2548 } // namespace chrome | 2541 } // namespace chrome |
OLD | NEW |