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

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

Issue 288053002: Block content scripts from executing until user grants permission (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase after ScriptInjection refactor Created 6 years, 7 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 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/callback.h" 7 #include "base/callback.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/debug/alias.h" 9 #include "base/debug/alias.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 742 matching lines...) Expand 10 before | Expand all | Expand 10 after
753 753
754 void Dispatcher::OnUpdateTabSpecificPermissions( 754 void Dispatcher::OnUpdateTabSpecificPermissions(
755 int page_id, 755 int page_id,
756 int tab_id, 756 int tab_id,
757 const std::string& extension_id, 757 const std::string& extension_id,
758 const URLPatternSet& origin_set) { 758 const URLPatternSet& origin_set) {
759 delegate_->UpdateTabSpecificPermissions( 759 delegate_->UpdateTabSpecificPermissions(
760 this, page_id, tab_id, extension_id, origin_set); 760 this, page_id, tab_id, extension_id, origin_set);
761 } 761 }
762 762
763 void Dispatcher::OnUpdateUserScripts(base::SharedMemoryHandle scripts) { 763 void Dispatcher::OnUpdateUserScripts(
764 DCHECK(base::SharedMemory::IsHandleValid(scripts)) << "Bad scripts handle"; 764 base::SharedMemoryHandle scripts,
765 user_script_slave_->UpdateScripts(scripts); 765 const std::set<std::string>& extension_ids) {
766 if (!base::SharedMemory::IsHandleValid(scripts)) {
767 NOTREACHED() << "Bad scripts handle";
768 return;
769 }
770
771 for (std::set<std::string>::const_iterator iter = extension_ids.begin();
772 iter != extension_ids.end();
773 ++iter) {
774 if (!Extension::IdIsValid(*iter)) {
775 NOTREACHED() << "Invalid extension id: " << *iter;
776 return;
777 }
778 }
779
780 user_script_slave_->UpdateScripts(scripts, extension_ids);
766 UpdateActiveExtensions(); 781 UpdateActiveExtensions();
767 } 782 }
768 783
769 void Dispatcher::OnUsingWebRequestAPI(bool adblock, 784 void Dispatcher::OnUsingWebRequestAPI(bool adblock,
770 bool adblock_plus, 785 bool adblock_plus,
771 bool other_webrequest) { 786 bool other_webrequest) {
772 delegate_->HandleWebRequestAPIUsage(adblock, adblock_plus, other_webrequest); 787 delegate_->HandleWebRequestAPIUsage(adblock, adblock_plus, other_webrequest);
773 } 788 }
774 789
775 void Dispatcher::UpdateActiveExtensions() { 790 void Dispatcher::UpdateActiveExtensions() {
(...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after
1212 return v8::Handle<v8::Object>(); 1227 return v8::Handle<v8::Object>();
1213 1228
1214 if (bind_name) 1229 if (bind_name)
1215 *bind_name = split.back(); 1230 *bind_name = split.back();
1216 1231
1217 return bind_object.IsEmpty() ? AsObjectOrEmpty(GetOrCreateChrome(context)) 1232 return bind_object.IsEmpty() ? AsObjectOrEmpty(GetOrCreateChrome(context))
1218 : bind_object; 1233 : bind_object;
1219 } 1234 }
1220 1235
1221 } // namespace extensions 1236 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698