OLD | NEW |
(Empty) | |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "components/dom_distiller/webui/dom_distiller_viewer_handler.h" |
| 6 |
| 7 #include "base/bind.h" |
| 8 #include "base/strings/string_util.h" |
| 9 #include "base/values.h" |
| 10 #include "components/dom_distiller/core/dom_distiller_service.h" |
| 11 #include "components/dom_distiller/core/proto/distilled_page.pb.h" |
| 12 #include "content/public/browser/web_contents_observer.h" |
| 13 #include "content/public/browser/web_ui.h" |
| 14 |
| 15 namespace dom_distiller { |
| 16 |
| 17 DomDistillerViewerHandler::DomDistillerViewerHandler( |
| 18 const GURL& url, |
| 19 content::WebContents* web_contents) |
| 20 : content::WebContentsObserver(web_contents), |
| 21 weak_ptr_factory_(this), |
| 22 url_(url) {} |
| 23 |
| 24 DomDistillerViewerHandler::~DomDistillerViewerHandler() {} |
| 25 |
| 26 void DomDistillerViewerHandler::RegisterMessages() {} |
| 27 |
| 28 void DomDistillerViewerHandler::DidFinishLoad( |
| 29 int64 frame_num, |
| 30 const GURL& validated_url, |
| 31 bool is_main_frame, |
| 32 content::RenderViewHost* render_view_host) { |
| 33 std::string entry_id = url_.host(); |
| 34 StringValue entry_id_value = StringValue(entry_id); |
| 35 web_ui()->CallJavascriptFunction("domDistillerViewer.onReceivedTitle", |
| 36 entry_id_value); |
| 37 } |
| 38 |
| 39 void DomDistillerViewerHandler::DidFailLoad( |
| 40 int64 frame_num, |
| 41 const GURL& validated_url, |
| 42 bool is_main_frame, |
| 43 int error_code, |
| 44 const string16& error_description, |
| 45 content::RenderViewHost* render_view_host) { |
| 46 // Nothing to do here. |
| 47 } |
| 48 |
| 49 } // namespace dom_distiller |
OLD | NEW |