| 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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 #include "chrome/common/descriptors_android.h" | 163 #include "chrome/common/descriptors_android.h" |
| 163 #elif defined(OS_POSIX) | 164 #elif defined(OS_POSIX) |
| 164 #include "chrome/browser/chrome_browser_main_posix.h" | 165 #include "chrome/browser/chrome_browser_main_posix.h" |
| 165 #endif | 166 #endif |
| 166 | 167 |
| 167 #if defined(OS_LINUX) || defined(OS_OPENBSD) || defined(OS_ANDROID) | 168 #if defined(OS_LINUX) || defined(OS_OPENBSD) || defined(OS_ANDROID) |
| 168 #include "base/linux_util.h" | 169 #include "base/linux_util.h" |
| 169 #include "chrome/browser/crash_handler_host_linux.h" | 170 #include "chrome/browser/crash_handler_host_linux.h" |
| 170 #endif | 171 #endif |
| 171 | 172 |
| 172 #if !defined(OS_ANDROID) | |
| 173 #include "chrome/browser/ui/blocked_content/popup_blocker_tab_helper.h" | |
| 174 #endif | |
| 175 | |
| 176 #if defined(ENABLE_CAPTIVE_PORTAL_DETECTION) | 173 #if defined(ENABLE_CAPTIVE_PORTAL_DETECTION) |
| 177 #include "chrome/browser/captive_portal/captive_portal_tab_helper.h" | 174 #include "chrome/browser/captive_portal/captive_portal_tab_helper.h" |
| 178 #endif | 175 #endif |
| 179 | 176 |
| 180 #if defined(OS_ANDROID) | 177 #if defined(OS_ANDROID) |
| 181 #include "ui/base/ui_base_paths.h" | 178 #include "ui/base/ui_base_paths.h" |
| 182 #endif | 179 #endif |
| 183 | 180 |
| 184 #if defined(USE_NSS) | 181 #if defined(USE_NSS) |
| 185 #include "chrome/browser/ui/crypto_module_password_dialog.h" | 182 #include "chrome/browser/ui/crypto_module_password_dialog.h" |
| (...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 518 effective_url = effective_url.ReplaceComponents(replacements); | 515 effective_url = effective_url.ReplaceComponents(replacements); |
| 519 return effective_url; | 516 return effective_url; |
| 520 } | 517 } |
| 521 #endif | 518 #endif |
| 522 | 519 |
| 523 void SetApplicationLocaleOnIOThread(const std::string& locale) { | 520 void SetApplicationLocaleOnIOThread(const std::string& locale) { |
| 524 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 521 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 525 g_io_thread_application_locale.Get() = locale; | 522 g_io_thread_application_locale.Get() = locale; |
| 526 } | 523 } |
| 527 | 524 |
| 528 #if !defined(OS_ANDROID) | |
| 529 struct BlockedPopupParams { | 525 struct BlockedPopupParams { |
| 530 BlockedPopupParams(const GURL& target_url, | 526 BlockedPopupParams(const GURL& target_url, |
| 531 const content::Referrer& referrer, | 527 const content::Referrer& referrer, |
| 532 WindowOpenDisposition disposition, | 528 WindowOpenDisposition disposition, |
| 533 const WebWindowFeatures& features, | 529 const WebWindowFeatures& features, |
| 534 bool user_gesture, | 530 bool user_gesture, |
| 535 bool opener_suppressed, | 531 bool opener_suppressed, |
| 536 int render_process_id, | 532 int render_process_id, |
| 537 int opener_id) | 533 int opener_id) |
| 538 : target_url(target_url), | 534 : target_url(target_url), |
| (...skipping 26 matching lines...) Expand all Loading... |
| 565 PopupBlockerTabHelper::FromWebContents(tab); | 561 PopupBlockerTabHelper::FromWebContents(tab); |
| 566 if (!popup_helper) | 562 if (!popup_helper) |
| 567 return; | 563 return; |
| 568 popup_helper->AddBlockedPopup(params.target_url, | 564 popup_helper->AddBlockedPopup(params.target_url, |
| 569 params.referrer, | 565 params.referrer, |
| 570 params.disposition, | 566 params.disposition, |
| 571 params.features, | 567 params.features, |
| 572 params.user_gesture, | 568 params.user_gesture, |
| 573 params.opener_suppressed); | 569 params.opener_suppressed); |
| 574 } | 570 } |
| 575 #endif | |
| 576 | 571 |
| 577 } // namespace | 572 } // namespace |
| 578 | 573 |
| 579 namespace chrome { | 574 namespace chrome { |
| 580 | 575 |
| 581 ChromeContentBrowserClient::ChromeContentBrowserClient() { | 576 ChromeContentBrowserClient::ChromeContentBrowserClient() { |
| 582 #if defined(ENABLE_PLUGINS) | 577 #if defined(ENABLE_PLUGINS) |
| 583 for (size_t i = 0; i < arraysize(kPredefinedAllowedSocketOrigins); ++i) | 578 for (size_t i = 0; i < arraysize(kPredefinedAllowedSocketOrigins); ++i) |
| 584 allowed_socket_origins_.insert(kPredefinedAllowedSocketOrigins[i]); | 579 allowed_socket_origins_.insert(kPredefinedAllowedSocketOrigins[i]); |
| 585 #endif | 580 #endif |
| (...skipping 1403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1989 } | 1984 } |
| 1990 | 1985 |
| 1991 if (g_browser_process->prerender_tracker() && | 1986 if (g_browser_process->prerender_tracker() && |
| 1992 g_browser_process->prerender_tracker()->TryCancelOnIOThread( | 1987 g_browser_process->prerender_tracker()->TryCancelOnIOThread( |
| 1993 render_process_id, | 1988 render_process_id, |
| 1994 opener_id, | 1989 opener_id, |
| 1995 prerender::FINAL_STATUS_CREATE_NEW_WINDOW)) { | 1990 prerender::FINAL_STATUS_CREATE_NEW_WINDOW)) { |
| 1996 return false; | 1991 return false; |
| 1997 } | 1992 } |
| 1998 | 1993 |
| 1999 #if !defined(OS_ANDROID) | |
| 2000 if (is_guest) | 1994 if (is_guest) |
| 2001 return true; | 1995 return true; |
| 2002 | 1996 |
| 2003 HostContentSettingsMap* content_settings = | 1997 HostContentSettingsMap* content_settings = |
| 2004 ProfileIOData::FromResourceContext(context)->GetHostContentSettingsMap(); | 1998 ProfileIOData::FromResourceContext(context)->GetHostContentSettingsMap(); |
| 2005 | 1999 |
| 2006 if (!user_gesture && !CommandLine::ForCurrentProcess()->HasSwitch( | 2000 if (!user_gesture && !CommandLine::ForCurrentProcess()->HasSwitch( |
| 2007 switches::kDisablePopupBlocking)) { | 2001 switches::kDisablePopupBlocking)) { |
| 2008 if (content_settings->GetContentSetting(opener_url, | 2002 if (content_settings->GetContentSetting(opener_url, |
| 2009 opener_url, | 2003 opener_url, |
| 2010 CONTENT_SETTINGS_TYPE_POPUPS, | 2004 CONTENT_SETTINGS_TYPE_POPUPS, |
| 2011 std::string()) == | 2005 std::string()) == |
| 2012 CONTENT_SETTING_ALLOW) { | 2006 CONTENT_SETTING_ALLOW) { |
| 2013 return true; | 2007 return true; |
| 2014 } | 2008 } |
| 2015 | 2009 |
| 2016 BrowserThread::PostTask(BrowserThread::UI, | 2010 BrowserThread::PostTask(BrowserThread::UI, |
| 2017 FROM_HERE, | 2011 FROM_HERE, |
| 2018 base::Bind(&HandleBlockedPopupOnUIThread, | 2012 base::Bind(&HandleBlockedPopupOnUIThread, |
| 2019 BlockedPopupParams(target_url, | 2013 BlockedPopupParams(target_url, |
| 2020 referrer, | 2014 referrer, |
| 2021 disposition, | 2015 disposition, |
| 2022 features, | 2016 features, |
| 2023 user_gesture, | 2017 user_gesture, |
| 2024 opener_suppressed, | 2018 opener_suppressed, |
| 2025 render_process_id, | 2019 render_process_id, |
| 2026 opener_id))); | 2020 opener_id))); |
| 2027 return false; | 2021 return false; |
| 2028 } | 2022 } |
| 2029 #endif | |
| 2030 | 2023 |
| 2031 return true; | 2024 return true; |
| 2032 } | 2025 } |
| 2033 | 2026 |
| 2034 std::string ChromeContentBrowserClient::GetWorkerProcessTitle( | 2027 std::string ChromeContentBrowserClient::GetWorkerProcessTitle( |
| 2035 const GURL& url, content::ResourceContext* context) { | 2028 const GURL& url, content::ResourceContext* context) { |
| 2036 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 2029 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 2037 // Check if it's an extension-created worker, in which case we want to use | 2030 // Check if it's an extension-created worker, in which case we want to use |
| 2038 // the name of the extension. | 2031 // the name of the extension. |
| 2039 ProfileIOData* io_data = ProfileIOData::FromResourceContext(context); | 2032 ProfileIOData* io_data = ProfileIOData::FromResourceContext(context); |
| (...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2530 #if defined(USE_NSS) | 2523 #if defined(USE_NSS) |
| 2531 crypto::CryptoModuleBlockingPasswordDelegate* | 2524 crypto::CryptoModuleBlockingPasswordDelegate* |
| 2532 ChromeContentBrowserClient::GetCryptoPasswordDelegate( | 2525 ChromeContentBrowserClient::GetCryptoPasswordDelegate( |
| 2533 const GURL& url) { | 2526 const GURL& url) { |
| 2534 return chrome::NewCryptoModuleBlockingDialogDelegate( | 2527 return chrome::NewCryptoModuleBlockingDialogDelegate( |
| 2535 chrome::kCryptoModulePasswordKeygen, url.host()); | 2528 chrome::kCryptoModulePasswordKeygen, url.host()); |
| 2536 } | 2529 } |
| 2537 #endif | 2530 #endif |
| 2538 | 2531 |
| 2539 } // namespace chrome | 2532 } // namespace chrome |
| OLD | NEW |