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