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 #ifndef COMPONENTS_DOM_DISTILLER_WEBUI_DOM_DISTILLER_VIEWER_HANDLER_H_ |
| 6 #define COMPONENTS_DOM_DISTILLER_WEBUI_DOM_DISTILLER_VIEWER_HANDLER_H_ |
| 7 |
| 8 #include <vector> |
| 9 |
| 10 #include "base/memory/weak_ptr.h" |
| 11 #include "base/values.h" |
| 12 #include "content/public/browser/web_contents_observer.h" |
| 13 #include "content/public/browser/web_ui_message_handler.h" |
| 14 #include "url/gurl.h" |
| 15 |
| 16 namespace dom_distiller { |
| 17 |
| 18 class DistilledPageProto; |
| 19 class DomDistillerService; |
| 20 class ViewerHandle; |
| 21 |
| 22 // Handler class for DOM Distiller viewing operations. |
| 23 class DomDistillerViewerHandler : public content::WebUIMessageHandler, |
| 24 public content::WebContentsObserver { |
| 25 public: |
| 26 DomDistillerViewerHandler(const GURL& url, |
| 27 content::WebContents* web_contents); |
| 28 virtual ~DomDistillerViewerHandler(); |
| 29 |
| 30 // content::WebUIMessageHandler implementation. |
| 31 virtual void RegisterMessages() OVERRIDE; |
| 32 |
| 33 // content::WebContentsObserver implementation. |
| 34 virtual void DidFinishLoad( |
| 35 int64 frame_num, |
| 36 const GURL& validated_url, |
| 37 bool is_main_frame, |
| 38 content::RenderViewHost* render_view_host) OVERRIDE; |
| 39 virtual void 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) OVERRIDE; |
| 46 |
| 47 private: |
| 48 // Factory for the creating refs in callbacks. |
| 49 base::WeakPtrFactory<DomDistillerViewerHandler> weak_ptr_factory_; |
| 50 |
| 51 // The URL of the current WebUI. |
| 52 const GURL url_; |
| 53 |
| 54 DISALLOW_COPY_AND_ASSIGN(DomDistillerViewerHandler); |
| 55 }; |
| 56 |
| 57 } // namespace dom_distiller |
| 58 |
| 59 #endif // COMPONENTS_DOM_DISTILLER_WEBUI_DOM_DISTILLER_VIEWER_HANDLER_H_ |
OLD | NEW |