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

Side by Side Diff: chrome/browser/ui/blocked_content/popup_blocker_tab_helper.h

Issue 2693573002: Remove unused WebWindowFeatures from popup blocker, reducing WebString use in browser (Closed)
Patch Set: Created 3 years, 10 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_UI_BLOCKED_CONTENT_POPUP_BLOCKER_TAB_HELPER_H_ 5 #ifndef CHROME_BROWSER_UI_BLOCKED_CONTENT_POPUP_BLOCKER_TAB_HELPER_H_
6 #define CHROME_BROWSER_UI_BLOCKED_CONTENT_POPUP_BLOCKER_TAB_HELPER_H_ 6 #define CHROME_BROWSER_UI_BLOCKED_CONTENT_POPUP_BLOCKER_TAB_HELPER_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
11 #include <map> 11 #include <map>
12 12
13 #include "base/id_map.h" 13 #include "base/id_map.h"
14 #include "base/macros.h" 14 #include "base/macros.h"
15 #include "chrome/browser/ui/blocked_content/blocked_window_params.h" 15 #include "chrome/browser/ui/blocked_content/blocked_window_params.h"
16 #include "content/public/browser/web_contents_observer.h" 16 #include "content/public/browser/web_contents_observer.h"
17 #include "content/public/browser/web_contents_user_data.h" 17 #include "content/public/browser/web_contents_user_data.h"
18 18
19 namespace chrome { 19 namespace chrome {
20 struct NavigateParams; 20 struct NavigateParams;
21 } 21 }
22 22
23 namespace blink {
24 struct WebWindowFeatures;
25 }
26
27 class GURL; 23 class GURL;
28 24
29 // Per-tab class to manage blocked popups. 25 // Per-tab class to manage blocked popups.
30 class PopupBlockerTabHelper 26 class PopupBlockerTabHelper
31 : public content::WebContentsObserver, 27 : public content::WebContentsObserver,
32 public content::WebContentsUserData<PopupBlockerTabHelper> { 28 public content::WebContentsUserData<PopupBlockerTabHelper> {
33 public: 29 public:
34 // Mapping from popup IDs to blocked popup requests. 30 // Mapping from popup IDs to blocked popup requests.
35 typedef std::map<int32_t, GURL> PopupIdMap; 31 typedef std::map<int32_t, GURL> PopupIdMap;
36 32
37 ~PopupBlockerTabHelper() override; 33 ~PopupBlockerTabHelper() override;
38 34
39 // Returns true if the popup request defined by |params| should be blocked. 35 // Returns true if the popup request defined by |params| should be blocked.
40 // In that case, it is also added to the |blocked_popups_| container. 36 // In that case, it is also added to the |blocked_popups_| container.
41 bool MaybeBlockPopup(const chrome::NavigateParams& params, 37 bool MaybeBlockPopup(const chrome::NavigateParams& params);
42 const blink::WebWindowFeatures& window_features);
43 38
44 // Adds a popup request to the |blocked_popups_| container. 39 // Adds a popup request to the |blocked_popups_| container.
45 void AddBlockedPopup(const BlockedWindowParams& params); 40 void AddBlockedPopup(const BlockedWindowParams& params);
46 41
47 // Creates the blocked popup with |popup_id|. 42 // Creates the blocked popup with |popup_id|.
48 void ShowBlockedPopup(int32_t popup_id); 43 void ShowBlockedPopup(int32_t popup_id);
49 44
50 // Returns the number of blocked popups. 45 // Returns the number of blocked popups.
51 size_t GetBlockedPopupsCount() const; 46 size_t GetBlockedPopupsCount() const;
52 47
53 PopupIdMap GetBlockedPopupRequests(); 48 PopupIdMap GetBlockedPopupRequests();
54 49
55 // content::WebContentsObserver overrides: 50 // content::WebContentsObserver overrides:
56 void DidFinishNavigation( 51 void DidFinishNavigation(
57 content::NavigationHandle* navigation_handle) override; 52 content::NavigationHandle* navigation_handle) override;
58 53
59 private: 54 private:
60 struct BlockedRequest; 55 struct BlockedRequest;
61 friend class content::WebContentsUserData<PopupBlockerTabHelper>; 56 friend class content::WebContentsUserData<PopupBlockerTabHelper>;
62 57
63 explicit PopupBlockerTabHelper(content::WebContents* web_contents); 58 explicit PopupBlockerTabHelper(content::WebContents* web_contents);
64 59
65 void AddBlockedPopup(const chrome::NavigateParams& params, 60 void AddBlockedPopup(const chrome::NavigateParams& params);
66 const blink::WebWindowFeatures& window_features);
67 61
68 // Called when the blocked popup notification is shown or hidden. 62 // Called when the blocked popup notification is shown or hidden.
69 void PopupNotificationVisibilityChanged(bool visible); 63 void PopupNotificationVisibilityChanged(bool visible);
70 64
71 IDMap<std::unique_ptr<BlockedRequest>> blocked_popups_; 65 IDMap<std::unique_ptr<BlockedRequest>> blocked_popups_;
72 66
73 DISALLOW_COPY_AND_ASSIGN(PopupBlockerTabHelper); 67 DISALLOW_COPY_AND_ASSIGN(PopupBlockerTabHelper);
74 }; 68 };
75 69
76 #endif // CHROME_BROWSER_UI_BLOCKED_CONTENT_POPUP_BLOCKER_TAB_HELPER_H_ 70 #endif // CHROME_BROWSER_UI_BLOCKED_CONTENT_POPUP_BLOCKER_TAB_HELPER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698