| Index: extensions/renderer/extension_frame_helper.h
|
| diff --git a/extensions/renderer/extension_frame_helper.h b/extensions/renderer/extension_frame_helper.h
|
| index a710d4f970517610fe40be239176e685b9cf89ab..5fdd6d497c3e080521c9fae9dc1c9d303b4a41d1 100644
|
| --- a/extensions/renderer/extension_frame_helper.h
|
| +++ b/extensions/renderer/extension_frame_helper.h
|
| @@ -8,6 +8,7 @@
|
| #include <vector>
|
|
|
| #include "base/macros.h"
|
| +#include "base/memory/weak_ptr.h"
|
| #include "content/public/common/console_message_level.h"
|
| #include "content/public/renderer/render_frame_observer.h"
|
| #include "content/public/renderer/render_frame_observer_tracker.h"
|
| @@ -61,6 +62,25 @@ class ExtensionFrameHelper
|
| return did_create_current_document_element_;
|
| }
|
|
|
| + // Called when the document element has been inserted in this frame. This
|
| + // method may invoke untrusted JavaScript code that invalidate the frame and
|
| + // this ExtensionFrameHelper.
|
| + void AfterDidCreateDocumentElement();
|
| +
|
| + // Called after the DOMContentLoaded event has fired.
|
| + void AfterDidFinishDocumentLoad();
|
| +
|
| + // Schedule a callback, to be run at the next AfterDidCreateDocumentElement
|
| + // notification. Only call this when you are certain that there will be such a
|
| + // notification, e.g. from RenderFrameObserver::DidCreateDocumentElement.
|
| + // Otherwise the callback is never invoked, or invoked for a document that you
|
| + // were not expecting.
|
| + void ScheduleAfterDidCreateDocumentElement(const base::Closure& callback);
|
| +
|
| + // Schedule a callback, to be run at the next AfterDidFinishDocumentLoad
|
| + // notification.
|
| + void ScheduleAfterDidFinishDocumentLoad(const base::Closure& callback);
|
| +
|
| private:
|
| // RenderFrameObserver implementation.
|
| void DidCreateDocumentElement() override;
|
| @@ -113,6 +133,14 @@ class ExtensionFrameHelper
|
| // Whether or not the current document element has been created.
|
| bool did_create_current_document_element_;
|
|
|
| + // Callbacks to be run at the next AfterDidCreateDocumentElement notification.
|
| + std::vector<base::Closure> document_element_created_callbacks_;
|
| +
|
| + // Callbacks to be run at the next AfterDidFinishDocumentLoad notification.
|
| + std::vector<base::Closure> document_load_finished_callbacks_;
|
| +
|
| + base::WeakPtrFactory<ExtensionFrameHelper> weak_ptr_factory_;
|
| +
|
| DISALLOW_COPY_AND_ASSIGN(ExtensionFrameHelper);
|
| };
|
|
|
|
|