#ifndef CHROME_BROWSER_UI_BLOCKED_CONTENT_POPUP_BLOCKER_TAB_HELPER_H_
#define CHROME_BROWSER_UI_BLOCKED_CONTENT_POPUP_BLOCKER_TAB_HELPER_H_
#include <map>
#include "base/id_map.h"
#include "chrome/browser/ui/blocked_content/blocked_window_params.h"
#include "content/public/browser/web_contents_observer.h"
#include "content/public/browser/web_contents_user_data.h"
namespace chrome {
struct NavigateParams;
}
namespace blink {
struct WebWindowFeatures;
}
class GURL;
class PopupBlockerTabHelper
: public content::WebContentsObserver,
public content::WebContentsUserData<PopupBlockerTabHelper> {
public:
typedef std::map<int32, GURL> PopupIdMap;
virtual ~PopupBlockerTabHelper();
bool MaybeBlockPopup(const chrome::NavigateParams& params,
const blink::WebWindowFeatures& window_features);
void AddBlockedPopup(const BlockedWindowParams& params);
void ShowBlockedPopup(int32 popup_id);
size_t GetBlockedPopupsCount() const;
PopupIdMap GetBlockedPopupRequests();
virtual void DidNavigateMainFrame(
const content::LoadCommittedDetails& details,
const content::FrameNavigateParams& params) OVERRIDE;
private:
struct BlockedRequest;
friend class content::WebContentsUserData<PopupBlockerTabHelper>;
explicit PopupBlockerTabHelper(content::WebContents* web_contents);
void PopupNotificationVisibilityChanged(bool visible);
IDMap<BlockedRequest, IDMapOwnPointer> blocked_popups_;
DISALLOW_COPY_AND_ASSIGN(PopupBlockerTabHelper);
};
#endif