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

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

Issue 10938033: Switch BlockedContentTabHelper to use WebContentsUserData. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years, 3 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 // Defines the public interface for the blocked content (including popup) 5 // Defines the public interface for the blocked content (including popup)
6 // notifications. This interface should only be used by the 6 // notifications. This interface should only be used by the
7 // BlockedContentTabHelper. Users and subclasses of WebContents/TabContents 7 // BlockedContentTabHelper. Users and subclasses of WebContents
8 // should use the appropriate methods on BlockedContentTabHelper to access 8 // should use the appropriate methods on BlockedContentTabHelper to access
9 // information about blocked content. 9 // information about blocked content.
10 10
11 #ifndef CHROME_BROWSER_UI_BLOCKED_CONTENT_BLOCKED_CONTENT_CONTAINER_H_ 11 #ifndef CHROME_BROWSER_UI_BLOCKED_CONTENT_BLOCKED_CONTENT_CONTAINER_H_
12 #define CHROME_BROWSER_UI_BLOCKED_CONTENT_BLOCKED_CONTENT_CONTAINER_H_ 12 #define CHROME_BROWSER_UI_BLOCKED_CONTENT_BLOCKED_CONTENT_CONTAINER_H_
13 13
14 #include <vector> 14 #include <vector>
15 15
16 #include "base/compiler_specific.h" 16 #include "base/compiler_specific.h"
17 #include "chrome/browser/ui/blocked_content/blocked_content_tab_helper_delegate. h" 17 #include "chrome/browser/ui/blocked_content/blocked_content_tab_helper_delegate. h"
18 #include "content/public/browser/web_contents_delegate.h" 18 #include "content/public/browser/web_contents_delegate.h"
19 19
20 class TabContents; 20 namespace content {
21 class WebContents;
22 }
21 23
22 // Takes ownership of TabContentses that are unrequested popup windows. 24 // Takes ownership of TabContentses that are unrequested popup windows.
23 class BlockedContentContainer : public BlockedContentTabHelperDelegate, 25 class BlockedContentContainer : public BlockedContentTabHelperDelegate,
24 public content::WebContentsDelegate { 26 public content::WebContentsDelegate {
25 public: 27 public:
26 // Creates a container for a certain TabContents: 28 // Creates a container for a certain WebContents:
27 explicit BlockedContentContainer(TabContents* owner); 29 explicit BlockedContentContainer(content::WebContents* owner);
28 virtual ~BlockedContentContainer(); 30 virtual ~BlockedContentContainer();
29 31
30 // Adds a TabContents to this container. |bounds| are the window bounds 32 // Adds a WebContents to this container. |bounds| are the window bounds
31 // requested for the TabContents. 33 // requested for the TabContents.
32 void AddTabContents(TabContents* tab_contents, 34 void AddWebContents(content::WebContents* web_contents,
33 WindowOpenDisposition disposition, 35 WindowOpenDisposition disposition,
34 const gfx::Rect& bounds, 36 const gfx::Rect& bounds,
35 bool user_gesture); 37 bool user_gesture);
36 38
37 // Shows the blocked TabContents |tab_contents|. 39 // Shows the blocked WebContents |web_contents|.
38 void LaunchForContents(TabContents* tab_contents); 40 void LaunchForContents(content::WebContents* web_contents);
39 41
40 // Returns the number of blocked contents. 42 // Returns the number of blocked contents.
41 size_t GetBlockedContentsCount() const; 43 size_t GetBlockedContentsCount() const;
42 44
43 // Returns the contained TabContents pointers. |blocked_contents| must 45 // Returns the contained WebContents pointers. |blocked_contents| must
44 // be non-NULL. 46 // be non-NULL.
45 void GetBlockedContents(std::vector<TabContents*>* blocked_contents) const; 47 void GetBlockedContents(
48 std::vector<content::WebContents*>* blocked_contents) const;
46 49
47 // Removes all blocked contents. 50 // Removes all blocked contents.
48 void Clear(); 51 void Clear();
49 52
50 // Overridden from BlockedContentTabHelperDelegate: 53 // Overridden from BlockedContentTabHelperDelegate:
51 virtual TabContents* GetConstrainingTabContents(TabContents* source) OVERRIDE; 54 virtual content::WebContents* GetConstrainingWebContents(
55 content::WebContents* source) OVERRIDE;
52 56
53 // Overridden from content::WebContentsDelegate: 57 // Overridden from content::WebContentsDelegate:
54 58
55 // Forwards OpenURLFromTab to our |owner_|. 59 // Forwards OpenURLFromTab to our |owner_|.
56 virtual content::WebContents* OpenURLFromTab( 60 virtual content::WebContents* OpenURLFromTab(
57 content::WebContents* source, 61 content::WebContents* source,
58 const content::OpenURLParams& params) OVERRIDE; 62 const content::OpenURLParams& params) OVERRIDE;
59 63
60 // Forwards AddNewContents to our |owner_|. 64 // Forwards AddNewContents to our |owner_|.
61 virtual void AddNewContents(content::WebContents* source, 65 virtual void AddNewContents(content::WebContents* source,
(...skipping 19 matching lines...) Expand all
81 // Maximum number of blocked contents we allow. No page should really need 85 // Maximum number of blocked contents we allow. No page should really need
82 // this many anyway. If reached it typically means there is a compromised 86 // this many anyway. If reached it typically means there is a compromised
83 // renderer. 87 // renderer.
84 static const size_t kImpossibleNumberOfPopups; 88 static const size_t kImpossibleNumberOfPopups;
85 89
86 private: 90 private:
87 struct BlockedContent; 91 struct BlockedContent;
88 92
89 typedef std::vector<BlockedContent> BlockedContents; 93 typedef std::vector<BlockedContent> BlockedContents;
90 94
91 // The TabContents that owns and constrains this BlockedContentContainer. 95 // The WebContents that owns and constrains this BlockedContentContainer.
92 TabContents* owner_; 96 content::WebContents* owner_;
93 97
94 // Information about all blocked contents. 98 // Information about all blocked contents.
95 BlockedContents blocked_contents_; 99 BlockedContents blocked_contents_;
96 100
97 DISALLOW_IMPLICIT_CONSTRUCTORS(BlockedContentContainer); 101 DISALLOW_IMPLICIT_CONSTRUCTORS(BlockedContentContainer);
98 }; 102 };
99 103
100 #endif // CHROME_BROWSER_UI_BLOCKED_CONTENT_BLOCKED_CONTENT_CONTAINER_H_ 104 #endif // CHROME_BROWSER_UI_BLOCKED_CONTENT_BLOCKED_CONTENT_CONTAINER_H_
OLDNEW
« no previous file with comments | « chrome/browser/popup_blocker_browsertest.cc ('k') | chrome/browser/ui/blocked_content/blocked_content_container.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698