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

Side by Side Diff: extensions/renderer/dispatcher.cc

Issue 934763003: Refactoring: de-couple Extensions from "script injection System" [render side]:3 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@decouple_brower_isolated_world_routingid_user_script_1
Patch Set: Reset InjectionHost in ScriptInjection when extension is unloaded. Created 5 years, 10 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "extensions/renderer/dispatcher.h" 5 #include "extensions/renderer/dispatcher.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/debug/alias.h" 10 #include "base/debug/alias.h"
(...skipping 1013 matching lines...) Expand 10 before | Expand all | Expand 10 after
1024 } 1024 }
1025 1025
1026 void Dispatcher::OnTransferBlobs(const std::vector<std::string>& blob_uuids) { 1026 void Dispatcher::OnTransferBlobs(const std::vector<std::string>& blob_uuids) {
1027 RenderThread::Get()->Send(new ExtensionHostMsg_TransferBlobsAck(blob_uuids)); 1027 RenderThread::Get()->Send(new ExtensionHostMsg_TransferBlobsAck(blob_uuids));
1028 } 1028 }
1029 1029
1030 void Dispatcher::OnUnloaded(const std::string& id) { 1030 void Dispatcher::OnUnloaded(const std::string& id) {
1031 extensions_.Remove(id); 1031 extensions_.Remove(id);
1032 active_extension_ids_.erase(id); 1032 active_extension_ids_.erase(id);
1033 1033
1034 script_injection_manager_->OnExtensionUnloaded(id);
1035
1034 // If the extension is later reloaded with a different set of permissions, 1036 // If the extension is later reloaded with a different set of permissions,
1035 // we'd like it to get a new isolated world ID, so that it can pick up the 1037 // we'd like it to get a new isolated world ID, so that it can pick up the
1036 // changed origin whitelist. 1038 // changed origin whitelist.
1037 ScriptInjection::RemoveIsolatedWorld(id); 1039 ScriptInjection::RemoveIsolatedWorld(id);
1038 1040
1039 // Invalidate all of the contexts that were removed. 1041 // Invalidate all of the contexts that were removed.
1040 // TODO(kalman): add an invalidation observer interface to ScriptContext. 1042 // TODO(kalman): add an invalidation observer interface to ScriptContext.
1041 ScriptContextSet::ContextSet removed_contexts = 1043 ScriptContextSet::ContextSet removed_contexts =
1042 script_context_set_.OnExtensionUnloaded(id); 1044 script_context_set_.OnExtensionUnloaded(id);
1043 for (ScriptContextSet::ContextSet::iterator it = removed_contexts.begin(); 1045 for (ScriptContextSet::ContextSet::iterator it = removed_contexts.begin();
(...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after
1544 return v8::Handle<v8::Object>(); 1546 return v8::Handle<v8::Object>();
1545 1547
1546 if (bind_name) 1548 if (bind_name)
1547 *bind_name = split.back(); 1549 *bind_name = split.back();
1548 1550
1549 return bind_object.IsEmpty() ? AsObjectOrEmpty(GetOrCreateChrome(context)) 1551 return bind_object.IsEmpty() ? AsObjectOrEmpty(GetOrCreateChrome(context))
1550 : bind_object; 1552 : bind_object;
1551 } 1553 }
1552 1554
1553 } // namespace extensions 1555 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698