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 |