OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome/renderer/extensions/extension_dispatcher.h" | 5 #include "chrome/renderer/extensions/extension_dispatcher.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "chrome/common/child_process_logging.h" | 8 #include "chrome/common/child_process_logging.h" |
9 #include "chrome/common/chrome_switches.h" | 9 #include "chrome/common/chrome_switches.h" |
10 #include "chrome/common/extensions/extension.h" | 10 #include "chrome/common/extensions/extension.h" |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 bool ExtensionDispatcher::IsExtensionActive( | 253 bool ExtensionDispatcher::IsExtensionActive( |
254 const std::string& extension_id) const { | 254 const std::string& extension_id) const { |
255 return active_extension_ids_.find(extension_id) != | 255 return active_extension_ids_.find(extension_id) != |
256 active_extension_ids_.end(); | 256 active_extension_ids_.end(); |
257 } | 257 } |
258 | 258 |
259 bool ExtensionDispatcher::AllowScriptExtension( | 259 bool ExtensionDispatcher::AllowScriptExtension( |
260 WebFrame* frame, | 260 WebFrame* frame, |
261 const std::string& v8_extension_name, | 261 const std::string& v8_extension_name, |
262 int extension_group) { | 262 int extension_group) { |
| 263 return AllowScriptExtension(frame, v8_extension_name, extension_group, 0); |
| 264 } |
| 265 |
| 266 bool ExtensionDispatcher::AllowScriptExtension( |
| 267 WebFrame* frame, |
| 268 const std::string& v8_extension_name, |
| 269 int extension_group, |
| 270 int world_id) { |
263 // NULL in unit tests. | 271 // NULL in unit tests. |
264 if (!RenderThread::Get()) | 272 if (!RenderThread::Get()) |
265 return true; | 273 return true; |
266 | 274 |
267 // If we don't know about it, it was added by WebCore, so we should allow it. | 275 // If we don't know about it, it was added by WebCore, so we should allow it. |
268 if (!RenderThread::Get()->IsRegisteredExtension(v8_extension_name)) | 276 if (!RenderThread::Get()->IsRegisteredExtension(v8_extension_name)) |
269 return true; | 277 return true; |
270 | 278 |
271 // If the V8 extension is not restricted, allow it to run anywhere. | 279 // If the V8 extension is not restricted, allow it to run anywhere. |
272 if (!restricted_v8_extensions_.count(v8_extension_name)) | 280 if (!restricted_v8_extensions_.count(v8_extension_name)) |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
449 | 457 |
450 RenderThread::Get()->RegisterExtension(extension); | 458 RenderThread::Get()->RegisterExtension(extension); |
451 } | 459 } |
452 | 460 |
453 void ExtensionDispatcher::OnUsingWebRequestAPI( | 461 void ExtensionDispatcher::OnUsingWebRequestAPI( |
454 bool adblock, bool adblock_plus, bool other) { | 462 bool adblock, bool adblock_plus, bool other) { |
455 webrequest_adblock_ = adblock; | 463 webrequest_adblock_ = adblock; |
456 webrequest_adblock_plus_ = adblock_plus; | 464 webrequest_adblock_plus_ = adblock_plus; |
457 webrequest_other_ = other; | 465 webrequest_other_ = other; |
458 } | 466 } |
OLD | NEW |