1
    2
    3
    4
    5
    6
    7
    8
    9
   10
   11
   12
   13
   14
   15
   16
   17
   18
   19
   20
   21
   22
   23
   24
   25
   26
   27
   28
   29
   30
   31
   32
   33
   34
   35
   36
   37
   38
   39
   40
   41
   42
   43
   44
   45
   46
   47
   48
   49

content / web_test / browser / web_test_fedcm_manager.h [blame]

// Copyright 2023 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CONTENT_WEB_TEST_BROWSER_WEB_TEST_FEDCM_MANAGER_H_
#define CONTENT_WEB_TEST_BROWSER_WEB_TEST_FEDCM_MANAGER_H_

#include "base/memory/weak_ptr.h"
#include "third_party/blink/public/mojom/webid/federated_auth_request_automation.mojom.h"

namespace content {

class FederatedAuthRequestImpl;
class RenderFrameHost;
class RenderFrameHostImpl;

class WebTestFedCmManager
    : public blink::test::mojom::FederatedAuthRequestAutomation {
 public:
  explicit WebTestFedCmManager(RenderFrameHost* render_frame_host);

  WebTestFedCmManager(const WebTestFedCmManager&) = delete;
  WebTestFedCmManager& operator=(const WebTestFedCmManager&) = delete;

  ~WebTestFedCmManager() override;

  // blink::test::mojom::FederatedAuthRequestAutomation
  void GetDialogType(
      blink::test::mojom::FederatedAuthRequestAutomation::GetDialogTypeCallback)
      override;
  void GetFedCmDialogTitle(blink::test::mojom::FederatedAuthRequestAutomation::
                               GetFedCmDialogTitleCallback) override;
  void SelectFedCmAccount(uint32_t account_index,
                          SelectFedCmAccountCallback) override;
  void DismissFedCmDialog(DismissFedCmDialogCallback) override;
  void ClickFedCmDialogButton(blink::test::mojom::DialogButton button,
                              ClickFedCmDialogButtonCallback) override;

 private:
  // Returns the active FederatedAuthRequestImpl for the current Page,
  // or nullptr if there isn't one.
  FederatedAuthRequestImpl* GetAuthRequestImpl();

  base::WeakPtr<RenderFrameHostImpl> render_frame_host_;
};

}  // namespace content

#endif  // CONTENT_WEB_TEST_BROWSER_WEB_TEST_FEDCM_MANAGER_H_