Chromium Code Reviews| Index: components/web_modal/single_popup_manager.h |
| diff --git a/components/web_modal/single_popup_manager.h b/components/web_modal/single_popup_manager.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..bfd52ebe13b8ed0db22f744518a05cc9487718ea |
| --- /dev/null |
| +++ b/components/web_modal/single_popup_manager.h |
| @@ -0,0 +1,84 @@ |
| +// Copyright 2014 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef COMPONENTS_WEB_MODAL_SINGLE_POPUP_MANAGER_H_ |
| +#define COMPONENTS_WEB_MODAL_SINGLE_POPUP_MANAGER_H_ |
| + |
| +#include "components/web_modal/native_web_contents_modal_dialog.h" |
| + |
| +namespace content { |
| +class WebContents; |
| +} |
| + |
| +namespace web_modal { |
| + |
| +// Interface from SinglePopupManager to PopupManager. |
| +class SinglePopupManagerDelegate { |
| + public: |
| + SinglePopupManagerDelegate() {} |
| + virtual ~SinglePopupManagerDelegate() {} |
|
Finnur
2014/05/16 12:38:14
nit: Move these impls to .cc
|
| + |
| + // Notify the delegate that the dialog is closing. The native |
| + // manager will be deleted before the end of this call. |
|
Finnur
2014/05/16 12:38:14
The term native manager is a little lost in this c
|
| + virtual void WillClose(NativePopup popup) = 0; |
| + |
| + private: |
| + DISALLOW_COPY_AND_ASSIGN(SinglePopupManagerDelegate); |
| +}; |
| + |
| +// Provides an interface for platform-specific UI implementation for popups. |
| +// Each object will manage a single NativePopup window during its lifecycle. |
| +// |
| +// Implementation classes should accept a NativePopup at construction time |
| +// and register to be notified when the dialog is closing, so that it can |
| +// notify its delegate (WillClose method). |
| +class SinglePopupManager { |
| + public: |
| + virtual ~SinglePopupManager() {} |
| + |
| + // If the manager returns non-null to this call, it is bound to a particular |
| + // tab and will be hidden and shown if that tab visibility changes. |
| + virtual content::WebContents* IsBoundToWebContents() = 0; |
|
Mike Wittman
2014/05/16 20:35:40
GetBoundWebContents? IsBoundWebContents is odd for
msw
2014/05/22 04:08:45
I agree with Mike's comment here, can you try to a
Greg Billock
2014/05/22 18:25:47
Yeah, I've been focusing more on the PopupManager
|
| + |
| + // Makes the popup visible. Only one popup will be shown at a time per tab. |
| + // (Unless there's an overlappable popup.) |
| + virtual void Show() = 0; |
| + |
| + // Hides the popup without closing it. |
| + virtual void Hide() = 0; |
| + |
| + // Closes the popup. |
| + // If this method causes a WillClose() call to the delegate, the manager |
|
Mike Wittman
2014/05/16 20:35:40
This comment is misleading, both here and in the S
Greg Billock
2014/05/22 18:25:47
I noticed that too reading this over. Changing.
A
Mike Wittman
2014/05/23 19:02:34
I don't see a better way to do this off-hand. In t
|
| + // will be deleted at the close of that invocation. |
| + virtual void Close() = 0; |
| + |
| + // Sets focus on the popup. |
| + virtual void Focus() = 0; |
| + |
| + virtual void Pulse() = 0; |
| + |
| + // Returns the popup under management by this object. |
| + virtual NativePopup popup() = 0; |
| + |
| + // Returns true if the popup under management was initiated by a user |
| + // gesture. When this is true, the popup manager will hide any existing |
| + // popups and move the newly-created NativePopup to the top of the display |
| + // queue. |
| + virtual bool HasUserGesture() = 0; |
| + |
| + // Returns true if the popup under management is tolerant of being overlapped |
| + // by other popups. This may be true for large web-modals which cover most of |
| + // the window real estate (e.g. print preview). |
| + virtual bool MayBeOverlapped() = 0; |
| + |
| + protected: |
| + SinglePopupManager() {} |
|
Finnur
2014/05/16 12:38:14
nit: Move to .cc
|
| + |
| + private: |
| + DISALLOW_COPY_AND_ASSIGN(SinglePopupManager); |
| +}; |
| + |
| +} // namespace web_modal |
| + |
| +#endif // COMPONENTS_WEB_MODAL_SINGLE_POPUP_MANAGER_H_ |