1 // Copyright (c) 2012 The Chromium Embedded Framework Authors. 2 // Portions copyright (c) 2012 The Chromium Authors. All rights reserved. 3 // Use of this source code is governed by a BSD-style license that can be 4 // found in the LICENSE file. 5 6 #ifndef CEF_LIBCEF_BROWSER_NATIVE_JAVASCRIPT_DIALOG_RUNNER_MAC_H_ 7 #define CEF_LIBCEF_BROWSER_NATIVE_JAVASCRIPT_DIALOG_RUNNER_MAC_H_ 8 #pragma once 9 10 #include "libcef/browser/javascript_dialog_runner.h" 11 12 #include "base/mac/scoped_nsobject.h" 13 #include "base/memory/weak_ptr.h" 14 15 #if __OBJC__ 16 @class CefJavaScriptDialogHelper; 17 #else 18 class CefJavaScriptDialogHelper; 19 #endif // __OBJC__ 20 21 class CefJavaScriptDialogRunnerMac : public CefJavaScriptDialogRunner { 22 public: 23 CefJavaScriptDialogRunnerMac(); 24 ~CefJavaScriptDialogRunnerMac() override; 25 26 // CefJavaScriptDialogRunner methods: 27 void Run(AlloyBrowserHostImpl* browser, 28 content::JavaScriptDialogType message_type, 29 const std::u16string& display_url, 30 const std::u16string& message_text, 31 const std::u16string& default_prompt_text, 32 DialogClosedCallback callback) override; 33 void Cancel() override; 34 35 // Callback from CefJavaScriptDialogHelper when the dialog is closed. 36 void DialogClosed(bool success, const std::u16string& user_input); 37 38 private: 39 DialogClosedCallback callback_; 40 41 base::scoped_nsobject<CefJavaScriptDialogHelper> helper_; 42 43 // Must be the last member. 44 base::WeakPtrFactory<CefJavaScriptDialogRunnerMac> weak_ptr_factory_; 45 }; 46 47 #endif // CEF_LIBCEF_BROWSER_NATIVE_JAVASCRIPT_DIALOG_RUNNER_MAC_H_ 48