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" |
(...skipping 11 matching lines...) Expand all Loading... |
22 DomDistillerHandler(DomDistillerService* service, | 22 DomDistillerHandler(DomDistillerService* service, |
23 const std::string& scheme); | 23 const std::string& scheme); |
24 virtual ~DomDistillerHandler(); | 24 virtual ~DomDistillerHandler(); |
25 | 25 |
26 // content::WebUIMessageHandler implementation. | 26 // content::WebUIMessageHandler implementation. |
27 virtual void RegisterMessages() OVERRIDE; | 27 virtual void RegisterMessages() OVERRIDE; |
28 | 28 |
29 // Callback from JavaScript for the "requestEntries" message. This | 29 // Callback from JavaScript for the "requestEntries" message. This |
30 // requests the list of entries and returns it to the front end by calling | 30 // requests the list of entries and returns it to the front end by calling |
31 // "onReceivedEntries". There are no JavaScript arguments to this method. | 31 // "onReceivedEntries". There are no JavaScript arguments to this method. |
32 void HandleRequestEntries(const ListValue* args); | 32 void HandleRequestEntries(const base::ListValue* args); |
33 | 33 |
34 // Callback from JavaScript for when an article should be added. The first | 34 // Callback from JavaScript for when an article should be added. The first |
35 // element in |args| should be a string representing the URL to be added. | 35 // element in |args| should be a string representing the URL to be added. |
36 void HandleAddArticle(const ListValue* args); | 36 void HandleAddArticle(const base::ListValue* args); |
37 | 37 |
38 // Callback from JavaScript for when an article is selected. The first element | 38 // Callback from JavaScript for when an article is selected. The first element |
39 // in |args| should be a string representing the ID of the entry to be | 39 // in |args| should be a string representing the ID of the entry to be |
40 // selected. | 40 // selected. |
41 void HandleSelectArticle(const ListValue* args); | 41 void HandleSelectArticle(const base::ListValue* args); |
42 | 42 |
43 private: | 43 private: |
44 // Callback from DomDistillerService when an article is available. | 44 // Callback from DomDistillerService when an article is available. |
45 void OnArticleAdded(bool article_available); | 45 void OnArticleAdded(bool article_available); |
46 | 46 |
47 // The DomDistillerService. | 47 // The DomDistillerService. |
48 DomDistillerService* service_; | 48 DomDistillerService* service_; |
49 | 49 |
50 // The scheme for DOM distiller articles. | 50 // The scheme for DOM distiller articles. |
51 std::string article_scheme_; | 51 std::string article_scheme_; |
52 | 52 |
53 // Factory for the creating refs in callbacks. | 53 // Factory for the creating refs in callbacks. |
54 base::WeakPtrFactory<DomDistillerHandler> weak_ptr_factory_; | 54 base::WeakPtrFactory<DomDistillerHandler> weak_ptr_factory_; |
55 | 55 |
56 DISALLOW_COPY_AND_ASSIGN(DomDistillerHandler); | 56 DISALLOW_COPY_AND_ASSIGN(DomDistillerHandler); |
57 }; | 57 }; |
58 | 58 |
59 } // namespace dom_distiller | 59 } // namespace dom_distiller |
60 | 60 |
61 #endif // COMPONENTS_DOM_DISTILLER_WEBUI_DOM_DISTILLER_HANDLER_H_ | 61 #endif // COMPONENTS_DOM_DISTILLER_WEBUI_DOM_DISTILLER_HANDLER_H_ |
OLD | NEW |