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

Side by Side Diff: chrome/browser/renderer_host/browser_render_process_host.cc

Issue 6242010: Refactor away most of ExtensionRendererInfo (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: address comments Created 9 years, 11 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
« no previous file with comments | « chrome/browser/extensions/user_script_master.cc ('k') | chrome/common/extensions/extension.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 // Represents the browser side of the browser <--> renderer communication 5 // Represents the browser side of the browser <--> renderer communication
6 // channel. There will be one RenderProcessHost per renderer process. 6 // channel. There will be one RenderProcessHost per renderer process.
7 7
8 #include "chrome/browser/renderer_host/browser_render_process_host.h" 8 #include "chrome/browser/renderer_host/browser_render_process_host.h"
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 617 matching lines...) Expand 10 before | Expand all | Expand 10 after
628 command_line->AppendSwitch(switches::kDisable3DAPIs); 628 command_line->AppendSwitch(switches::kDisable3DAPIs);
629 } 629 }
630 } 630 }
631 631
632 void BrowserRenderProcessHost::PropagateBrowserCommandLineToRenderer( 632 void BrowserRenderProcessHost::PropagateBrowserCommandLineToRenderer(
633 const CommandLine& browser_cmd, 633 const CommandLine& browser_cmd,
634 CommandLine* renderer_cmd) const { 634 CommandLine* renderer_cmd) const {
635 // Propagate the following switches to the renderer command line (along 635 // Propagate the following switches to the renderer command line (along
636 // with any associated values) if present in the browser command line. 636 // with any associated values) if present in the browser command line.
637 static const char* const kSwitchNames[] = { 637 static const char* const kSwitchNames[] = {
638 switches::kAllowOutdatedPlugins,
639 switches::kAllowScriptingGallery,
640 switches::kAppsGalleryURL,
641 // We propagate the Chrome Frame command line here as well in case the
642 // renderer is not run in the sandbox.
643 switches::kChromeFrame,
644 switches::kDebugPrint,
645 switches::kDisable3DAPIs,
646 switches::kDisableAcceleratedCompositing,
647 switches::kDisableApplicationCache,
648 switches::kDisableAudio,
649 switches::kDisableBreakpad,
650 switches::kDisableDatabases,
651 switches::kDisableDesktopNotifications,
652 switches::kDisableDeviceOrientation,
653 // We need to propagate this flag to determine whether to make the
654 // WebGLArray constructors on the DOMWindow visible. This
655 // information is needed very early during bringup. We prefer to
656 // use the WebPreferences to set this flag on a page-by-page basis.
657 switches::kDisableExperimentalWebGL,
658 switches::kDisableFileSystem,
659 switches::kDisableGeolocation,
660 switches::kDisableGLSLTranslator,
661 switches::kDisableIndexedDatabase,
662 switches::kDisableLocalStorage,
663 switches::kDisableLogging,
664 switches::kDisableSeccompSandbox,
665 switches::kDisableSessionStorage,
666 switches::kDisableSharedWorkers,
667 switches::kDisableSpeechInput,
668 switches::kDisableWebSockets,
669 switches::kDomAutomationController,
670 switches::kDumpHistogramsOnExit,
671 switches::kEnableAcceleratedDecoding,
672 switches::kEnableBenchmarking,
673 switches::kEnableClickToPlay,
674 switches::kEnableCrxlessWebApps,
675 switches::kEnableDCHECK,
676 switches::kEnableExperimentalExtensionApis,
677 switches::kEnableInBrowserThumbnailing,
678 switches::kEnableLogging,
679 switches::kEnableNaCl,
680 switches::kEnableOpenMax,
681 switches::kEnablePepperTesting,
682 switches::kEnablePrintPreview,
683 switches::kEnableRemoting,
684 switches::kEnableResourceContentSettings,
685 #if defined(OS_MACOSX)
686 // Allow this to be set when invoking the browser and relayed along.
687 switches::kEnableSandboxLogging,
688 #endif
689 switches::kEnableSearchProviderApiV2,
690 switches::kEnableSeccompSandbox,
691 switches::kEnableStatsTable,
692 switches::kEnableTouch,
693 switches::kEnableVideoFullscreen,
694 switches::kEnableVideoLogging,
695 switches::kEnableWatchdog,
696 switches::kEnableWebAudio,
697 switches::kExperimentalSpellcheckerFeatures,
698 switches::kFullMemoryCrashReport,
699 #if !defined (GOOGLE_CHROME_BUILD)
700 // These are unsupported and not fully tested modes, so don't enable them
701 // for official Google Chrome builds.
702 switches::kInProcessPlugins,
703 #endif // GOOGLE_CHROME_BUILD
704 switches::kInProcessWebGL,
705 switches::kInternalNaCl,
706 switches::kInternalPepper,
707 switches::kJavaScriptFlags,
708 switches::kLoggingLevel,
709 switches::kMemoryProfiling,
710 switches::kMessageLoopHistogrammer,
711 switches::kNewChromeUISecurityModel,
712 switches::kNoJsRandomness,
713 switches::kNoReferrers,
714 switches::kNoSandbox,
715 switches::kPlaybackMode,
716 switches::kPpapiOutOfProcess,
717 switches::kRecordMode,
718 switches::kRegisterPepperPlugins,
719 switches::kRemoteShellPort,
638 switches::kRendererAssertTest, 720 switches::kRendererAssertTest,
639 #if !defined(OFFICIAL_BUILD) 721 #if !defined(OFFICIAL_BUILD)
640 switches::kRendererCheckFalseTest, 722 switches::kRendererCheckFalseTest,
641 #endif // !defined(OFFICIAL_BUILD) 723 #endif // !defined(OFFICIAL_BUILD)
642 switches::kRendererCrashTest, 724 switches::kRendererCrashTest,
643 switches::kRendererStartupDialog, 725 switches::kRendererStartupDialog,
644 switches::kNoSandbox, 726 switches::kShowPaintRects,
727 switches::kSilentDumpOnDCHECK,
728 switches::kSimpleDataSource,
645 switches::kTestSandbox, 729 switches::kTestSandbox,
646 switches::kDisableSeccompSandbox,
647 switches::kEnableSeccompSandbox,
648 #if !defined (GOOGLE_CHROME_BUILD)
649 // These are unsupported and not fully tested modes, so don't enable them
650 // for official Google Chrome builds.
651 switches::kInProcessPlugins,
652 #endif // GOOGLE_CHROME_BUILD
653 switches::kAllowScriptingGallery,
654 switches::kDomAutomationController,
655 switches::kUserAgent,
656 switches::kNoReferrers,
657 switches::kJavaScriptFlags,
658 switches::kRecordMode,
659 switches::kPlaybackMode,
660 switches::kNoJsRandomness,
661 switches::kDisableBreakpad,
662 switches::kFullMemoryCrashReport,
663 switches::kV,
664 switches::kVModule,
665 switches::kEnableLogging,
666 switches::kDumpHistogramsOnExit,
667 switches::kDisableLogging,
668 switches::kLoggingLevel,
669 switches::kDebugPrint,
670 switches::kMemoryProfiling,
671 switches::kEnableWatchdog,
672 switches::kMessageLoopHistogrammer,
673 switches::kEnableDCHECK,
674 switches::kSilentDumpOnDCHECK,
675 switches::kUseLowFragHeapCrt,
676 switches::kEnableSearchProviderApiV2,
677 switches::kEnableStatsTable,
678 switches::kExperimentalSpellcheckerFeatures,
679 switches::kDisableAudio,
680 switches::kSimpleDataSource,
681 switches::kEnableBenchmarking,
682 switches::kEnableNaCl,
683 switches::kInternalNaCl,
684 switches::kInternalPepper,
685 switches::kRegisterPepperPlugins,
686 switches::kDisableDatabases,
687 switches::kDisableDesktopNotifications,
688 switches::kDisableWebSockets,
689 switches::kDisableLocalStorage,
690 switches::kDisableSessionStorage,
691 switches::kDisableSharedWorkers,
692 switches::kDisableApplicationCache,
693 switches::kDisableDeviceOrientation,
694 switches::kDisableIndexedDatabase,
695 switches::kDisableSpeechInput,
696 switches::kDisableGeolocation,
697 switches::kShowPaintRects,
698 switches::kEnableOpenMax,
699 switches::kVideoThreads,
700 switches::kEnableVideoFullscreen,
701 switches::kEnableVideoLogging,
702 switches::kEnableTouch,
703 // We propagate the Chrome Frame command line here as well in case the
704 // renderer is not run in the sandbox.
705 switches::kChromeFrame,
706 // We need to propagate this flag to determine whether to make the
707 // WebGLArray constructors on the DOMWindow visible. This
708 // information is needed very early during bringup. We prefer to
709 // use the WebPreferences to set this flag on a page-by-page basis.
710 switches::kDisableExperimentalWebGL,
711 switches::kDisableGLSLTranslator,
712 switches::kInProcessWebGL,
713 // This flag needs to be propagated to the renderer process for 730 // This flag needs to be propagated to the renderer process for
714 // --in-process-webgl. 731 // --in-process-webgl.
715 switches::kUseGL, 732 switches::kUseGL,
716 switches::kDisableAcceleratedCompositing, 733 switches::kUseLowFragHeapCrt,
717 #if defined(OS_MACOSX) 734 switches::kUserAgent,
718 // Allow this to be set when invoking the browser and relayed along. 735 switches::kV,
719 switches::kEnableSandboxLogging, 736 switches::kVideoThreads,
720 #endif 737 switches::kVModule,
721 switches::kRemoteShellPort,
722 switches::kEnablePepperTesting,
723 switches::kAllowOutdatedPlugins,
724 switches::kNewChromeUISecurityModel,
725 switches::kEnableRemoting,
726 switches::kEnableClickToPlay,
727 switches::kEnableResourceContentSettings,
728 switches::kEnableAcceleratedDecoding,
729 switches::kDisableFileSystem,
730 switches::kPpapiOutOfProcess,
731 switches::kEnablePrintPreview,
732 switches::kEnableCrxlessWebApps,
733 switches::kDisable3DAPIs,
734 switches::kEnableInBrowserThumbnailing,
735 switches::kEnableWebAudio,
736 }; 738 };
737 renderer_cmd->CopySwitchesFrom(browser_cmd, kSwitchNames, 739 renderer_cmd->CopySwitchesFrom(browser_cmd, kSwitchNames,
738 arraysize(kSwitchNames)); 740 arraysize(kSwitchNames));
739 741
740 // Disable databases in incognito mode. 742 // Disable databases in incognito mode.
741 if (profile()->IsOffTheRecord() && 743 if (profile()->IsOffTheRecord() &&
742 !browser_cmd.HasSwitch(switches::kDisableDatabases)) { 744 !browser_cmd.HasSwitch(switches::kDisableDatabases)) {
743 renderer_cmd->AppendSwitch(switches::kDisableDatabases); 745 renderer_cmd->AppendSwitch(switches::kDisableDatabases);
744 } 746 }
745 747
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
821 // Check if the process is still starting and we don't have a handle for it 823 // Check if the process is still starting and we don't have a handle for it
822 // yet, in which case this will happen later when InitVisitedLinks is called. 824 // yet, in which case this will happen later when InitVisitedLinks is called.
823 if (!run_renderer_in_process() && 825 if (!run_renderer_in_process() &&
824 (!child_process_.get() || child_process_->IsStarting())) { 826 (!child_process_.get() || child_process_->IsStarting())) {
825 return; 827 return;
826 } 828 }
827 829
828 ExtensionService* service = profile()->GetExtensionService(); 830 ExtensionService* service = profile()->GetExtensionService();
829 if (!service) 831 if (!service)
830 return; 832 return;
831 ViewMsg_ExtensionsUpdated_Params params; 833
832 for (size_t i = 0; i < service->extensions()->size(); ++i) { 834 for (size_t i = 0; i < service->extensions()->size(); ++i) {
833 const Extension* extension = service->extensions()->at(i); 835 Send(new ViewMsg_ExtensionLoaded(
834 ViewMsg_ExtensionRendererInfo info; 836 ViewMsg_ExtensionLoaded_Params(service->extensions()->at(i))));
835 info.id = extension->id();
836 info.web_extent = extension->web_extent();
837 info.name = extension->name();
838 info.location = extension->location();
839 info.allowed_to_execute_script_everywhere =
840 extension->CanExecuteScriptEverywhere();
841 info.host_permissions = extension->host_permissions();
842
843 // The icon in the page is 96px. We'd rather not scale up, so use 128.
844 info.icon_url = extension->GetIconURL(Extension::EXTENSION_ICON_LARGE,
845 ExtensionIconSet::MATCH_EXACTLY);
846 if (info.icon_url.is_empty())
847 info.icon_url = GURL("chrome://theme/IDR_APP_DEFAULT_ICON");
848 params.extensions.push_back(info);
849 } 837 }
850
851 Send(new ViewMsg_ExtensionsUpdated(params));
852 } 838 }
853 839
854 bool BrowserRenderProcessHost::FastShutdownIfPossible() { 840 bool BrowserRenderProcessHost::FastShutdownIfPossible() {
855 if (run_renderer_in_process()) 841 if (run_renderer_in_process())
856 return false; // Single process mode can't do fast shutdown. 842 return false; // Single process mode can't do fast shutdown.
857 843
858 if (!child_process_.get() || child_process_->IsStarting() || !GetHandle()) 844 if (!child_process_.get() || child_process_->IsStarting() || !GetHandle())
859 return false; // Render process hasn't started or is probably crashed. 845 return false; // Render process hasn't started or is probably crashed.
860 846
861 // Test if there's an unload listener. 847 // Test if there's an unload listener.
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
1119 const NotificationDetails& details) { 1105 const NotificationDetails& details) {
1120 switch (type.value) { 1106 switch (type.value) {
1121 case NotificationType::USER_SCRIPTS_UPDATED: { 1107 case NotificationType::USER_SCRIPTS_UPDATED: {
1122 base::SharedMemory* shared_memory = 1108 base::SharedMemory* shared_memory =
1123 Details<base::SharedMemory>(details).ptr(); 1109 Details<base::SharedMemory>(details).ptr();
1124 if (shared_memory) { 1110 if (shared_memory) {
1125 SendUserScriptsUpdate(shared_memory); 1111 SendUserScriptsUpdate(shared_memory);
1126 } 1112 }
1127 break; 1113 break;
1128 } 1114 }
1129 case NotificationType::EXTENSION_LOADED: 1115 case NotificationType::EXTENSION_LOADED: {
1116 Send(new ViewMsg_ExtensionLoaded(
1117 ViewMsg_ExtensionLoaded_Params(
1118 Details<const Extension>(details).ptr())));
1119 break;
1120 }
1130 case NotificationType::EXTENSION_UNLOADED: { 1121 case NotificationType::EXTENSION_UNLOADED: {
1131 SendExtensionInfo(); 1122 Send(new ViewMsg_ExtensionUnloaded(
1123 Details<UnloadedExtensionInfo>(details).ptr()->extension->id()));
1132 break; 1124 break;
1133 } 1125 }
1134 case NotificationType::SPELLCHECK_HOST_REINITIALIZED: { 1126 case NotificationType::SPELLCHECK_HOST_REINITIALIZED: {
1135 InitSpellChecker(); 1127 InitSpellChecker();
1136 break; 1128 break;
1137 } 1129 }
1138 case NotificationType::SPELLCHECK_WORD_ADDED: { 1130 case NotificationType::SPELLCHECK_WORD_ADDED: {
1139 AddSpellCheckWord( 1131 AddSpellCheckWord(
1140 reinterpret_cast<const Source<SpellCheckHost>*>(&source)-> 1132 reinterpret_cast<const Source<SpellCheckHost>*>(&source)->
1141 ptr()->last_added_word()); 1133 ptr()->last_added_word());
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
1292 IPC::PlatformFileForTransit file; 1284 IPC::PlatformFileForTransit file;
1293 #if defined(OS_POSIX) 1285 #if defined(OS_POSIX)
1294 file = base::FileDescriptor(model_file, false); 1286 file = base::FileDescriptor(model_file, false);
1295 #elif defined(OS_WIN) 1287 #elif defined(OS_WIN)
1296 ::DuplicateHandle(::GetCurrentProcess(), model_file, GetHandle(), &file, 0, 1288 ::DuplicateHandle(::GetCurrentProcess(), model_file, GetHandle(), &file, 0,
1297 false, DUPLICATE_SAME_ACCESS); 1289 false, DUPLICATE_SAME_ACCESS);
1298 #endif 1290 #endif
1299 Send(new ViewMsg_SetPhishingModel(file)); 1291 Send(new ViewMsg_SetPhishingModel(file));
1300 } 1292 }
1301 } 1293 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/user_script_master.cc ('k') | chrome/common/extensions/extension.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698