Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(90)

Unified Diff: ios/chrome/browser/web/blocked_popup_handler.h

Issue 2580333003: Upstream Chrome on iOS source code [10/11]. (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ios/chrome/browser/web/blocked_popup_handler.h
diff --git a/ios/chrome/browser/web/blocked_popup_handler.h b/ios/chrome/browser/web/blocked_popup_handler.h
new file mode 100644
index 0000000000000000000000000000000000000000..0f03aa5ec98ef52e01612ec96d90b3b64122f19c
--- /dev/null
+++ b/ios/chrome/browser/web/blocked_popup_handler.h
@@ -0,0 +1,68 @@
+// Copyright 2012 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 IOS_CHROME_BROWSER_WEB_BLOCKED_POPUP_HANDLER_H_
+#define IOS_CHROME_BROWSER_WEB_BLOCKED_POPUP_HANDLER_H_
+
+#import <UIKit/UIKit.h>
+#include <vector>
+
+#include "base/macros.h"
+#include "base/scoped_observer.h"
+#include "components/infobars/core/infobar_manager.h"
+#include "ios/web/web_state/blocked_popup_info.h"
+#include "url/gurl.h"
+
+namespace ios {
+class ChromeBrowserState;
+}
+
+@protocol BlockedPopupHandlerDelegate;
+
+// Handles blocked popups. Will display an infobar informing the user and
+// allowing the user to add an exception and navigate to the site.
+class BlockedPopupHandler : public infobars::InfoBarManager::Observer {
+ public:
+ explicit BlockedPopupHandler(ios::ChromeBrowserState* browser_state);
+ ~BlockedPopupHandler() override;
+
+ void SetDelegate(id<BlockedPopupHandlerDelegate> delegate);
+
+ // Show the popup blocker infobar for the given popup.
+ void HandlePopup(const web::BlockedPopupInfo& blocked_popup_info);
+
+ // infobars::InfoBarManager::Observer implementation.
+ void OnInfoBarRemoved(infobars::InfoBar* infobar, bool animate) override;
+ void OnManagerShuttingDown(
+ infobars::InfoBarManager* infobar_manager) override;
+
+ private:
+ // Show the infobar for the current popups. Will also handle replacing an
+ // existing infobar with the updated count.
+ void ShowInfoBar();
+
+ // The user browser state.
+ ios::ChromeBrowserState* browser_state_;
+ // The delegate that will display the infobar.
+ id<BlockedPopupHandlerDelegate> delegate_;
+ // The currently displayed infobar.
+ infobars::InfoBar* infobar_;
+ // The popups to open.
+ std::vector<web::BlockedPopupInfo> popups_;
+ // For management of infobars::InfoBarManager::Observer registration.
+ ScopedObserver<infobars::InfoBarManager, infobars::InfoBarManager::Observer>
+ scoped_observer_;
+
+ DISALLOW_COPY_AND_ASSIGN(BlockedPopupHandler);
+};
+
+// Methods implemented by the delegate of the BlockedPopupHandler.
+@protocol BlockedPopupHandlerDelegate
+
+// Returns the infobars::InfoBarManager.
+- (infobars::InfoBarManager*)infoBarManager;
+
+@end
+
+#endif // IOS_CHROME_BROWSER_WEB_BLOCKED_POPUP_HANDLER_H_
« no previous file with comments | « ios/chrome/browser/web/auto_reload_controller_unittest.mm ('k') | ios/chrome/browser/web/blocked_popup_handler.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698