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

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

Issue 2640463002: [ios] Convert BlockedPopupHandler into a tab helper class. (Closed)
Patch Set: Created 3 years, 11 months 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
« no previous file with comments | « ios/chrome/browser/tabs/tab.mm ('k') | ios/chrome/browser/web/blocked_popup_handler.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
index 0f03aa5ec98ef52e01612ec96d90b3b64122f19c..1de501484592c49468e376938a19988fb90cdd76 100644
--- a/ios/chrome/browser/web/blocked_popup_handler.h
+++ b/ios/chrome/browser/web/blocked_popup_handler.h
@@ -11,23 +11,21 @@
#include "base/macros.h"
#include "base/scoped_observer.h"
#include "components/infobars/core/infobar_manager.h"
+#include "ios/web/public/web_state/web_state_user_data.h"
Eugene But (OOO till 7-30) 2017/01/17 18:04:53 nit: s/include/import
rohitrao (ping after 24h) 2017/01/17 21:49:29 I thought there was a presubmit that would have ca
Eugene But (OOO till 7-30) 2017/01/17 22:10:21 Still on review :( https://codereview.chromium.org
#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 {
+class BlockedPopupHandler : public infobars::InfoBarManager::Observer,
+ public web::WebStateUserData<BlockedPopupHandler> {
public:
- explicit BlockedPopupHandler(ios::ChromeBrowserState* browser_state);
+ static void CreateForWebState(web::WebState* web_state);
Eugene But (OOO till 7-30) 2017/01/17 18:04:53 Do you actually need this method? WebStateUserData
rohitrao (ping after 24h) 2017/01/17 21:49:29 Done.
~BlockedPopupHandler() override;
- void SetDelegate(id<BlockedPopupHandlerDelegate> delegate);
+ // Initalizes this BlockedPopupHandler. Must be called after all tab helpers
Eugene But (OOO till 7-30) 2017/01/17 18:04:53 Would Sylvain's proposal work for you? Alternative
rohitrao (ping after 24h) 2017/01/17 21:49:29 Sylvain's suggestion allows me to sidestep this is
+ // have been created.
+ void Initialize();
// Show the popup blocker infobar for the given popup.
void HandlePopup(const web::BlockedPopupInfo& blocked_popup_info);
@@ -38,14 +36,14 @@ class BlockedPopupHandler : public infobars::InfoBarManager::Observer {
infobars::InfoBarManager* infobar_manager) override;
private:
+ explicit BlockedPopupHandler(web::WebState* web_state);
+
// 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 WebState that this object is attached to.
+ web::WebState* web_state_;
// The currently displayed infobar.
infobars::InfoBar* infobar_;
// The popups to open.
@@ -57,12 +55,4 @@ class BlockedPopupHandler : public infobars::InfoBarManager::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/tabs/tab.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