Chromium Code Reviews| Index: chrome/browser/ui/webui/snippets_internals_message_handler.h |
| diff --git a/chrome/browser/ui/webui/snippets_internals_message_handler.h b/chrome/browser/ui/webui/snippets_internals_message_handler.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..b3c96a5153e93d5a4cac774a32cf40a0c94e5ebe |
| --- /dev/null |
| +++ b/chrome/browser/ui/webui/snippets_internals_message_handler.h |
| @@ -0,0 +1,53 @@ |
| +// Copyright 2015 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CHROME_BROWSER_UI_WEBUI_SNIPPETS_INTERNALS_MESSAGE_HANDLER_H_ |
| +#define CHROME_BROWSER_UI_WEBUI_SNIPPETS_INTERNALS_MESSAGE_HANDLER_H_ |
| + |
| +#include <string> |
| + |
| +#include "base/macros.h" |
| +#include "base/memory/scoped_ptr.h" |
|
Marc Treib
2016/04/13 08:45:51
We can use std::unique_ptr now (from <memory>)! Bu
jkrcal
2016/04/14 15:27:00
Done.
|
| +#include "base/memory/weak_ptr.h" |
| +#include "components/ntp_snippets/ntp_snippets_service.h" |
| +#include "content/public/browser/web_ui_message_handler.h" |
| + |
| +namespace base { |
| +class ListValue; |
| +} // namespace base |
| + |
| +// The implementation for the chrome://zine-internals page. |
|
Marc Treib
2016/04/13 08:45:51
snippets-internals
jkrcal
2016/04/14 15:27:00
Done.
|
| +class SnippetsInternalsMessageHandler |
| + : public content::WebUIMessageHandler, |
| + public ntp_snippets::NTPSnippetsServiceObserver { |
| + public: |
| + SnippetsInternalsMessageHandler(); |
| + ~SnippetsInternalsMessageHandler() override; |
| + |
| + // Send everytime the service loads a new set of data. |
| + void NTPSnippetsServiceLoaded() override; |
| + // Send when the service is shutting down. |
| + void NTPSnippetsServiceShutdown() override; |
|
Marc Treib
2016/04/13 08:45:51
These two can be private. It's common practice to
jkrcal
2016/04/14 15:27:00
Done.
|
| + |
| + private: |
| + // content::WebUIMessageHandler: |
| + void RegisterMessages() override; |
| + |
| + void HandleLoaded(const base::ListValue* args); |
| + void HandleClear(const base::ListValue* args); |
| + void HandleClearDiscarded(const base::ListValue* args); |
| + void HandleDownload(const base::ListValue* args); |
| + |
| + void SendInitialData(ntp_snippets::NTPSnippetsService* service); |
| + void SendSnippets(ntp_snippets::NTPSnippetsService* service); |
| + void SendDiscardedSnippets(ntp_snippets::NTPSnippetsService* service); |
| + void SendHosts(ntp_snippets::NTPSnippetsService* service); |
| + void SendJson(const std::string& json); |
| + void SendBoolean(const std::string& name, bool value); |
| + void SendString(const std::string& name, const std::string& value); |
| + |
| + DISALLOW_COPY_AND_ASSIGN(SnippetsInternalsMessageHandler); |
| +}; |
| + |
| +#endif // CHROME_BROWSER_UI_WEBUI_SNIPPETS_INTERNALS_MESSAGE_HANDLER_H_ |