Updating trunk VERSION from 2139.0 to 2140.0
[chromium-blink-merge.git] / components / web_modal / single_web_contents_dialog_manager.h
blob35ef0e3b02e2b4f993c0940e34cb659fc0b03000
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
3 // found in the LICENSE file.
5 #ifndef COMPONENTS_WEB_MODAL_SINGLE_WEB_CONTENTS_DIALOG_MANAGER_H_
6 #define COMPONENTS_WEB_MODAL_SINGLE_WEB_CONTENTS_DIALOG_MANAGER_H_
8 #include "components/web_modal/native_web_contents_modal_dialog.h"
10 namespace content {
11 class WebContents;
12 } // namespace content
14 namespace web_modal {
16 class WebContentsModalDialogHost;
18 // Interface from SingleWebContentsDialogManager to
19 // WebContentsModalDialogManager.
20 class SingleWebContentsDialogManagerDelegate {
21 public:
22 SingleWebContentsDialogManagerDelegate() {}
23 virtual ~SingleWebContentsDialogManagerDelegate() {}
25 virtual content::WebContents* GetWebContents() const = 0;
27 // Notify the delegate that the dialog is closing. The native
28 // manager will be deleted before the end of this call.
29 virtual void WillClose(NativeWebContentsModalDialog dialog) = 0;
31 private:
32 DISALLOW_COPY_AND_ASSIGN(SingleWebContentsDialogManagerDelegate);
35 // Provides an interface for platform-specific UI implementation for the web
36 // contents modal dialog. Each object will manage a single
37 // NativeWebContentsModalDialog during its lifecycle.
39 // Implementation classes should accept a NativeWebContentsModalDialog at
40 // construction time and register to be notified when the dialog is closing,
41 // so that it can notify its delegate (WillClose method).
42 class SingleWebContentsDialogManager {
43 public:
44 virtual ~SingleWebContentsDialogManager() {}
46 // Makes the web contents modal dialog visible. Only one web contents modal
47 // dialog is shown at a time per tab.
48 virtual void Show() = 0;
50 // Hides the web contents modal dialog without closing it.
51 virtual void Hide() = 0;
53 // Closes the web contents modal dialog.
54 // If this method causes a WillClose() call to the delegate, the manager
55 // will be deleted at the close of that invocation.
56 virtual void Close() = 0;
58 // Sets focus on the web contents modal dialog.
59 virtual void Focus() = 0;
61 // Runs a pulse animation for the web contents modal dialog.
62 virtual void Pulse() = 0;
64 // Called when the host view for the dialog has changed.
65 virtual void HostChanged(WebContentsModalDialogHost* new_host) = 0;
67 // Return the dialog under management by this object.
68 virtual NativeWebContentsModalDialog dialog() = 0;
70 protected:
71 SingleWebContentsDialogManager() {}
73 private:
74 DISALLOW_COPY_AND_ASSIGN(SingleWebContentsDialogManager);
77 } // namespace web_modal
79 #endif // COMPONENTS_WEB_MODAL_SINGLE_WEB_CONTENTS_DIALOG_MANAGER_H_