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.
5 #ifndef CHROME_BROWSER_UI_WEBUI_COPRESENCE_UI_HANDLER_H_
6 #define CHROME_BROWSER_UI_WEBUI_COPRESENCE_UI_HANDLER_H_
8 #include "base/macros.h"
9 #include "components/copresence/public/copresence_observer.h"
10 #include "content/public/browser/web_ui_message_handler.h"
20 namespace copresence
{
21 class CopresenceState
;
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
{
29 explicit CopresenceUIHandler(content::WebUI
* web_ui
);
30 ~CopresenceUIHandler() override
;
33 // WebUIMessageHandler override.
34 void RegisterMessages() override
;
36 // CopresenceObserver overrides.
37 void DirectivesUpdated() override
;
38 void TokenTransmitted(const copresence::TransmittedToken
& token
) override
;
39 void TokenReceived(const copresence::ReceivedToken
& token
) override
;
41 // Handler to populate the page with its initial state.
42 void HandlePopulateState(const base::ListValue
* args
);
44 // Handler for the clear state button.
45 void HandleClearState(const base::ListValue
* args
);
47 copresence::CopresenceState
* state_
;
49 DISALLOW_COPY_AND_ASSIGN(CopresenceUIHandler
);
52 #endif // CHROME_BROWSER_UI_WEBUI_COPRESENCE_UI_HANDLER_H_