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

Side by Side Diff: chrome/renderer/render_thread.cc

Issue 6242010: Refactor away most of ExtensionRendererInfo (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove more deadness 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
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/renderer/render_thread.h" 5 #include "chrome/renderer/render_thread.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 #include <map> 9 #include <map>
10 #include <vector> 10 #include <vector>
(...skipping 518 matching lines...) Expand 10 before | Expand all | Expand 10 after
529 DCHECK(base::SharedMemory::IsHandleValid(scripts)) << "Bad scripts handle"; 529 DCHECK(base::SharedMemory::IsHandleValid(scripts)) << "Bad scripts handle";
530 user_script_slave_->UpdateScripts(scripts); 530 user_script_slave_->UpdateScripts(scripts);
531 UpdateActiveExtensions(); 531 UpdateActiveExtensions();
532 } 532 }
533 533
534 void RenderThread::OnSetExtensionFunctionNames( 534 void RenderThread::OnSetExtensionFunctionNames(
535 const std::vector<std::string>& names) { 535 const std::vector<std::string>& names) {
536 ExtensionProcessBindings::SetFunctionNames(names); 536 ExtensionProcessBindings::SetFunctionNames(names);
537 } 537 }
538 538
539 void RenderThread::OnExtensionsUpdated( 539 void RenderThread::OnExtensionLoaded(
540 const ViewMsg_ExtensionsUpdated_Params& params) { 540 const ViewMsg_ExtensionLoaded_Params& params) {
541 ExtensionRendererInfo::UpdateExtensions(params); 541 scoped_refptr<const Extension> extension(params.ConvertToExtension());
542 CHECK(extension);
543 extensions_.Update(extension);
544 }
545
546 void RenderThread::OnExtensionUnloaded(const std::string& id) {
547 extensions_.Remove(id);
542 } 548 }
543 549
544 void RenderThread::OnPageActionsUpdated( 550 void RenderThread::OnPageActionsUpdated(
545 const std::string& extension_id, 551 const std::string& extension_id,
546 const std::vector<std::string>& page_actions) { 552 const std::vector<std::string>& page_actions) {
547 ExtensionProcessBindings::SetPageActions(extension_id, page_actions); 553 ExtensionProcessBindings::SetPageActions(extension_id, page_actions);
548 } 554 }
549 555
550 void RenderThread::OnExtensionSetAPIPermissions( 556 void RenderThread::OnExtensionSetAPIPermissions(
551 const std::string& extension_id, 557 const std::string& extension_id,
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
607 IPC_MESSAGE_HANDLER(ViewMsg_GetCacheResourceStats, 613 IPC_MESSAGE_HANDLER(ViewMsg_GetCacheResourceStats,
608 OnGetCacheResourceStats) 614 OnGetCacheResourceStats)
609 IPC_MESSAGE_HANDLER(ViewMsg_UserScripts_UpdatedScripts, 615 IPC_MESSAGE_HANDLER(ViewMsg_UserScripts_UpdatedScripts,
610 OnUpdateUserScripts) 616 OnUpdateUserScripts)
611 // TODO(rafaelw): create an ExtensionDispatcher that handles extension 617 // TODO(rafaelw): create an ExtensionDispatcher that handles extension
612 // messages seperates their handling from the RenderThread. 618 // messages seperates their handling from the RenderThread.
613 IPC_MESSAGE_HANDLER(ViewMsg_ExtensionMessageInvoke, 619 IPC_MESSAGE_HANDLER(ViewMsg_ExtensionMessageInvoke,
614 OnExtensionMessageInvoke) 620 OnExtensionMessageInvoke)
615 IPC_MESSAGE_HANDLER(ViewMsg_Extension_SetFunctionNames, 621 IPC_MESSAGE_HANDLER(ViewMsg_Extension_SetFunctionNames,
616 OnSetExtensionFunctionNames) 622 OnSetExtensionFunctionNames)
617 IPC_MESSAGE_HANDLER(ViewMsg_ExtensionsUpdated, 623 IPC_MESSAGE_HANDLER(ViewMsg_ExtensionLoaded,
618 OnExtensionsUpdated) 624 OnExtensionLoaded)
625 IPC_MESSAGE_HANDLER(ViewMsg_ExtensionUnloaded,
626 OnExtensionUnloaded)
619 IPC_MESSAGE_HANDLER(ViewMsg_PurgeMemory, OnPurgeMemory) 627 IPC_MESSAGE_HANDLER(ViewMsg_PurgeMemory, OnPurgeMemory)
620 IPC_MESSAGE_HANDLER(ViewMsg_PurgePluginListCache, 628 IPC_MESSAGE_HANDLER(ViewMsg_PurgePluginListCache,
621 OnPurgePluginListCache) 629 OnPurgePluginListCache)
622 IPC_MESSAGE_HANDLER(ViewMsg_Extension_UpdatePageActions, 630 IPC_MESSAGE_HANDLER(ViewMsg_Extension_UpdatePageActions,
623 OnPageActionsUpdated) 631 OnPageActionsUpdated)
624 IPC_MESSAGE_HANDLER(ViewMsg_Extension_SetAPIPermissions, 632 IPC_MESSAGE_HANDLER(ViewMsg_Extension_SetAPIPermissions,
625 OnExtensionSetAPIPermissions) 633 OnExtensionSetAPIPermissions)
626 IPC_MESSAGE_HANDLER(ViewMsg_Extension_SetHostPermissions, 634 IPC_MESSAGE_HANDLER(ViewMsg_Extension_SetHostPermissions,
627 OnExtensionSetHostPermissions) 635 OnExtensionSetHostPermissions)
628 IPC_MESSAGE_HANDLER(DOMStorageMsg_Event, 636 IPC_MESSAGE_HANDLER(DOMStorageMsg_Event,
(...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after
1125 return true; 1133 return true;
1126 1134
1127 // If the V8 extension is not restricted, allow it to run anywhere. 1135 // If the V8 extension is not restricted, allow it to run anywhere.
1128 bool restrict_to_extensions = v8_extensions_[v8_extension_name]; 1136 bool restrict_to_extensions = v8_extensions_[v8_extension_name];
1129 if (!restrict_to_extensions) 1137 if (!restrict_to_extensions)
1130 return true; 1138 return true;
1131 1139
1132 // Extension-only bindings should be restricted to content scripts and 1140 // Extension-only bindings should be restricted to content scripts and
1133 // extension-blessed URLs. 1141 // extension-blessed URLs.
1134 if (extension_group == EXTENSION_GROUP_CONTENT_SCRIPTS || 1142 if (extension_group == EXTENSION_GROUP_CONTENT_SCRIPTS ||
1135 ExtensionRendererInfo::ExtensionBindingsAllowed(url)) { 1143 extensions_.ExtensionBindingsAllowed(url)) {
1136 return true; 1144 return true;
1137 } 1145 }
1138 1146
1139 return false; 1147 return false;
1140 } 1148 }
1141 1149
1142 void RenderThread::RegisterExtension(v8::Extension* extension, 1150 void RenderThread::RegisterExtension(v8::Extension* extension,
1143 bool restrict_to_extensions) { 1151 bool restrict_to_extensions) {
1144 WebScriptController::registerExtension(extension); 1152 WebScriptController::registerExtension(extension);
1145 v8_extensions_[extension->name()] = restrict_to_extensions; 1153 v8_extensions_[extension->name()] = restrict_to_extensions;
1146 } 1154 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698