| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef COMPONENTS_WEB_MODAL_NATIVE_WEB_CONTENTS_MODAL_DIALOG_MANAGER_H_ | 5 #ifndef COMPONENTS_WEB_MODAL_SINGLE_WEB_CONTENTS_DIALOG_MANAGER_H_ |
| 6 #define COMPONENTS_WEB_MODAL_NATIVE_WEB_CONTENTS_MODAL_DIALOG_MANAGER_H_ | 6 #define COMPONENTS_WEB_MODAL_SINGLE_WEB_CONTENTS_DIALOG_MANAGER_H_ |
| 7 | 7 |
| 8 #include "components/web_modal/native_web_contents_modal_dialog.h" | 8 #include "components/web_modal/native_web_contents_modal_dialog.h" |
| 9 | 9 |
| 10 namespace content { | 10 namespace content { |
| 11 class WebContents; | 11 class WebContents; |
| 12 } // namespace content | 12 } // namespace content |
| 13 | 13 |
| 14 namespace web_modal { | 14 namespace web_modal { |
| 15 | 15 |
| 16 class WebContentsModalDialogHost; | 16 class WebContentsModalDialogHost; |
| 17 | 17 |
| 18 // Interface from NativeWebContentsModalDialogManager to | 18 // Interface from SingleWebContentsDialogManager to |
| 19 // WebContentsModalDialogManager. | 19 // WebContentsModalDialogManager. |
| 20 class NativeWebContentsModalDialogManagerDelegate { | 20 class SingleWebContentsDialogManagerDelegate { |
| 21 public: | 21 public: |
| 22 NativeWebContentsModalDialogManagerDelegate() {} | 22 SingleWebContentsDialogManagerDelegate() {} |
| 23 virtual ~NativeWebContentsModalDialogManagerDelegate() {} | 23 virtual ~SingleWebContentsDialogManagerDelegate() {} |
| 24 | 24 |
| 25 virtual content::WebContents* GetWebContents() const = 0; | 25 virtual content::WebContents* GetWebContents() const = 0; |
| 26 | 26 |
| 27 // Notify the delegate that the dialog is closing. The native | 27 // Notify the delegate that the dialog is closing. The native |
| 28 // manager will be deleted before the end of this call. | 28 // manager will be deleted before the end of this call. |
| 29 virtual void WillClose(NativeWebContentsModalDialog dialog) = 0; | 29 virtual void WillClose(NativeWebContentsModalDialog dialog) = 0; |
| 30 | 30 |
| 31 private: | 31 private: |
| 32 DISALLOW_COPY_AND_ASSIGN(NativeWebContentsModalDialogManagerDelegate); | 32 DISALLOW_COPY_AND_ASSIGN(SingleWebContentsDialogManagerDelegate); |
| 33 }; | 33 }; |
| 34 | 34 |
| 35 // Provides an interface for platform-specific UI implementation for the web | 35 // Provides an interface for platform-specific UI implementation for the web |
| 36 // contents modal dialog. | 36 // contents modal dialog. |
| 37 // TODO(gbillock): perhaps rename to "SingleWebContentsDialogManager" | 37 class SingleWebContentsDialogManager { |
| 38 class NativeWebContentsModalDialogManager { | |
| 39 public: | 38 public: |
| 40 virtual ~NativeWebContentsModalDialogManager() {} | 39 virtual ~SingleWebContentsDialogManager() {} |
| 41 | 40 |
| 42 // Starts management of the modal aspects of the dialog. This function should | 41 // Starts management of the modal aspects of the dialog. This function should |
| 43 // also register to be notified when the dialog is closing, so that it can | 42 // also register to be notified when the dialog is closing, so that it can |
| 44 // notify the manager. | 43 // notify the manager. |
| 45 virtual void ManageDialog(NativeWebContentsModalDialog dialog) = 0; | 44 virtual void ManageDialog(NativeWebContentsModalDialog dialog) = 0; |
| 46 | 45 |
| 47 // Makes the web contents modal dialog visible. Only one web contents modal | 46 // Makes the web contents modal dialog visible. Only one web contents modal |
| 48 // dialog is shown at a time per tab. | 47 // dialog is shown at a time per tab. |
| 49 virtual void ShowDialog(NativeWebContentsModalDialog dialog) = 0; | 48 virtual void ShowDialog(NativeWebContentsModalDialog dialog) = 0; |
| 50 | 49 |
| 51 // Hides the web contents modal dialog without closing it. | 50 // Hides the web contents modal dialog without closing it. |
| 52 virtual void HideDialog(NativeWebContentsModalDialog dialog) = 0; | 51 virtual void HideDialog(NativeWebContentsModalDialog dialog) = 0; |
| 53 | 52 |
| 54 // Closes the web contents modal dialog. | 53 // Closes the web contents modal dialog. |
| 55 // If this method causes a WillClose() call to the delegate, the manager | 54 // If this method causes a WillClose() call to the delegate, the manager |
| 56 // will be deleted at the close of that invocation. | 55 // will be deleted at the close of that invocation. |
| 57 virtual void CloseDialog(NativeWebContentsModalDialog dialog) = 0; | 56 virtual void CloseDialog(NativeWebContentsModalDialog dialog) = 0; |
| 58 | 57 |
| 59 // Sets focus on the web contents modal dialog. | 58 // Sets focus on the web contents modal dialog. |
| 60 virtual void FocusDialog(NativeWebContentsModalDialog dialog) = 0; | 59 virtual void FocusDialog(NativeWebContentsModalDialog dialog) = 0; |
| 61 | 60 |
| 62 // Runs a pulse animation for the web contents modal dialog. | 61 // Runs a pulse animation for the web contents modal dialog. |
| 63 virtual void PulseDialog(NativeWebContentsModalDialog dialog) = 0; | 62 virtual void PulseDialog(NativeWebContentsModalDialog dialog) = 0; |
| 64 | 63 |
| 65 // Called when the host view for the dialog has changed. | 64 // Called when the host view for the dialog has changed. |
| 66 virtual void HostChanged(WebContentsModalDialogHost* new_host) = 0; | 65 virtual void HostChanged(WebContentsModalDialogHost* new_host) = 0; |
| 67 | 66 |
| 68 protected: | 67 protected: |
| 69 NativeWebContentsModalDialogManager() {} | 68 SingleWebContentsDialogManager() {} |
| 70 | 69 |
| 71 private: | 70 private: |
| 72 DISALLOW_COPY_AND_ASSIGN(NativeWebContentsModalDialogManager); | 71 DISALLOW_COPY_AND_ASSIGN(SingleWebContentsDialogManager); |
| 73 }; | 72 }; |
| 74 | 73 |
| 75 } // namespace web_modal | 74 } // namespace web_modal |
| 76 | 75 |
| 77 #endif // COMPONENTS_WEB_MODAL_NATIVE_WEB_CONTENTS_MODAL_DIALOG_MANAGER_H_ | 76 #endif // COMPONENTS_WEB_MODAL_SINGLE_WEB_CONTENTS_DIALOG_MANAGER_H_ |
| OLD | NEW |