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

Unified Diff: chrome/browser/ui/blocked_content/blocked_content_tab_helper.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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/blocked_content/blocked_content_tab_helper.h
diff --git a/chrome/browser/ui/blocked_content/blocked_content_tab_helper.h b/chrome/browser/ui/blocked_content/blocked_content_tab_helper.h
index 9a22669b69454a7edaca36fa2c342aa1f5091cc3..9a928f10650dc8723438ec2b9a2672e2fd10bc49 100644
--- a/chrome/browser/ui/blocked_content/blocked_content_tab_helper.h
+++ b/chrome/browser/ui/blocked_content/blocked_content_tab_helper.h
@@ -5,6 +5,7 @@
#ifndef CHROME_BROWSER_UI_BLOCKED_CONTENT_BLOCKED_CONTENT_TAB_HELPER_H_
#define CHROME_BROWSER_UI_BLOCKED_CONTENT_BLOCKED_CONTENT_TAB_HELPER_H_
+#include "chrome/browser/tab_contents/web_contents_user_data.h"
#include "chrome/browser/ui/find_bar/find_bar_controller.h"
#include "chrome/browser/ui/find_bar/find_notification_details.h"
#include "content/public/browser/notification_registrar.h"
@@ -13,45 +14,46 @@
class BlockedContentContainer;
class BlockedContentTabHelperDelegate;
-class TabContents;
// Per-tab class to manage blocked popups.
-class BlockedContentTabHelper : public content::WebContentsObserver {
+class BlockedContentTabHelper
+ : public content::WebContentsObserver,
+ public WebContentsUserData<BlockedContentTabHelper> {
public:
- explicit BlockedContentTabHelper(TabContents* tab_contents);
virtual ~BlockedContentTabHelper();
BlockedContentTabHelperDelegate* delegate() const { return delegate_; }
void set_delegate(BlockedContentTabHelperDelegate* d) { delegate_ = d; }
- // Sets whether all TabContents added by way of |AddNewContents| should be
+ // Sets whether all WebContents added by way of |AddNewContents| should be
// blocked. Transitioning from all blocked to not all blocked results in
- // reevaluating any blocked TabContentses, which may result in unblocking some
- // of the blocked TabContentses.
+ // reevaluating any blocked WebContentses, which may result in unblocking some
+ // of the blocked WebContentses.
void SetAllContentsBlocked(bool value);
bool all_contents_blocked() const { return all_contents_blocked_; }
// Adds the incoming |new_contents| to the |blocked_contents_| container.
- void AddTabContents(TabContents* new_contents,
+ void AddWebContents(content::WebContents* new_contents,
WindowOpenDisposition disposition,
const gfx::Rect& initial_pos,
bool user_gesture);
// Adds the incoming |new_contents| to the |blocked_contents_| container.
- void AddPopup(TabContents* new_contents,
+ void AddPopup(content::WebContents* new_contents,
WindowOpenDisposition disposition,
const gfx::Rect& initial_pos,
bool user_gesture);
- // Shows the blocked TabContents |tab_contents|.
- void LaunchForContents(TabContents* tab_contents);
+ // Shows the blocked WebContents |web_contents|.
+ void LaunchForContents(content::WebContents* web_contents);
// Returns the number of blocked contents.
size_t GetBlockedContentsCount() const;
- // Returns the blocked TabContentss. |blocked_contents| must be non-NULL.
- void GetBlockedContents(std::vector<TabContents*>* blocked_contents) const;
+ // Returns the blocked WebContentses. |blocked_contents| must be non-NULL.
+ void GetBlockedContents(
+ std::vector<content::WebContents*>* blocked_contents) const;
// content::WebContentsObserver overrides:
virtual void DidNavigateMainFrame(
@@ -59,22 +61,23 @@ class BlockedContentTabHelper : public content::WebContentsObserver {
const content::FrameNavigateParams& params) OVERRIDE;
private:
+ explicit BlockedContentTabHelper(content::WebContents* web_contents);
+ static int kUserDataKey;
+ friend class WebContentsUserData<BlockedContentTabHelper>;
+
// Called when the blocked popup notification is shown or hidden.
void PopupNotificationVisibilityChanged(bool visible);
// Called to notify any observers that |contents| is entering or leaving
// the blocked state.
- void SendNotification(TabContents* contents, bool blocked_state);
+ void SendNotification(content::WebContents* contents, bool blocked_state);
- // Object that holds any blocked TabContents spawned from this TabContents.
+ // Object that holds any blocked WebContentses spawned from this WebContents.
scoped_ptr<BlockedContentContainer> blocked_contents_;
// Should we block all child TabContents this attempts to spawn.
bool all_contents_blocked_;
- // Owning TabContents.
- TabContents* tab_contents_;
-
// Delegate for notifying our owner (usually Browser) about stuff. Not owned
// by us.
BlockedContentTabHelperDelegate* delegate_;

Powered by Google App Engine
This is Rietveld 408576698