| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 CHROME_BROWSER_UI_WEBUI_SNIPPETS_INTERNALS_MESSAGE_HANDLER_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_SNIPPETS_INTERNALS_MESSAGE_HANDLER_H_ |
| 6 #define CHROME_BROWSER_UI_WEBUI_SNIPPETS_INTERNALS_MESSAGE_HANDLER_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_SNIPPETS_INTERNALS_MESSAGE_HANDLER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 | 27 |
| 28 private: | 28 private: |
| 29 // content::WebUIMessageHandler: | 29 // content::WebUIMessageHandler: |
| 30 void RegisterMessages() override; | 30 void RegisterMessages() override; |
| 31 | 31 |
| 32 // ntp_snippets::NTPSnippetsServiceObserver: | 32 // ntp_snippets::NTPSnippetsServiceObserver: |
| 33 // Send everytime the service loads a new set of data. | 33 // Send everytime the service loads a new set of data. |
| 34 void NTPSnippetsServiceLoaded() override; | 34 void NTPSnippetsServiceLoaded() override; |
| 35 // Send when the service is shutting down. | 35 // Send when the service is shutting down. |
| 36 void NTPSnippetsServiceShutdown() override; | 36 void NTPSnippetsServiceShutdown() override; |
| 37 // Sent every time the service has its data sources cleared. |
| 38 void NTPSnippetsServiceCleared() override; |
| 37 | 39 |
| 38 void HandleLoaded(const base::ListValue* args); | 40 void HandleLoaded(const base::ListValue* args); |
| 39 void HandleClear(const base::ListValue* args); | 41 void HandleClear(const base::ListValue* args); |
| 40 void HandleDump(const base::ListValue* args); | 42 void HandleDump(const base::ListValue* args); |
| 41 void HandleClearDiscarded(const base::ListValue* args); | 43 void HandleClearDiscarded(const base::ListValue* args); |
| 42 void HandleDownload(const base::ListValue* args); | 44 void HandleDownload(const base::ListValue* args); |
| 43 | 45 |
| 44 void SendInitialData(); | 46 void SendInitialData(); |
| 45 void SendSnippets(); | 47 void SendSnippets(); |
| 46 void SendDiscardedSnippets(); | 48 void SendDiscardedSnippets(); |
| 47 void SendHosts(); | 49 void SendHosts(); |
| 48 void SendJson(const std::string& json); | 50 void SendJson(const std::string& json); |
| 49 void SendBoolean(const std::string& name, bool value); | 51 void SendBoolean(const std::string& name, bool value); |
| 50 void SendString(const std::string& name, const std::string& value); | 52 void SendString(const std::string& name, const std::string& value); |
| 51 | 53 |
| 52 ScopedObserver<ntp_snippets::NTPSnippetsService, | 54 ScopedObserver<ntp_snippets::NTPSnippetsService, |
| 53 ntp_snippets::NTPSnippetsServiceObserver> observer_; | 55 ntp_snippets::NTPSnippetsServiceObserver> observer_; |
| 54 | 56 |
| 55 // Tracks whether we can already send messages to the page. | 57 // Tracks whether we can already send messages to the page. |
| 56 bool dom_loaded_; | 58 bool dom_loaded_; |
| 57 | 59 |
| 58 ntp_snippets::NTPSnippetsService* ntp_snippets_service_; | 60 ntp_snippets::NTPSnippetsService* ntp_snippets_service_; |
| 59 | 61 |
| 60 DISALLOW_COPY_AND_ASSIGN(SnippetsInternalsMessageHandler); | 62 DISALLOW_COPY_AND_ASSIGN(SnippetsInternalsMessageHandler); |
| 61 }; | 63 }; |
| 62 | 64 |
| 63 #endif // CHROME_BROWSER_UI_WEBUI_SNIPPETS_INTERNALS_MESSAGE_HANDLER_H_ | 65 #endif // CHROME_BROWSER_UI_WEBUI_SNIPPETS_INTERNALS_MESSAGE_HANDLER_H_ |
| OLD | NEW |