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 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
286 | 286 |
287 void ExtensionDispatcher::DidCreateScriptContext( | 287 void ExtensionDispatcher::DidCreateScriptContext( |
288 WebFrame* frame, v8::Handle<v8::Context> v8_context, int world_id) { | 288 WebFrame* frame, v8::Handle<v8::Context> v8_context, int world_id) { |
289 std::string extension_id; | 289 std::string extension_id; |
290 if (!test_extension_id_.empty()) { | 290 if (!test_extension_id_.empty()) { |
291 extension_id = test_extension_id_; | 291 extension_id = test_extension_id_; |
292 } else if (world_id != 0) { | 292 } else if (world_id != 0) { |
293 extension_id = user_script_slave_->GetExtensionIdForIsolatedWorld(world_id); | 293 extension_id = user_script_slave_->GetExtensionIdForIsolatedWorld(world_id); |
294 } else { | 294 } else { |
295 GURL frame_url = UserScriptSlave::GetDataSourceURLForFrame(frame); | 295 GURL frame_url = UserScriptSlave::GetDataSourceURLForFrame(frame); |
296 extension_id = extensions_.GetIDByURL( | 296 extension_id = extensions_.GetIdByURL( |
297 ExtensionURLInfo(frame->document().securityOrigin(), frame_url)); | 297 ExtensionURLInfo(frame->document().securityOrigin(), frame_url)); |
298 } | 298 } |
299 | 299 |
300 ChromeV8Context* context = | 300 ChromeV8Context* context = |
301 new ChromeV8Context(v8_context, frame, extension_id); | 301 new ChromeV8Context(v8_context, frame, extension_id); |
302 v8_context_set_.Add(context); | 302 v8_context_set_.Add(context); |
303 | 303 |
304 context->DispatchOnLoadEvent( | 304 context->DispatchOnLoadEvent( |
305 is_extension_process_, | 305 is_extension_process_, |
306 ChromeRenderProcessObserver::is_incognito_process()); | 306 ChromeRenderProcessObserver::is_incognito_process()); |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
449 | 449 |
450 RenderThread::Get()->RegisterExtension(extension); | 450 RenderThread::Get()->RegisterExtension(extension); |
451 } | 451 } |
452 | 452 |
453 void ExtensionDispatcher::OnUsingWebRequestAPI( | 453 void ExtensionDispatcher::OnUsingWebRequestAPI( |
454 bool adblock, bool adblock_plus, bool other) { | 454 bool adblock, bool adblock_plus, bool other) { |
455 webrequest_adblock_ = adblock; | 455 webrequest_adblock_ = adblock; |
456 webrequest_adblock_plus_ = adblock_plus; | 456 webrequest_adblock_plus_ = adblock_plus; |
457 webrequest_other_ = other; | 457 webrequest_other_ = other; |
458 } | 458 } |
OLD | NEW |