OLD | NEW |
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 <map> | 8 #include <map> |
9 | 9 |
10 #include "base/id_map.h" | 10 #include "base/id_map.h" |
11 #include "chrome/browser/ui/blocked_content/blocked_window_params.h" | 11 #include "chrome/browser/ui/blocked_content/blocked_window_params.h" |
12 #include "content/public/browser/web_contents_observer.h" | 12 #include "content/public/browser/web_contents_observer.h" |
13 #include "content/public/browser/web_contents_user_data.h" | 13 #include "content/public/browser/web_contents_user_data.h" |
14 | 14 |
15 namespace chrome { | 15 namespace chrome { |
16 struct NavigateParams; | 16 struct NavigateParams; |
17 } | 17 } |
18 | 18 |
19 namespace WebKit { | 19 namespace blink { |
20 struct WebWindowFeatures; | 20 struct WebWindowFeatures; |
21 } | 21 } |
22 | 22 |
23 class GURL; | 23 class GURL; |
24 | 24 |
25 // Per-tab class to manage blocked popups. | 25 // Per-tab class to manage blocked popups. |
26 class PopupBlockerTabHelper | 26 class PopupBlockerTabHelper |
27 : public content::WebContentsObserver, | 27 : public content::WebContentsObserver, |
28 public content::WebContentsUserData<PopupBlockerTabHelper> { | 28 public content::WebContentsUserData<PopupBlockerTabHelper> { |
29 public: | 29 public: |
30 virtual ~PopupBlockerTabHelper(); | 30 virtual ~PopupBlockerTabHelper(); |
31 | 31 |
32 // Returns true if the popup request defined by |params| should be blocked. | 32 // Returns true if the popup request defined by |params| should be blocked. |
33 // In that case, it is also added to the |blocked_popups_| container. | 33 // In that case, it is also added to the |blocked_popups_| container. |
34 bool MaybeBlockPopup(const chrome::NavigateParams& params, | 34 bool MaybeBlockPopup(const chrome::NavigateParams& params, |
35 const WebKit::WebWindowFeatures& window_features); | 35 const blink::WebWindowFeatures& window_features); |
36 | 36 |
37 // Adds a popup request to the |blocked_popups_| container. | 37 // Adds a popup request to the |blocked_popups_| container. |
38 void AddBlockedPopup(const BlockedWindowParams& params); | 38 void AddBlockedPopup(const BlockedWindowParams& params); |
39 | 39 |
40 // Creates the blocked popup with |popup_id|. | 40 // Creates the blocked popup with |popup_id|. |
41 void ShowBlockedPopup(int32 popup_id); | 41 void ShowBlockedPopup(int32 popup_id); |
42 | 42 |
43 // Returns the number of blocked popups. | 43 // Returns the number of blocked popups. |
44 size_t GetBlockedPopupsCount() const; | 44 size_t GetBlockedPopupsCount() const; |
45 | 45 |
(...skipping 13 matching lines...) Expand all Loading... |
59 | 59 |
60 // Called when the blocked popup notification is shown or hidden. | 60 // Called when the blocked popup notification is shown or hidden. |
61 void PopupNotificationVisibilityChanged(bool visible); | 61 void PopupNotificationVisibilityChanged(bool visible); |
62 | 62 |
63 IDMap<BlockedRequest, IDMapOwnPointer> blocked_popups_; | 63 IDMap<BlockedRequest, IDMapOwnPointer> blocked_popups_; |
64 | 64 |
65 DISALLOW_COPY_AND_ASSIGN(PopupBlockerTabHelper); | 65 DISALLOW_COPY_AND_ASSIGN(PopupBlockerTabHelper); |
66 }; | 66 }; |
67 | 67 |
68 #endif // CHROME_BROWSER_UI_BLOCKED_CONTENT_POPUP_BLOCKER_TAB_HELPER_H_ | 68 #endif // CHROME_BROWSER_UI_BLOCKED_CONTENT_POPUP_BLOCKER_TAB_HELPER_H_ |
OLD | NEW |