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