Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(491)

Unified Diff: components/dom_distiller/content/renderer/distiller_page_notifier_service_impl.h

Issue 1231083007: Expose distiller functions to JavaScript (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@refactor-content
Patch Set: Move dependencies to correct files Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/dom_distiller/content/renderer/distiller_page_notifier_service_impl.h
diff --git a/components/dom_distiller/content/renderer/distiller_page_notifier_service_impl.h b/components/dom_distiller/content/renderer/distiller_page_notifier_service_impl.h
new file mode 100644
index 0000000000000000000000000000000000000000..be1cca157eb0e23dea042d2f8f61dd71cdf6f2fb
--- /dev/null
+++ b/components/dom_distiller/content/renderer/distiller_page_notifier_service_impl.h
@@ -0,0 +1,38 @@
+// 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_PAGE_NOTIFIER_SERVICE_IMPL_H_
+#define COMPONENTS_DOM_DISTILLER_CONTENT_RENDERER_DISTILLER_PAGE_NOTIFIER_SERVICE_IMPL_H_
+
+#include "components/dom_distiller/content/common/distiller_page_notifier_service.mojom.h"
+#include "components/dom_distiller/content/renderer/distiller_js_render_frame_observer.h"
+#include "components/dom_distiller/content/renderer/distiller_native_javascript.h"
+#include "third_party/mojo/src/mojo/public/cpp/bindings/strong_binding.h"
+
+namespace dom_distiller {
+
+class DistillerJsRenderFrameObserver;
+
+// DistillerPageNotifierService is responsible for listening to the browser for
+// messages about if a page is a distiller page. No message is received if the
+// page is not a distiller page. This service should be removed from the
+// registry once the page is done loading.
+class DistillerPageNotifierServiceImpl : public DistillerPageNotifierService {
+ public:
+ explicit DistillerPageNotifierServiceImpl(
+ DistillerJsRenderFrameObserver* observer,
+ mojo::InterfaceRequest<DistillerPageNotifierService> request);
+ ~DistillerPageNotifierServiceImpl() override;
+
+ // Implementation of mojo interface DistillerPageNotifierService.
+ void NotifyIsDistillerPage() override;
+
+ private:
+ mojo::StrongBinding<DistillerPageNotifierService> binding_;
+ DistillerJsRenderFrameObserver* distiller_js_observer_;
+};
+
+} // namespace dom_distiller
+
+#endif // COMPONENTS_DOM_DISTILLER_CONTENT_RENDERER_DISTILLER_PAGE_NOTIFIER_SERVICE_IMPL_H_

Powered by Google App Engine
This is Rietveld 408576698