Chromium Code Reviews| Index: components/dom_distiller/content/renderer/distiller_js_render_frame_observer.h |
| diff --git a/components/dom_distiller/content/renderer/distiller_js_render_frame_observer.h b/components/dom_distiller/content/renderer/distiller_js_render_frame_observer.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..5c087b50850f356c423646954937652f216bd8d3 |
| --- /dev/null |
| +++ b/components/dom_distiller/content/renderer/distiller_js_render_frame_observer.h |
| @@ -0,0 +1,44 @@ |
| +// Copyright 2015 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef COMPONENTS_DOM_DISTILLER_CONTENT_RENDERER_DISTILLER_JS_RENDER_FRAME_OBSERVER_H_ |
| +#define COMPONENTS_DOM_DISTILLER_CONTENT_RENDERER_DISTILLER_JS_RENDER_FRAME_OBSERVER_H_ |
| + |
| +#include "base/memory/weak_ptr.h" |
| +#include "components/dom_distiller/content/common/distiller_javascript_service.mojom.h" |
| +#include "components/dom_distiller/content/renderer/distiller_native_javascript.h" |
| +#include "components/dom_distiller/content/renderer/distiller_page_notifier_service_impl.h" |
| +#include "content/public/renderer/render_frame.h" |
| +#include "content/public/renderer/render_frame_observer.h" |
| +#include "third_party/WebKit/public/web/WebLocalFrame.h" |
| +#include "v8/include/v8.h" |
| + |
| +namespace dom_distiller { |
| + |
| +class DistillerJsRenderFrameObserver : public content::RenderFrameObserver { |
| + public: |
| + DistillerJsRenderFrameObserver(content::RenderFrame* render_frame); |
| + // RenderFrameObserver implementation. |
| + void DidStartProvisionalLoad() override; |
| + void DidClearWindowObject() override; |
| + ~DistillerJsRenderFrameObserver() override; |
| + |
| + void RegisterMojoService(); |
|
nyquist
2015/07/27 21:44:33
How do these two methods below differ? Could you a
mdjones
2015/07/28 20:53:41
One of the function names needed to be updated. Do
|
| + void SetupMojoForJavaScript(); |
|
nyquist
2015/07/27 21:44:33
Why is this method public? Isn't it only called fr
mdjones
2015/07/28 20:53:42
No, it is called by the DistillerPageNotifierImpl.
|
| + |
| + private: |
| + void createDistillerPageNotifierService( |
|
nyquist
2015/07/27 21:44:33
createDistillerPageNotifierService
mdjones
2015/07/28 20:53:42
That is what it currently is.
|
| + mojo::InterfaceRequest<DistillerPageNotifierService> request); |
| + |
| + // Track if the current page is distilled. This is needed for testing. |
| + bool is_distiller_page_; |
| + |
| + // Handle to "distiller" JavaScript object functionality. |
| + scoped_ptr<DistillerNativeJavaScript> native_javascript_handle_; |
| + base::WeakPtrFactory<DistillerJsRenderFrameObserver> weak_factory_; |
| +}; |
| + |
| +} // namespace dom_distiller |
| + |
| +#endif // COMPONENTS_DOM_DISTILLER_CONTENT_RENDERER_DISTILLER_JS_RENDER_FRAME_OBSERVER_H_ |