1 // Copyright (c) 2012 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 5 #ifndef COMPONENTS_WEB_MODAL_NATIVE_WEB_CONTENTS_MODAL_DIALOG_MANAGER_H_ 6 #define COMPONENTS_WEB_MODAL_NATIVE_WEB_CONTENTS_MODAL_DIALOG_MANAGER_H_ 7 8 #include "components/web_modal/native_web_contents_modal_dialog.h" 9 10 namespace content { 11 class WebContents; 12 } // namespace content 13 14 namespace web_modal { 15 16 class WebContentsModalDialogHost; 17 18 // Interface from NativeWebContentsModalDialogManager to 19 // WebContentsModalDialogManager. 20 class NativeWebContentsModalDialogManagerDelegate { 21 public: NativeWebContentsModalDialogManagerDelegate()22 NativeWebContentsModalDialogManagerDelegate() {} ~NativeWebContentsModalDialogManagerDelegate()23 virtual ~NativeWebContentsModalDialogManagerDelegate() {} 24 25 virtual content::WebContents* GetWebContents() const = 0; 26 virtual void WillClose(NativeWebContentsModalDialog dialog) = 0; 27 28 private: 29 DISALLOW_COPY_AND_ASSIGN(NativeWebContentsModalDialogManagerDelegate); 30 }; 31 32 // Provides an interface for platform-specific UI implementation for the web 33 // contents modal dialog. 34 class NativeWebContentsModalDialogManager { 35 public: ~NativeWebContentsModalDialogManager()36 virtual ~NativeWebContentsModalDialogManager() {} 37 38 // Starts management of the modal aspects of the dialog. This function should 39 // also register to be notified when the dialog is closing, so that it can 40 // notify the manager. 41 virtual void ManageDialog(NativeWebContentsModalDialog dialog) = 0; 42 43 // Makes the web contents modal dialog visible. Only one web contents modal 44 // dialog is shown at a time per tab. 45 virtual void ShowDialog(NativeWebContentsModalDialog dialog) = 0; 46 47 // Hides the web contents modal dialog without closing it. 48 virtual void HideDialog(NativeWebContentsModalDialog dialog) = 0; 49 50 // Closes the web contents modal dialog. 51 virtual void CloseDialog(NativeWebContentsModalDialog dialog) = 0; 52 53 // Sets focus on the web contents modal dialog. 54 virtual void FocusDialog(NativeWebContentsModalDialog dialog) = 0; 55 56 // Runs a pulse animation for the web contents modal dialog. 57 virtual void PulseDialog(NativeWebContentsModalDialog dialog) = 0; 58 59 // Called when the host view for the dialog has changed. 60 virtual void HostChanged(WebContentsModalDialogHost* new_host) = 0; 61 62 protected: NativeWebContentsModalDialogManager()63 NativeWebContentsModalDialogManager() {} 64 65 private: 66 DISALLOW_COPY_AND_ASSIGN(NativeWebContentsModalDialogManager); 67 }; 68 69 } // namespace web_modal 70 71 #endif // COMPONENTS_WEB_MODAL_NATIVE_WEB_CONTENTS_MODAL_DIALOG_MANAGER_H_ 72