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

Unified Diff: chrome/browser/ui/content_settings/content_settings_tab_helper.h

Issue 6854035: Move blocked content from TabContents to TabContentsWrapper. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 8 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/content_settings/content_settings_tab_helper.h
diff --git a/chrome/browser/ui/content_settings/content_settings_tab_helper.h b/chrome/browser/ui/content_settings/content_settings_tab_helper.h
new file mode 100644
index 0000000000000000000000000000000000000000..5ce03272b5e83fa8a830714122b7a2f46a8071a8
--- /dev/null
+++ b/chrome/browser/ui/content_settings/content_settings_tab_helper.h
@@ -0,0 +1,93 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_CONTENT_SETTINGS_CONTENT_SETTINGS_TAB_HELPER_H_
+#define CHROME_BROWSER_UI_CONTENT_SETTINGS_CONTENT_SETTINGS_TAB_HELPER_H_
+#pragma once
+
+#include "chrome/browser/ui/find_bar/find_bar_controller.h"
+#include "chrome/browser/ui/find_bar/find_notification_details.h"
+#include "content/browser/tab_contents/tab_contents_observer.h"
+#include "content/common/notification_registrar.h"
+#include "webkit/glue/window_open_disposition.h"
+
+class BlockedContentContainer;
+class ContentSettingsTabHelperDelegate;
+class TabContentsWrapper;
+
+// Per-tab class to manage various allowed and disallowed content.
jochen (gone - plz use gerrit) 2011/04/14 23:11:04 so, there seems to be an misunderstanding. there
Avi (use Gerrit) 2011/04/15 00:20:12 Gah. The reason I did this in the first place was
+class ContentSettingsTabHelper : public NotificationObserver,
+ public TabContentsObserver {
+ public:
+ explicit ContentSettingsTabHelper(TabContentsWrapper* tab_contents);
+ virtual ~ContentSettingsTabHelper();
+
+ ContentSettingsTabHelperDelegate* delegate() const { return delegate_; }
+ void set_delegate(ContentSettingsTabHelperDelegate* d) { delegate_ = d; }
+
+ // Sets whether all TabContents added by way of |AddNewContents| should be
+ // blocked. Transitioning from all blocked to not all blocked results in
+ // reevaluating any blocked TabContents, which may result in unblocking some
+ // of the blocked TabContents.
+ 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(TabContentsWrapper* new_contents,
+ WindowOpenDisposition disposition,
+ const gfx::Rect& initial_pos,
+ bool user_gesture);
+
+ // Adds the incoming |new_contents| to the |blocked_contents_| container.
+ void AddPopup(TabContentsWrapper* new_contents,
+ const gfx::Rect& initial_pos);
+
+ // Shows the blocked TabContents |tab_contents|.
+ void LaunchForContents(TabContentsWrapper* tab_contents);
+
+ // Returns the number of blocked contents.
+ size_t GetBlockedContentsCount() const;
+
+ // Returns the blocked TabContentsWrappers. |blocked_contents| must
+ // be non-NULL.
+ void GetBlockedContents(
+ std::vector<TabContentsWrapper*>* blocked_contents) const;
+
+ // TabContentsObserver overrides:
+ virtual void DidNavigateMainFramePostCommit(
+ const NavigationController::LoadCommittedDetails& details,
+ const ViewHostMsg_FrameNavigate_Params& params) OVERRIDE;
+
+ // NotificationObserver overrides:
+ virtual void Observe(NotificationType type,
+ const NotificationSource& source,
+ const NotificationDetails& details) OVERRIDE;
+
+ private:
+ // Called when the blocked popup notification is shown or hidden.
+ void PopupNotificationVisibilityChanged(bool visible);
+
+ // Object that holds any blocked TabContents spawned from this TabContents.
+ scoped_ptr<BlockedContentContainer> blocked_contents_;
+
+ // Should we block all child TabContents this attempts to spawn.
+ bool all_contents_blocked_;
+
+ // TODO(pkasting): Hack to try and fix Linux browser tests.
+ bool dont_notify_render_view_;
+
+ // Owning TabContentsWrapper.
+ TabContentsWrapper* tab_contents_wrapper_;
+
+ // Delegate for notifying our owner about stuff. Not owned by us.
+ ContentSettingsTabHelperDelegate* delegate_;
+
+ // Registers and unregisters us for notifications.
+ NotificationRegistrar registrar_;
+
+ DISALLOW_COPY_AND_ASSIGN(ContentSettingsTabHelper);
+};
+
+#endif // CHROME_BROWSER_UI_CONTENT_SETTINGS_CONTENT_SETTINGS_TAB_HELPER_H_

Powered by Google App Engine
This is Rietveld 408576698