| 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( | 762 void Dispatcher::OnUpdateUserScripts(base::SharedMemoryHandle scripts) { |
| 763 base::SharedMemoryHandle scripts, | 763 DCHECK(base::SharedMemory::IsHandleValid(scripts)) << "Bad scripts handle"; |
| 764 const std::set<std::string>& extension_ids) { | 764 user_script_slave_->UpdateScripts(scripts); |
| 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); | |
| 780 UpdateActiveExtensions(); | 765 UpdateActiveExtensions(); |
| 781 } | 766 } |
| 782 | 767 |
| 783 void Dispatcher::OnUsingWebRequestAPI(bool adblock, | 768 void Dispatcher::OnUsingWebRequestAPI(bool adblock, |
| 784 bool adblock_plus, | 769 bool adblock_plus, |
| 785 bool other_webrequest) { | 770 bool other_webrequest) { |
| 786 delegate_->HandleWebRequestAPIUsage(adblock, adblock_plus, other_webrequest); | 771 delegate_->HandleWebRequestAPIUsage(adblock, adblock_plus, other_webrequest); |
| 787 } | 772 } |
| 788 | 773 |
| 789 void Dispatcher::UpdateActiveExtensions() { | 774 void Dispatcher::UpdateActiveExtensions() { |
| (...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1228 return v8::Handle<v8::Object>(); | 1213 return v8::Handle<v8::Object>(); |
| 1229 | 1214 |
| 1230 if (bind_name) | 1215 if (bind_name) |
| 1231 *bind_name = split.back(); | 1216 *bind_name = split.back(); |
| 1232 | 1217 |
| 1233 return bind_object.IsEmpty() ? AsObjectOrEmpty(GetOrCreateChrome(context)) | 1218 return bind_object.IsEmpty() ? AsObjectOrEmpty(GetOrCreateChrome(context)) |
| 1234 : bind_object; | 1219 : bind_object; |
| 1235 } | 1220 } |
| 1236 | 1221 |
| 1237 } // namespace extensions | 1222 } // namespace extensions |
| OLD | NEW |