| OLD | NEW |
| 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 741 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 752 | 752 |
| 753 void Dispatcher::OnUpdateTabSpecificPermissions( | 753 void Dispatcher::OnUpdateTabSpecificPermissions( |
| 754 int page_id, | 754 int page_id, |
| 755 int tab_id, | 755 int tab_id, |
| 756 const std::string& extension_id, | 756 const std::string& extension_id, |
| 757 const URLPatternSet& origin_set) { | 757 const URLPatternSet& origin_set) { |
| 758 delegate_->UpdateTabSpecificPermissions( | 758 delegate_->UpdateTabSpecificPermissions( |
| 759 this, page_id, tab_id, extension_id, origin_set); | 759 this, page_id, tab_id, extension_id, origin_set); |
| 760 } | 760 } |
| 761 | 761 |
| 762 void Dispatcher::OnUpdateUserScripts(base::SharedMemoryHandle scripts) { | 762 void Dispatcher::OnUpdateUserScripts( |
| 763 DCHECK(base::SharedMemory::IsHandleValid(scripts)) << "Bad scripts handle"; | 763 base::SharedMemoryHandle scripts, |
| 764 user_script_slave_->UpdateScripts(scripts); | 764 const std::set<std::string>& extension_ids) { |
| 765 if (!base::SharedMemory::IsHandleValid(scripts)) { |
| 766 NOTREACHED() << "Bad scripts handle"; |
| 767 return; |
| 768 } |
| 769 |
| 770 for (std::set<std::string>::const_iterator iter = extension_ids.begin(); |
| 771 iter != extension_ids.end(); |
| 772 ++iter) { |
| 773 if (!Extension::IdIsValid(*iter)) { |
| 774 NOTREACHED() << "Invalid extension id: " << *iter; |
| 775 return; |
| 776 } |
| 777 } |
| 778 |
| 779 user_script_slave_->UpdateScripts(scripts, extension_ids); |
| 765 UpdateActiveExtensions(); | 780 UpdateActiveExtensions(); |
| 766 } | 781 } |
| 767 | 782 |
| 768 void Dispatcher::OnUsingWebRequestAPI(bool adblock, | 783 void Dispatcher::OnUsingWebRequestAPI(bool adblock, |
| 769 bool adblock_plus, | 784 bool adblock_plus, |
| 770 bool other_webrequest) { | 785 bool other_webrequest) { |
| 771 delegate_->HandleWebRequestAPIUsage(adblock, adblock_plus, other_webrequest); | 786 delegate_->HandleWebRequestAPIUsage(adblock, adblock_plus, other_webrequest); |
| 772 } | 787 } |
| 773 | 788 |
| 774 void Dispatcher::UpdateActiveExtensions() { | 789 void Dispatcher::UpdateActiveExtensions() { |
| (...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1213 return v8::Handle<v8::Object>(); | 1228 return v8::Handle<v8::Object>(); |
| 1214 | 1229 |
| 1215 if (bind_name) | 1230 if (bind_name) |
| 1216 *bind_name = split.back(); | 1231 *bind_name = split.back(); |
| 1217 | 1232 |
| 1218 return bind_object.IsEmpty() ? AsObjectOrEmpty(GetOrCreateChrome(context)) | 1233 return bind_object.IsEmpty() ? AsObjectOrEmpty(GetOrCreateChrome(context)) |
| 1219 : bind_object; | 1234 : bind_object; |
| 1220 } | 1235 } |
| 1221 | 1236 |
| 1222 } // namespace extensions | 1237 } // namespace extensions |
| OLD | NEW |