| Index: components/web_modal/popup_manager.h
|
| diff --git a/components/web_modal/popup_manager.h b/components/web_modal/popup_manager.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..4c0e9bfbab1399216960041069687c484c0360bf
|
| --- /dev/null
|
| +++ b/components/web_modal/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_POPUP_MANAGER_H_
|
| +#define COMPONENTS_WEB_MODAL_POPUP_MANAGER_H_
|
| +
|
| +#include <deque>
|
| +
|
| +#include "base/memory/scoped_ptr.h"
|
| +#include "components/web_modal/single_popup_manager.h"
|
| +#include "content/public/browser/web_contents_user_data.h"
|
| +#include "ui/gfx/native_widget_types.h"
|
| +
|
| +namespace content {
|
| +struct FrameNavigateParams;
|
| +struct LoadCommittedDetails;
|
| +class WebContents;
|
| +}
|
| +
|
| +namespace web_modal {
|
| +
|
| +// Per-Browser class to manage popups (bubbles, web-modal dialogs).
|
| +class PopupManager : public SinglePopupManagerDelegate {
|
| + public:
|
| + PopupManager();
|
| +
|
| + virtual ~PopupManager();
|
| +
|
| + // Schedules a popup governed by the |manager| to be shown. The popup
|
| + // may be shown inline with this call, at a later time, or not at all.
|
| + void ShowPopup(scoped_ptr<SinglePopupManager> manager);
|
| +
|
| + // Returns true if any popups are active and not closed in the
|
| + // given |web_contents|.
|
| + bool IsPopupActive(const content::WebContents* web_contents) const;
|
| +
|
| + // Called by views code to re-activate popups anchored to a particular tab
|
| + // when that tab gets focus. Note that depending on the situation, more than
|
| + // one popup may actually be shown (depending on overlappability). The
|
| + // semantics are that the popups that would have been displayed had the tab
|
| + // never lost focus are re-displayed when focus is regained.
|
| + void FocusTopmostPopupForWebContentsIfActive(
|
| + const content::WebContents* web_contents);
|
| +
|
| + // Called when a NativePopup we own is about to be closed.
|
| + virtual void WillClose(NativePopup popup) OVERRIDE;
|
| +
|
| + private:
|
| + friend class PopupManagerTest;
|
| +
|
| + typedef std::deque<SinglePopupManager*> PopupList;
|
| +
|
| + // Utility function to get the state for a popup.
|
| + PopupList::iterator FindPopupState(NativePopup popup);
|
| +
|
| + // Blocks/unblocks interaction with renderer process.
|
| + void BlockWebContentsInteraction(bool blocked);
|
| +
|
| + void CloseAllPopups();
|
| +
|
| + // Notified from content::WebContentsObserver:
|
| + void DidNavigateMainFrame(
|
| + content::WebContents* web_contents,
|
| + const content::LoadCommittedDetails& details,
|
| + const content::FrameNavigateParams& params);
|
| + void DidGetIgnoredUIEvent(content::WebContents* web_contents);
|
| + void WasShown(content::WebContents* web_contents);
|
| + void WasHidden(content::WebContents* web_contents);
|
| + void WebContentsDestroyed(content::WebContents* web_contents);
|
| + void DidAttachInterstitialPage(content::WebContents* web_contents);
|
| +
|
| + // All active popups.
|
| + PopupList child_popups_;
|
| +
|
| + // True while closing all popups.
|
| + bool closing_all_popups_;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(PopupManager);
|
| +};
|
| +
|
| +} // namespace web_modal
|
| +
|
| +#endif // COMPONENTS_WEB_MODAL_POPUP_MANAGER_H_
|
|
|