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