Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(225)

Side by Side Diff: chrome/browser/chrome_content_browser_client.cc

Issue 8113035: Remove RenderProcessHost::is_extension_process (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: updates Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "base/command_line.h" 7 #include "base/command_line.h"
8 #include "chrome/app/breakpad_mac.h" 8 #include "chrome/app/breakpad_mac.h"
9 #include "chrome/browser/browser_about_handler.h" 9 #include "chrome/browser/browser_about_handler.h"
10 #include "chrome/browser/browser_process.h" 10 #include "chrome/browser/browser_process.h"
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 Profile* profile = 259 Profile* profile =
260 Profile::FromBrowserContext(process_host->browser_context()); 260 Profile::FromBrowserContext(process_host->browser_context());
261 ExtensionProcessManager* extension_process_manager = 261 ExtensionProcessManager* extension_process_manager =
262 profile->GetExtensionProcessManager(); 262 profile->GetExtensionProcessManager();
263 263
264 // Maybe NULL during tests. 264 // Maybe NULL during tests.
265 if (!extension_process_manager) 265 if (!extension_process_manager)
266 return true; 266 return true;
267 267
268 bool is_extension_host = 268 bool is_extension_host =
269 process_host->is_extension_process() || 269 extension_process_manager->IsExtensionProcess(process_host->id());
270 extension_process_manager->AreBindingsEnabledForProcess(
271 process_host->id());
272 return site_url.SchemeIs(chrome::kExtensionScheme) == is_extension_host; 270 return site_url.SchemeIs(chrome::kExtensionScheme) == is_extension_host;
273 } 271 }
274 272
275 std::string ChromeContentBrowserClient::GetCanonicalEncodingNameByAliasName( 273 std::string ChromeContentBrowserClient::GetCanonicalEncodingNameByAliasName(
276 const std::string& alias_name) { 274 const std::string& alias_name) {
277 return CharacterEncoding::GetCanonicalEncodingNameByAliasName(alias_name); 275 return CharacterEncoding::GetCanonicalEncodingNameByAliasName(alias_name);
278 } 276 }
279 277
280 void ChromeContentBrowserClient::AppendExtraCommandLineSwitches( 278 void ChromeContentBrowserClient::AppendExtraCommandLineSwitches(
281 CommandLine* command_line, int child_process_id) { 279 CommandLine* command_line, int child_process_id) {
282 #if defined(USE_LINUX_BREAKPAD) 280 #if defined(USE_LINUX_BREAKPAD)
283 if (IsCrashReporterEnabled()) { 281 if (IsCrashReporterEnabled()) {
284 command_line->AppendSwitchASCII(switches::kEnableCrashReporter, 282 command_line->AppendSwitchASCII(switches::kEnableCrashReporter,
285 child_process_logging::GetClientId() + "," + base::GetLinuxDistro()); 283 child_process_logging::GetClientId() + "," + base::GetLinuxDistro());
286 } 284 }
287 #elif defined(OS_MACOSX) 285 #elif defined(OS_MACOSX)
288 if (IsCrashReporterEnabled()) { 286 if (IsCrashReporterEnabled()) {
289 command_line->AppendSwitchASCII(switches::kEnableCrashReporter, 287 command_line->AppendSwitchASCII(switches::kEnableCrashReporter,
290 child_process_logging::GetClientId()); 288 child_process_logging::GetClientId());
291 } 289 }
292 #endif // OS_MACOSX 290 #endif // OS_MACOSX
293 291
294 if (logging::DialogsAreSuppressed()) 292 if (logging::DialogsAreSuppressed())
295 command_line->AppendSwitch(switches::kNoErrorDialogs); 293 command_line->AppendSwitch(switches::kNoErrorDialogs);
296 294
297 std::string process_type = 295 std::string process_type =
298 command_line->GetSwitchValueASCII(switches::kProcessType); 296 command_line->GetSwitchValueASCII(switches::kProcessType);
299 const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess(); 297 const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess();
300 if (process_type == switches::kExtensionProcess || 298 if (process_type == switches::kRendererProcess) {
301 process_type == switches::kRendererProcess) {
302 FilePath user_data_dir = 299 FilePath user_data_dir =
303 browser_command_line.GetSwitchValuePath(switches::kUserDataDir); 300 browser_command_line.GetSwitchValuePath(switches::kUserDataDir);
304 if (!user_data_dir.empty()) 301 if (!user_data_dir.empty())
305 command_line->AppendSwitchPath(switches::kUserDataDir, user_data_dir); 302 command_line->AppendSwitchPath(switches::kUserDataDir, user_data_dir);
306 #if defined(OS_CHROMEOS) 303 #if defined(OS_CHROMEOS)
307 const std::string& login_profile = 304 const std::string& login_profile =
308 browser_command_line.GetSwitchValueASCII(switches::kLoginProfile); 305 browser_command_line.GetSwitchValueASCII(switches::kLoginProfile);
309 if (!login_profile.empty()) 306 if (!login_profile.empty())
310 command_line->AppendSwitchASCII(switches::kLoginProfile, login_profile); 307 command_line->AppendSwitchASCII(switches::kLoginProfile, login_profile);
311 #endif 308 #endif
312 309
313 RenderProcessHost* process = RenderProcessHost::FromID(child_process_id); 310 RenderProcessHost* process = RenderProcessHost::FromID(child_process_id);
314 311
315 Profile* profile = Profile::FromBrowserContext(process->browser_context()); 312 Profile* profile = Profile::FromBrowserContext(process->browser_context());
313
314 ExtensionProcessManager* extension_process_manager =
315 profile->GetExtensionProcessManager();
316 if (extension_process_manager->IsExtensionProcess(
317 process->id())) {
318 command_line->AppendSwitch(switches::kExtensionProcess);
319 }
320
316 PrefService* prefs = profile->GetPrefs(); 321 PrefService* prefs = profile->GetPrefs();
317 // Currently this pref is only registered if applied via a policy. 322 // Currently this pref is only registered if applied via a policy.
318 if (prefs->HasPrefPath(prefs::kDisable3DAPIs) && 323 if (prefs->HasPrefPath(prefs::kDisable3DAPIs) &&
319 prefs->GetBoolean(prefs::kDisable3DAPIs)) { 324 prefs->GetBoolean(prefs::kDisable3DAPIs)) {
320 // Turn this policy into a command line switch. 325 // Turn this policy into a command line switch.
321 command_line->AppendSwitch(switches::kDisable3DAPIs); 326 command_line->AppendSwitch(switches::kDisable3DAPIs);
322 } 327 }
323 328
324 // Disable client-side phishing detection in the renderer if it is disabled 329 // Disable client-side phishing detection in the renderer if it is disabled
325 // in the Profile preferences or the browser process. 330 // in the Profile preferences or the browser process.
(...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after
788 remover->Remove(remove_mask); 793 remover->Remove(remove_mask);
789 // BrowsingDataRemover takes care of deleting itself when done. 794 // BrowsingDataRemover takes care of deleting itself when done.
790 } 795 }
791 796
792 FilePath ChromeContentBrowserClient::GetDefaultDownloadDirectory() { 797 FilePath ChromeContentBrowserClient::GetDefaultDownloadDirectory() {
793 return download_util::GetDefaultDownloadDirectory(); 798 return download_util::GetDefaultDownloadDirectory();
794 } 799 }
795 800
796 #if defined(OS_LINUX) 801 #if defined(OS_LINUX)
797 int ChromeContentBrowserClient::GetCrashSignalFD( 802 int ChromeContentBrowserClient::GetCrashSignalFD(
798 const std::string& process_type) { 803 const CommandLine& command_line) {
799 if (process_type == switches::kRendererProcess) 804 if (command_line.HasSwitch(switches::kExtensionProcess)) {
800 return RendererCrashHandlerHostLinux::GetInstance()->GetDeathSignalSocket();
801
802 if (process_type == switches::kExtensionProcess) {
803 ExtensionCrashHandlerHostLinux* crash_handler = 805 ExtensionCrashHandlerHostLinux* crash_handler =
804 ExtensionCrashHandlerHostLinux::GetInstance(); 806 ExtensionCrashHandlerHostLinux::GetInstance();
805 return crash_handler->GetDeathSignalSocket(); 807 return crash_handler->GetDeathSignalSocket();
806 } 808 }
807 809
810 std::string process_type =
811 command_line.GetSwitchValueASCII(switches::kProcessType);
812
813 if (process_type == switches::kRendererProcess)
814 return RendererCrashHandlerHostLinux::GetInstance()->GetDeathSignalSocket();
815
808 if (process_type == switches::kPluginProcess) 816 if (process_type == switches::kPluginProcess)
809 return PluginCrashHandlerHostLinux::GetInstance()->GetDeathSignalSocket(); 817 return PluginCrashHandlerHostLinux::GetInstance()->GetDeathSignalSocket();
810 818
811 if (process_type == switches::kPpapiPluginProcess) 819 if (process_type == switches::kPpapiPluginProcess)
812 return PpapiCrashHandlerHostLinux::GetInstance()->GetDeathSignalSocket(); 820 return PpapiCrashHandlerHostLinux::GetInstance()->GetDeathSignalSocket();
813 821
814 if (process_type == switches::kGpuProcess) 822 if (process_type == switches::kGpuProcess)
815 return GpuCrashHandlerHostLinux::GetInstance()->GetDeathSignalSocket(); 823 return GpuCrashHandlerHostLinux::GetInstance()->GetDeathSignalSocket();
816 824
817 return -1; 825 return -1;
818 } 826 }
819 #endif // defined(OS_LINUX) 827 #endif // defined(OS_LINUX)
820 828
821 #if defined(OS_WIN) 829 #if defined(OS_WIN)
822 const wchar_t* ChromeContentBrowserClient::GetResourceDllName() { 830 const wchar_t* ChromeContentBrowserClient::GetResourceDllName() {
823 return chrome::kBrowserResourcesDll; 831 return chrome::kBrowserResourcesDll;
824 } 832 }
825 #endif 833 #endif
826 834
827 #if defined(USE_NSS) 835 #if defined(USE_NSS)
828 crypto::CryptoModuleBlockingPasswordDelegate* 836 crypto::CryptoModuleBlockingPasswordDelegate*
829 ChromeContentBrowserClient::GetCryptoPasswordDelegate( 837 ChromeContentBrowserClient::GetCryptoPasswordDelegate(
830 const GURL& url) { 838 const GURL& url) {
831 return browser::NewCryptoModuleBlockingDialogDelegate( 839 return browser::NewCryptoModuleBlockingDialogDelegate(
832 browser::kCryptoModulePasswordKeygen, url.host()); 840 browser::kCryptoModulePasswordKeygen, url.host());
833 } 841 }
834 #endif 842 #endif
835 843
836 } // namespace chrome 844 } // namespace chrome
OLDNEW
« no previous file with comments | « chrome/browser/chrome_content_browser_client.h ('k') | chrome/browser/extensions/app_process_apitest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698