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 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
239 #endif | 239 #endif |
240 | 240 |
241 #if defined(TOOLKIT_VIEWS) | 241 #if defined(TOOLKIT_VIEWS) |
242 #include "chrome/browser/ui/views/chrome_browser_main_extra_parts_views.h" | 242 #include "chrome/browser/ui/views/chrome_browser_main_extra_parts_views.h" |
243 #endif | 243 #endif |
244 | 244 |
245 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) | 245 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) |
246 #include "chrome/browser/ui/views/chrome_browser_main_extra_parts_views_linux.h" | 246 #include "chrome/browser/ui/views/chrome_browser_main_extra_parts_views_linux.h" |
247 #endif | 247 #endif |
248 | 248 |
249 #if defined(USE_AURA) | |
250 #include "base/run_loop.h" | |
251 #include "content/public/common/mojo_shell_connection.h" | |
252 #include "services/shell/runner/common/client_util.h" | |
253 #include "ui/views/mus/window_manager_connection.h" | |
254 #endif | |
255 | |
249 #if defined(USE_ASH) | 256 #if defined(USE_ASH) |
250 #include "chrome/browser/ui/views/ash/chrome_browser_main_extra_parts_ash.h" | 257 #include "chrome/browser/ui/views/ash/chrome_browser_main_extra_parts_ash.h" |
251 #endif | 258 #endif |
252 | 259 |
253 #if defined(USE_X11) | 260 #if defined(USE_X11) |
254 #include "chrome/browser/chrome_browser_main_extra_parts_x11.h" | 261 #include "chrome/browser/chrome_browser_main_extra_parts_x11.h" |
255 #endif | 262 #endif |
256 | 263 |
257 #if defined(ENABLE_CAPTIVE_PORTAL_DETECTION) | 264 #if defined(ENABLE_CAPTIVE_PORTAL_DETECTION) |
258 #include "chrome/browser/captive_portal/captive_portal_tab_helper.h" | 265 #include "chrome/browser/captive_portal/captive_portal_tab_helper.h" |
(...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
760 TtsExtensionEngine* tts_extension_engine = TtsExtensionEngine::GetInstance(); | 767 TtsExtensionEngine* tts_extension_engine = TtsExtensionEngine::GetInstance(); |
761 TtsController::GetInstance()->SetTtsEngineDelegate(tts_extension_engine); | 768 TtsController::GetInstance()->SetTtsEngineDelegate(tts_extension_engine); |
762 #endif | 769 #endif |
763 | 770 |
764 #if defined(ENABLE_EXTENSIONS) | 771 #if defined(ENABLE_EXTENSIONS) |
765 extra_parts_.push_back(new ChromeContentBrowserClientExtensionsPart); | 772 extra_parts_.push_back(new ChromeContentBrowserClientExtensionsPart); |
766 #endif | 773 #endif |
767 } | 774 } |
768 | 775 |
769 ChromeContentBrowserClient::~ChromeContentBrowserClient() { | 776 ChromeContentBrowserClient::~ChromeContentBrowserClient() { |
777 // Attempting to destroy the WindowManagerConnection here results in a crash, | |
778 // since the thread is shutting down and the AtExitManager is running the tear | |
779 // down callbacks. So let it leak. | |
780 window_manager_connection_.release(); | |
770 for (int i = static_cast<int>(extra_parts_.size()) - 1; i >= 0; --i) | 781 for (int i = static_cast<int>(extra_parts_.size()) - 1; i >= 0; --i) |
771 delete extra_parts_[i]; | 782 delete extra_parts_[i]; |
772 extra_parts_.clear(); | 783 extra_parts_.clear(); |
773 } | 784 } |
774 | 785 |
775 // static | 786 // static |
776 void ChromeContentBrowserClient::RegisterProfilePrefs( | 787 void ChromeContentBrowserClient::RegisterProfilePrefs( |
777 user_prefs::PrefRegistrySyncable* registry) { | 788 user_prefs::PrefRegistrySyncable* registry) { |
778 registry->RegisterBooleanPref(prefs::kDisable3DAPIs, false); | 789 registry->RegisterBooleanPref(prefs::kDisable3DAPIs, false); |
779 registry->RegisterBooleanPref(prefs::kEnableHyperlinkAuditing, true); | 790 registry->RegisterBooleanPref(prefs::kEnableHyperlinkAuditing, true); |
(...skipping 2070 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2850 } | 2861 } |
2851 #endif // OS_CHROMEOS | 2862 #endif // OS_CHROMEOS |
2852 } | 2863 } |
2853 | 2864 |
2854 void ChromeContentBrowserClient::RegisterOutOfProcessMojoApplications( | 2865 void ChromeContentBrowserClient::RegisterOutOfProcessMojoApplications( |
2855 OutOfProcessMojoApplicationMap* apps) { | 2866 OutOfProcessMojoApplicationMap* apps) { |
2856 #if defined(ENABLE_MOJO_MEDIA_IN_UTILITY_PROCESS) | 2867 #if defined(ENABLE_MOJO_MEDIA_IN_UTILITY_PROCESS) |
2857 apps->insert(std::make_pair("mojo:media", | 2868 apps->insert(std::make_pair("mojo:media", |
2858 base::ASCIIToUTF16("Media App"))); | 2869 base::ASCIIToUTF16("Media App"))); |
2859 #endif | 2870 #endif |
2871 #if defined(USE_AURA) | |
Ben Goodger (Google)
2016/08/05 23:01:21
this seems like a really arbitrary place to do thi
jam
2016/08/05 23:07:07
I was asking Sadrul if there are ways of doing thi
sadrul
2016/08/05 23:24:39
ChromeContentBrowserClient does create ChromeBrows
| |
2872 if (shell::ShellIsRemote()) { | |
2873 content::MojoShellConnection* connection = | |
2874 content::MojoShellConnection::GetForProcess(); | |
2875 // TODO(rockot): Remove the blocking wait for init. | |
2876 // http://crbug.com/594852. | |
2877 base::RunLoop wait_loop; | |
2878 connection->SetInitializeHandler(wait_loop.QuitClosure()); | |
2879 wait_loop.Run(); | |
2880 window_manager_connection_ = views::WindowManagerConnection::Create( | |
2881 connection->GetConnector(), connection->GetIdentity()); | |
2882 } | |
2883 #endif | |
2860 } | 2884 } |
2861 | 2885 |
2862 void ChromeContentBrowserClient::OpenURL( | 2886 void ChromeContentBrowserClient::OpenURL( |
2863 content::BrowserContext* browser_context, | 2887 content::BrowserContext* browser_context, |
2864 const content::OpenURLParams& params, | 2888 const content::OpenURLParams& params, |
2865 const base::Callback<void(content::WebContents*)>& callback) { | 2889 const base::Callback<void(content::WebContents*)>& callback) { |
2866 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 2890 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
2867 | 2891 |
2868 #if BUILDFLAG(ANDROID_JAVA_UI) | 2892 #if BUILDFLAG(ANDROID_JAVA_UI) |
2869 ServiceTabLauncher::GetInstance()->LaunchTab(browser_context, params, | 2893 ServiceTabLauncher::GetInstance()->LaunchTab(browser_context, params, |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3058 if (channel <= kMaxDisableEncryptionChannel) { | 3082 if (channel <= kMaxDisableEncryptionChannel) { |
3059 static const char* const kWebRtcDevSwitchNames[] = { | 3083 static const char* const kWebRtcDevSwitchNames[] = { |
3060 switches::kDisableWebRtcEncryption, | 3084 switches::kDisableWebRtcEncryption, |
3061 }; | 3085 }; |
3062 to_command_line->CopySwitchesFrom(from_command_line, | 3086 to_command_line->CopySwitchesFrom(from_command_line, |
3063 kWebRtcDevSwitchNames, | 3087 kWebRtcDevSwitchNames, |
3064 arraysize(kWebRtcDevSwitchNames)); | 3088 arraysize(kWebRtcDevSwitchNames)); |
3065 } | 3089 } |
3066 } | 3090 } |
3067 #endif // defined(ENABLE_WEBRTC) | 3091 #endif // defined(ENABLE_WEBRTC) |
OLD | NEW |