OLD | NEW |
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 809 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
820 // Check if the process is still starting and we don't have a handle for it | 820 // Check if the process is still starting and we don't have a handle for it |
821 // yet, in which case this will happen later when InitVisitedLinks is called. | 821 // yet, in which case this will happen later when InitVisitedLinks is called. |
822 if (!run_renderer_in_process() && | 822 if (!run_renderer_in_process() && |
823 (!child_process_.get() || child_process_->IsStarting())) { | 823 (!child_process_.get() || child_process_->IsStarting())) { |
824 return; | 824 return; |
825 } | 825 } |
826 | 826 |
827 ExtensionService* service = profile()->GetExtensionService(); | 827 ExtensionService* service = profile()->GetExtensionService(); |
828 if (!service) | 828 if (!service) |
829 return; | 829 return; |
830 ViewMsg_ExtensionsUpdated_Params params; | |
831 for (size_t i = 0; i < service->extensions()->size(); ++i) { | 830 for (size_t i = 0; i < service->extensions()->size(); ++i) { |
832 const Extension* extension = service->extensions()->at(i); | 831 Send(new ViewMsg_ExtensionLoaded( |
833 ViewMsg_ExtensionRendererInfo info; | 832 ViewMsg_ExtensionLoaded_Params(service->extensions()->at(i)))); |
834 info.id = extension->id(); | |
835 info.web_extent = extension->web_extent(); | |
836 info.name = extension->name(); | |
837 info.location = extension->location(); | |
838 info.allowed_to_execute_script_everywhere = | |
839 extension->CanExecuteScriptEverywhere(); | |
840 info.host_permissions = extension->host_permissions(); | |
841 | |
842 // The icon in the page is 96px. We'd rather not scale up, so use 128. | |
843 info.icon_url = extension->GetIconURL(Extension::EXTENSION_ICON_LARGE, | |
844 ExtensionIconSet::MATCH_EXACTLY); | |
845 if (info.icon_url.is_empty()) | |
846 info.icon_url = GURL("chrome://theme/IDR_APP_DEFAULT_ICON"); | |
847 params.extensions.push_back(info); | |
848 } | 833 } |
849 | |
850 Send(new ViewMsg_ExtensionsUpdated(params)); | |
851 } | 834 } |
852 | 835 |
853 bool BrowserRenderProcessHost::FastShutdownIfPossible() { | 836 bool BrowserRenderProcessHost::FastShutdownIfPossible() { |
854 if (run_renderer_in_process()) | 837 if (run_renderer_in_process()) |
855 return false; // Single process mode can't do fast shutdown. | 838 return false; // Single process mode can't do fast shutdown. |
856 | 839 |
857 if (!child_process_.get() || child_process_->IsStarting() || !GetHandle()) | 840 if (!child_process_.get() || child_process_->IsStarting() || !GetHandle()) |
858 return false; // Render process hasn't started or is probably crashed. | 841 return false; // Render process hasn't started or is probably crashed. |
859 | 842 |
860 // Test if there's an unload listener. | 843 // Test if there's an unload listener. |
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1118 const NotificationDetails& details) { | 1101 const NotificationDetails& details) { |
1119 switch (type.value) { | 1102 switch (type.value) { |
1120 case NotificationType::USER_SCRIPTS_UPDATED: { | 1103 case NotificationType::USER_SCRIPTS_UPDATED: { |
1121 base::SharedMemory* shared_memory = | 1104 base::SharedMemory* shared_memory = |
1122 Details<base::SharedMemory>(details).ptr(); | 1105 Details<base::SharedMemory>(details).ptr(); |
1123 if (shared_memory) { | 1106 if (shared_memory) { |
1124 SendUserScriptsUpdate(shared_memory); | 1107 SendUserScriptsUpdate(shared_memory); |
1125 } | 1108 } |
1126 break; | 1109 break; |
1127 } | 1110 } |
1128 case NotificationType::EXTENSION_LOADED: | 1111 case NotificationType::EXTENSION_LOADED: { |
| 1112 Send(new ViewMsg_ExtensionLoaded( |
| 1113 ViewMsg_ExtensionLoaded_Params( |
| 1114 Details<const Extension>(details).ptr()))); |
| 1115 break; |
| 1116 } |
1129 case NotificationType::EXTENSION_UNLOADED: { | 1117 case NotificationType::EXTENSION_UNLOADED: { |
1130 SendExtensionInfo(); | 1118 Send(new ViewMsg_ExtensionUnloaded( |
| 1119 Details<UnloadedExtensionInfo>(details).ptr()->extension->id())); |
1131 break; | 1120 break; |
1132 } | 1121 } |
1133 case NotificationType::SPELLCHECK_HOST_REINITIALIZED: { | 1122 case NotificationType::SPELLCHECK_HOST_REINITIALIZED: { |
1134 InitSpellChecker(); | 1123 InitSpellChecker(); |
1135 break; | 1124 break; |
1136 } | 1125 } |
1137 case NotificationType::SPELLCHECK_WORD_ADDED: { | 1126 case NotificationType::SPELLCHECK_WORD_ADDED: { |
1138 AddSpellCheckWord( | 1127 AddSpellCheckWord( |
1139 reinterpret_cast<const Source<SpellCheckHost>*>(&source)-> | 1128 reinterpret_cast<const Source<SpellCheckHost>*>(&source)-> |
1140 ptr()->last_added_word()); | 1129 ptr()->last_added_word()); |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1291 IPC::PlatformFileForTransit file; | 1280 IPC::PlatformFileForTransit file; |
1292 #if defined(OS_POSIX) | 1281 #if defined(OS_POSIX) |
1293 file = base::FileDescriptor(model_file, false); | 1282 file = base::FileDescriptor(model_file, false); |
1294 #elif defined(OS_WIN) | 1283 #elif defined(OS_WIN) |
1295 ::DuplicateHandle(::GetCurrentProcess(), model_file, GetHandle(), &file, 0, | 1284 ::DuplicateHandle(::GetCurrentProcess(), model_file, GetHandle(), &file, 0, |
1296 false, DUPLICATE_SAME_ACCESS); | 1285 false, DUPLICATE_SAME_ACCESS); |
1297 #endif | 1286 #endif |
1298 Send(new ViewMsg_SetPhishingModel(file)); | 1287 Send(new ViewMsg_SetPhishingModel(file)); |
1299 } | 1288 } |
1300 } | 1289 } |
OLD | NEW |