| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef COMPONENTS_DOM_DISTILLER_WEBUI_DOM_DISTILLER_HANDLER_H_ | 5 #ifndef COMPONENTS_DOM_DISTILLER_WEBUI_DOM_DISTILLER_HANDLER_H_ |
| 6 #define COMPONENTS_DOM_DISTILLER_WEBUI_DOM_DISTILLER_HANDLER_H_ | 6 #define COMPONENTS_DOM_DISTILLER_WEBUI_DOM_DISTILLER_HANDLER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
| 11 #include "base/values.h" | 11 #include "base/values.h" |
| 12 #include "content/public/browser/web_ui_message_handler.h" | 12 #include "content/public/browser/web_ui_message_handler.h" |
| 13 | 13 |
| 14 namespace dom_distiller { | 14 namespace dom_distiller { |
| 15 | 15 |
| 16 class DomDistillerService; | 16 class DomDistillerService; |
| 17 | 17 |
| 18 // Handler class for DOM Distiller list operations. | 18 // Handler class for DOM Distiller list operations. |
| 19 class DomDistillerHandler : public content::WebUIMessageHandler { | 19 class DomDistillerHandler : public content::WebUIMessageHandler { |
| 20 public: | 20 public: |
| 21 // The lifetime of |service| has to outlive this handler. | 21 // The lifetime of |service| has to outlive this handler. |
| 22 DomDistillerHandler(DomDistillerService* service, const std::string& scheme); | 22 DomDistillerHandler(DomDistillerService* service, const std::string& scheme); |
| 23 virtual ~DomDistillerHandler(); | 23 virtual ~DomDistillerHandler(); |
| 24 | 24 |
| 25 // content::WebUIMessageHandler implementation. | 25 // content::WebUIMessageHandler implementation. |
| 26 virtual void RegisterMessages() OVERRIDE; | 26 virtual void RegisterMessages() override; |
| 27 | 27 |
| 28 // Callback from JavaScript for the "requestEntries" message. This | 28 // Callback from JavaScript for the "requestEntries" message. This |
| 29 // requests the list of entries and returns it to the front end by calling | 29 // requests the list of entries and returns it to the front end by calling |
| 30 // "onReceivedEntries". There are no JavaScript arguments to this method. | 30 // "onReceivedEntries". There are no JavaScript arguments to this method. |
| 31 void HandleRequestEntries(const base::ListValue* args); | 31 void HandleRequestEntries(const base::ListValue* args); |
| 32 | 32 |
| 33 // Callback from JavaScript for when an article should be added. The first | 33 // Callback from JavaScript for when an article should be added. The first |
| 34 // element in |args| should be a string representing the URL to be added. | 34 // element in |args| should be a string representing the URL to be added. |
| 35 void HandleAddArticle(const base::ListValue* args); | 35 void HandleAddArticle(const base::ListValue* args); |
| 36 | 36 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 55 | 55 |
| 56 // Factory for the creating refs in callbacks. | 56 // Factory for the creating refs in callbacks. |
| 57 base::WeakPtrFactory<DomDistillerHandler> weak_ptr_factory_; | 57 base::WeakPtrFactory<DomDistillerHandler> weak_ptr_factory_; |
| 58 | 58 |
| 59 DISALLOW_COPY_AND_ASSIGN(DomDistillerHandler); | 59 DISALLOW_COPY_AND_ASSIGN(DomDistillerHandler); |
| 60 }; | 60 }; |
| 61 | 61 |
| 62 } // namespace dom_distiller | 62 } // namespace dom_distiller |
| 63 | 63 |
| 64 #endif // COMPONENTS_DOM_DISTILLER_WEBUI_DOM_DISTILLER_HANDLER_H_ | 64 #endif // COMPONENTS_DOM_DISTILLER_WEBUI_DOM_DISTILLER_HANDLER_H_ |
| OLD | NEW |