| OLD | NEW |
| (Empty) |
| 1 // Copyright 2014 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 CHROME_BROWSER_UI_WEBUI_COPRESENCE_UI_HANDLER_H_ | |
| 6 #define CHROME_BROWSER_UI_WEBUI_COPRESENCE_UI_HANDLER_H_ | |
| 7 | |
| 8 #include "base/macros.h" | |
| 9 #include "components/copresence/public/copresence_observer.h" | |
| 10 #include "content/public/browser/web_ui_message_handler.h" | |
| 11 | |
| 12 namespace base { | |
| 13 class ListValue; | |
| 14 } | |
| 15 | |
| 16 namespace content { | |
| 17 class WebUI; | |
| 18 } | |
| 19 | |
| 20 namespace copresence { | |
| 21 class CopresenceState; | |
| 22 } | |
| 23 | |
| 24 // UI Handler for the copresence page. | |
| 25 // TODO(crbug.com/444263): Write tests. | |
| 26 class CopresenceUIHandler final : public content::WebUIMessageHandler, | |
| 27 public copresence::CopresenceObserver { | |
| 28 public: | |
| 29 explicit CopresenceUIHandler(content::WebUI* web_ui); | |
| 30 ~CopresenceUIHandler() override; | |
| 31 | |
| 32 private: | |
| 33 // WebUIMessageHandler override. | |
| 34 void RegisterMessages() override; | |
| 35 | |
| 36 // CopresenceObserver overrides. | |
| 37 void DirectivesUpdated() override; | |
| 38 void TokenTransmitted(const copresence::TransmittedToken& token) override; | |
| 39 void TokenReceived(const copresence::ReceivedToken& token) override; | |
| 40 | |
| 41 // Handler to populate the page with its initial state. | |
| 42 void HandlePopulateState(const base::ListValue* args); | |
| 43 | |
| 44 // Handler for the clear state button. | |
| 45 void HandleClearState(const base::ListValue* args); | |
| 46 | |
| 47 copresence::CopresenceState* state_; | |
| 48 | |
| 49 DISALLOW_COPY_AND_ASSIGN(CopresenceUIHandler); | |
| 50 }; | |
| 51 | |
| 52 #endif // CHROME_BROWSER_UI_WEBUI_COPRESENCE_UI_HANDLER_H_ | |
| OLD | NEW |