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

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

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.cc
diff --git a/components/dom_distiller/webui/dom_distiller_viewer_handler.cc b/components/dom_distiller/webui/dom_distiller_viewer_handler.cc
new file mode 100644
index 0000000000000000000000000000000000000000..9789e5cd735bad9eebdaf6ec2b8a2a688b6709e1
--- /dev/null
+++ b/components/dom_distiller/webui/dom_distiller_viewer_handler.cc
@@ -0,0 +1,49 @@
+// 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.
+
+#include "components/dom_distiller/webui/dom_distiller_viewer_handler.h"
+
+#include "base/bind.h"
+#include "base/strings/string_util.h"
+#include "base/values.h"
+#include "components/dom_distiller/core/dom_distiller_service.h"
+#include "components/dom_distiller/core/proto/distilled_page.pb.h"
+#include "content/public/browser/web_contents_observer.h"
+#include "content/public/browser/web_ui.h"
+
+namespace dom_distiller {
+
+DomDistillerViewerHandler::DomDistillerViewerHandler(
+ const GURL& url,
+ content::WebContents* web_contents)
+ : content::WebContentsObserver(web_contents),
+ weak_ptr_factory_(this),
+ url_(url) {}
+
+DomDistillerViewerHandler::~DomDistillerViewerHandler() {}
+
+void DomDistillerViewerHandler::RegisterMessages() {}
+
+void DomDistillerViewerHandler::DidFinishLoad(
+ int64 frame_num,
+ const GURL& validated_url,
+ bool is_main_frame,
+ content::RenderViewHost* render_view_host) {
+ std::string entry_id = url_.host();
+ StringValue entry_id_value = StringValue(entry_id);
+ web_ui()->CallJavascriptFunction("domDistillerViewer.onReceivedTitle",
+ entry_id_value);
+}
+
+void DomDistillerViewerHandler::DidFailLoad(
+ int64 frame_num,
+ const GURL& validated_url,
+ bool is_main_frame,
+ int error_code,
+ const string16& error_description,
+ content::RenderViewHost* render_view_host) {
+ // Nothing to do here.
+}
+
+} // namespace dom_distiller

Powered by Google App Engine
This is Rietveld 408576698