javascript_tab_modal_dialog_manager_delegate_android.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. // Copyright 2020 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 WEBLAYER_BROWSER_JAVASCRIPT_TAB_MODAL_DIALOG_MANAGER_DELEGATE_ANDROID_H_
  5. #define WEBLAYER_BROWSER_JAVASCRIPT_TAB_MODAL_DIALOG_MANAGER_DELEGATE_ANDROID_H_
  6. #include "base/memory/raw_ptr.h"
  7. #include "components/javascript_dialogs/tab_modal_dialog_manager_delegate.h"
  8. namespace content {
  9. class WebContents;
  10. }
  11. namespace weblayer {
  12. class JavaScriptTabModalDialogManagerDelegateAndroid
  13. : public javascript_dialogs::TabModalDialogManagerDelegate {
  14. public:
  15. explicit JavaScriptTabModalDialogManagerDelegateAndroid(
  16. content::WebContents* web_contents);
  17. JavaScriptTabModalDialogManagerDelegateAndroid(
  18. const JavaScriptTabModalDialogManagerDelegateAndroid& other) = delete;
  19. JavaScriptTabModalDialogManagerDelegateAndroid& operator=(
  20. const JavaScriptTabModalDialogManagerDelegateAndroid& other) = delete;
  21. ~JavaScriptTabModalDialogManagerDelegateAndroid() override;
  22. // javascript_dialogs::TabModalDialogManagerDelegate
  23. base::WeakPtr<javascript_dialogs::TabModalDialogView> CreateNewDialog(
  24. content::WebContents* alerting_web_contents,
  25. const std::u16string& title,
  26. content::JavaScriptDialogType dialog_type,
  27. const std::u16string& message_text,
  28. const std::u16string& default_prompt_text,
  29. content::JavaScriptDialogManager::DialogClosedCallback dialog_callback,
  30. base::OnceClosure dialog_closed_callback) override;
  31. void WillRunDialog() override;
  32. void DidCloseDialog() override;
  33. void SetTabNeedsAttention(bool attention) override;
  34. bool IsWebContentsForemost() override;
  35. bool IsApp() override;
  36. private:
  37. raw_ptr<content::WebContents> web_contents_;
  38. };
  39. } // namespace weblayer
  40. #endif // WEBLAYER_BROWSER_JAVASCRIPT_TAB_MODAL_DIALOG_MANAGER_DELEGATE_ANDROID_H_