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 DomDistillerService* service, |
| 19 const GURL& url, |
| 20 content::WebContents* web_contents) |
| 21 : content::WebContentsObserver(web_contents), |
| 22 weak_ptr_factory_(this), |
| 23 service_(service), |
| 24 url_(url) {} |
| 25 |
| 26 DomDistillerViewerHandler::~DomDistillerViewerHandler() {} |
| 27 |
| 28 void DomDistillerViewerHandler::RegisterMessages() {} |
| 29 |
| 30 void DomDistillerViewerHandler::DidFinishLoad( |
| 31 int64 frame_num, |
| 32 const GURL& validated_url, |
| 33 bool is_main_frame, |
| 34 content::RenderViewHost* render_view_host) { |
| 35 std::string entry_id = url_.host(); |
| 36 StringValue entry_id_value = StringValue(entry_id); |
| 37 web_ui()->CallJavascriptFunction("domDistillerViewer.onReceivedTitle", |
| 38 entry_id_value); |
| 39 } |
| 40 |
| 41 void DomDistillerViewerHandler::DidFailLoad( |
| 42 int64 frame_num, |
| 43 const GURL& validated_url, |
| 44 bool is_main_frame, |
| 45 int error_code, |
| 46 const string16& error_description, |
| 47 content::RenderViewHost* render_view_host) { |
| 48 // Nothing to do here. |
| 49 } |
| 50 |
| 51 } // namespace dom_distiller |
OLD | NEW |