test_web_contents_modal_dialog_host.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. // Copyright 2013 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. #ifndef COMPONENTS_WEB_MODAL_TEST_WEB_CONTENTS_MODAL_DIALOG_HOST_H_
  5. #define COMPONENTS_WEB_MODAL_TEST_WEB_CONTENTS_MODAL_DIALOG_HOST_H_
  6. #include "components/web_modal/web_contents_modal_dialog_host.h"
  7. #include "base/compiler_specific.h"
  8. #include "ui/gfx/geometry/size.h"
  9. #include "ui/gfx/native_widget_types.h"
  10. namespace web_modal {
  11. class TestWebContentsModalDialogHost : public WebContentsModalDialogHost {
  12. public:
  13. explicit TestWebContentsModalDialogHost(gfx::NativeView host_view);
  14. TestWebContentsModalDialogHost(const TestWebContentsModalDialogHost&) =
  15. delete;
  16. TestWebContentsModalDialogHost& operator=(
  17. const TestWebContentsModalDialogHost&) = delete;
  18. ~TestWebContentsModalDialogHost() override;
  19. // WebContentsModalDialogHost:
  20. gfx::Size GetMaximumDialogSize() override;
  21. gfx::NativeView GetHostView() const override;
  22. gfx::Point GetDialogPosition(const gfx::Size& size) override;
  23. void AddObserver(ModalDialogHostObserver* observer) override;
  24. void RemoveObserver(ModalDialogHostObserver* observer) override;
  25. void set_max_dialog_size(const gfx::Size& max_dialog_size) {
  26. max_dialog_size_ = max_dialog_size;
  27. }
  28. private:
  29. gfx::NativeView host_view_;
  30. gfx::Size max_dialog_size_;
  31. };
  32. } // namespace web_modal
  33. #endif // COMPONENTS_WEB_MODAL_TEST_WEB_CONTENTS_MODAL_DIALOG_HOST_H_