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/bind.h" | 7 #include "base/bind.h" |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/debug/alias.h" | 10 #include "base/debug/alias.h" |
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
358 | 358 |
359 void Dispatcher::WillReleaseScriptContext( | 359 void Dispatcher::WillReleaseScriptContext( |
360 blink::WebLocalFrame* frame, | 360 blink::WebLocalFrame* frame, |
361 const v8::Handle<v8::Context>& v8_context, | 361 const v8::Handle<v8::Context>& v8_context, |
362 int world_id) { | 362 int world_id) { |
363 ScriptContext* context = script_context_set_.GetByV8Context(v8_context); | 363 ScriptContext* context = script_context_set_.GetByV8Context(v8_context); |
364 if (!context) | 364 if (!context) |
365 return; | 365 return; |
366 | 366 |
367 context->DispatchOnUnloadEvent(); | 367 context->DispatchOnUnloadEvent(); |
368 // TODO(kalman): add an invalidation observer interface to ScriptContext. | 368 // TODO(kalman): Make |request_sender| use |context->AddInvalidationObserver|. |
| 369 // In fact |request_sender_| should really be owned by ScriptContext. |
369 request_sender_->InvalidateSource(context); | 370 request_sender_->InvalidateSource(context); |
370 | 371 |
371 script_context_set_.Remove(context); | 372 script_context_set_.Remove(context); |
372 VLOG(1) << "Num tracked contexts: " << script_context_set_.size(); | 373 VLOG(1) << "Num tracked contexts: " << script_context_set_.size(); |
373 } | 374 } |
374 | 375 |
375 void Dispatcher::DidCreateDocumentElement(blink::WebFrame* frame) { | 376 void Dispatcher::DidCreateDocumentElement(blink::WebFrame* frame) { |
376 // Note: use GetEffectiveDocumentURL not just frame->document()->url() | 377 // Note: use GetEffectiveDocumentURL not just frame->document()->url() |
377 // so that this also injects the stylesheet on about:blank frames that | 378 // so that this also injects the stylesheet on about:blank frames that |
378 // are hosted in the extension process. | 379 // are hosted in the extension process. |
(...skipping 1181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1560 // The "guestViewDeny" module must always be loaded last. It registers | 1561 // The "guestViewDeny" module must always be loaded last. It registers |
1561 // error-providing custom elements for the GuestView types that are not | 1562 // error-providing custom elements for the GuestView types that are not |
1562 // available, and thus all of those types must have been checked and loaded | 1563 // available, and thus all of those types must have been checked and loaded |
1563 // (or not loaded) beforehand. | 1564 // (or not loaded) beforehand. |
1564 if (context_type == Feature::BLESSED_EXTENSION_CONTEXT) { | 1565 if (context_type == Feature::BLESSED_EXTENSION_CONTEXT) { |
1565 module_system->Require("guestViewDeny"); | 1566 module_system->Require("guestViewDeny"); |
1566 } | 1567 } |
1567 } | 1568 } |
1568 | 1569 |
1569 } // namespace extensions | 1570 } // namespace extensions |
OLD | NEW |