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

Unified Diff: components/dom_distiller/webui/dom_distiller_viewer_handler.h

Issue 105723002: Add the scheme chrome-distiller:// and hook up data source. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 7 years 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/webui/dom_distiller_viewer_handler.h
diff --git a/components/dom_distiller/webui/dom_distiller_viewer_handler.h b/components/dom_distiller/webui/dom_distiller_viewer_handler.h
new file mode 100644
index 0000000000000000000000000000000000000000..ec8138b7413f09d7a286c853ce52fea2fcdd03d5
--- /dev/null
+++ b/components/dom_distiller/webui/dom_distiller_viewer_handler.h
@@ -0,0 +1,59 @@
+// Copyright 2013 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_WEBUI_DOM_DISTILLER_VIEWER_HANDLER_H_
+#define COMPONENTS_DOM_DISTILLER_WEBUI_DOM_DISTILLER_VIEWER_HANDLER_H_
+
+#include <vector>
+
+#include "base/memory/weak_ptr.h"
+#include "base/values.h"
+#include "content/public/browser/web_contents_observer.h"
+#include "content/public/browser/web_ui_message_handler.h"
+#include "url/gurl.h"
+
+namespace dom_distiller {
+
+class DistilledPageProto;
+class DomDistillerService;
+class ViewerHandle;
+
+// Handler class for DOM Distiller viewing operations.
+class DomDistillerViewerHandler : public content::WebUIMessageHandler,
+ public content::WebContentsObserver {
+ public:
+ DomDistillerViewerHandler(const GURL& url,
+ content::WebContents* web_contents);
+ virtual ~DomDistillerViewerHandler();
+
+ // content::WebUIMessageHandler implementation.
+ virtual void RegisterMessages() OVERRIDE;
+
+ // content::WebContentsObserver implementation.
+ virtual void DidFinishLoad(
+ int64 frame_num,
+ const GURL& validated_url,
+ bool is_main_frame,
+ content::RenderViewHost* render_view_host) OVERRIDE;
+ virtual void DidFailLoad(
+ int64 frame_num,
+ const GURL& validated_url,
+ bool is_main_frame,
+ int error_code,
+ const string16& error_description,
+ content::RenderViewHost* render_view_host) OVERRIDE;
+
+ private:
+ // Factory for the creating refs in callbacks.
+ base::WeakPtrFactory<DomDistillerViewerHandler> weak_ptr_factory_;
+
+ // The URL of the current WebUI.
+ const GURL url_;
+
+ DISALLOW_COPY_AND_ASSIGN(DomDistillerViewerHandler);
+};
+
+} // namespace dom_distiller
+
+#endif // COMPONENTS_DOM_DISTILLER_WEBUI_DOM_DISTILLER_VIEWER_HANDLER_H_

Powered by Google App Engine
This is Rietveld 408576698