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

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

Issue 10105030: TabContents -> WebContentsImpl, part 21. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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 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 #ifndef CHROME_BROWSER_UI_BLOCKED_CONTENT_BLOCKED_CONTENT_TAB_HELPER_H_ 5 #ifndef CHROME_BROWSER_UI_BLOCKED_CONTENT_BLOCKED_CONTENT_TAB_HELPER_H_
6 #define CHROME_BROWSER_UI_BLOCKED_CONTENT_BLOCKED_CONTENT_TAB_HELPER_H_ 6 #define CHROME_BROWSER_UI_BLOCKED_CONTENT_BLOCKED_CONTENT_TAB_HELPER_H_
7 #pragma once 7 #pragma once
8 8
9 #include "chrome/browser/ui/find_bar/find_bar_controller.h" 9 #include "chrome/browser/ui/find_bar/find_bar_controller.h"
10 #include "chrome/browser/ui/find_bar/find_notification_details.h" 10 #include "chrome/browser/ui/find_bar/find_notification_details.h"
11 #include "content/public/browser/notification_registrar.h" 11 #include "content/public/browser/notification_registrar.h"
12 #include "content/public/browser/web_contents_observer.h" 12 #include "content/public/browser/web_contents_observer.h"
13 #include "webkit/glue/window_open_disposition.h" 13 #include "webkit/glue/window_open_disposition.h"
14 14
15 class BlockedContentContainer; 15 class BlockedContentContainer;
16 class BlockedContentTabHelperDelegate; 16 class BlockedContentTabHelperDelegate;
17 class TabContentsWrapper; 17 class TabContentsWrapper;
18 18
19 // Per-tab class to manage blocked popups. 19 // Per-tab class to manage blocked popups.
20 class BlockedContentTabHelper : public content::WebContentsObserver { 20 class BlockedContentTabHelper : public content::WebContentsObserver {
21 public: 21 public:
22 explicit BlockedContentTabHelper(TabContentsWrapper* tab_contents); 22 explicit BlockedContentTabHelper(TabContentsWrapper* tab_contents);
23 virtual ~BlockedContentTabHelper(); 23 virtual ~BlockedContentTabHelper();
24 24
25 BlockedContentTabHelperDelegate* delegate() const { return delegate_; } 25 BlockedContentTabHelperDelegate* delegate() const { return delegate_; }
26 void set_delegate(BlockedContentTabHelperDelegate* d) { delegate_ = d; } 26 void set_delegate(BlockedContentTabHelperDelegate* d) { delegate_ = d; }
27 27
28 // Sets whether all TabContents added by way of |AddNewContents| should be 28 // Sets whether all TabContentsWrapper added by way of |AddNewContents| should
29 // blocked. Transitioning from all blocked to not all blocked results in 29 // be blocked. Transitioning from all blocked to not all blocked results in
30 // reevaluating any blocked TabContents, which may result in unblocking some 30 // reevaluating any blocked TabContentsWrappers, which may result in
31 // of the blocked TabContents. 31 // unblocking some of the blocked TabContentsWrappers.
32 void SetAllContentsBlocked(bool value); 32 void SetAllContentsBlocked(bool value);
33 33
34 bool all_contents_blocked() const { return all_contents_blocked_; } 34 bool all_contents_blocked() const { return all_contents_blocked_; }
35 35
36 // Adds the incoming |new_contents| to the |blocked_contents_| container. 36 // Adds the incoming |new_contents| to the |blocked_contents_| container.
37 void AddTabContents(TabContentsWrapper* new_contents, 37 void AddTabContents(TabContentsWrapper* new_contents,
38 WindowOpenDisposition disposition, 38 WindowOpenDisposition disposition,
39 const gfx::Rect& initial_pos, 39 const gfx::Rect& initial_pos,
40 bool user_gesture); 40 bool user_gesture);
41 41
42 // Adds the incoming |new_contents| to the |blocked_contents_| container. 42 // Adds the incoming |new_contents| to the |blocked_contents_| container.
43 void AddPopup(TabContentsWrapper* new_contents, 43 void AddPopup(TabContentsWrapper* new_contents,
44 const gfx::Rect& initial_pos, 44 const gfx::Rect& initial_pos,
45 bool user_gesture); 45 bool user_gesture);
46 46
47 // Shows the blocked TabContents |tab_contents|. 47 // Shows the blocked TabContentsWrapper |tab_contents|.
48 void LaunchForContents(TabContentsWrapper* tab_contents); 48 void LaunchForContents(TabContentsWrapper* tab_contents);
49 49
50 // Returns the number of blocked contents. 50 // Returns the number of blocked contents.
51 size_t GetBlockedContentsCount() const; 51 size_t GetBlockedContentsCount() const;
52 52
53 // Returns the blocked TabContentsWrappers. |blocked_contents| must 53 // Returns the blocked TabContentsWrappers. |blocked_contents| must
54 // be non-NULL. 54 // be non-NULL.
55 void GetBlockedContents( 55 void GetBlockedContents(
56 std::vector<TabContentsWrapper*>* blocked_contents) const; 56 std::vector<TabContentsWrapper*>* blocked_contents) const;
57 57
58 // content::WebContentsObserver overrides: 58 // content::WebContentsObserver overrides:
59 virtual void DidNavigateMainFrame( 59 virtual void DidNavigateMainFrame(
60 const content::LoadCommittedDetails& details, 60 const content::LoadCommittedDetails& details,
61 const content::FrameNavigateParams& params) OVERRIDE; 61 const content::FrameNavigateParams& params) OVERRIDE;
62 62
63 private: 63 private:
64 // Called when the blocked popup notification is shown or hidden. 64 // Called when the blocked popup notification is shown or hidden.
65 void PopupNotificationVisibilityChanged(bool visible); 65 void PopupNotificationVisibilityChanged(bool visible);
66 66
67 // Called to notify any observers that |contents| is entering or leaving 67 // Called to notify any observers that |contents| is entering or leaving
68 // the blocked state. 68 // the blocked state.
69 void SendNotification(TabContentsWrapper* contents, bool blocked_state); 69 void SendNotification(TabContentsWrapper* contents, bool blocked_state);
70 70
71 // Object that holds any blocked TabContents spawned from this TabContents. 71 // Object that holds any blocked TabContentsWrapper spawned from this
72 // TabContentsWrapper.
72 scoped_ptr<BlockedContentContainer> blocked_contents_; 73 scoped_ptr<BlockedContentContainer> blocked_contents_;
73 74
74 // Should we block all child TabContents this attempts to spawn. 75 // Should we block all child TabContentsWrapper this attempts to spawn.
75 bool all_contents_blocked_; 76 bool all_contents_blocked_;
76 77
77 // Owning TabContentsWrapper. 78 // Owning TabContentsWrapper.
78 TabContentsWrapper* tab_contents_wrapper_; 79 TabContentsWrapper* tab_contents_wrapper_;
79 80
80 // Delegate for notifying our owner (usually Browser) about stuff. Not owned 81 // Delegate for notifying our owner (usually Browser) about stuff. Not owned
81 // by us. 82 // by us.
82 BlockedContentTabHelperDelegate* delegate_; 83 BlockedContentTabHelperDelegate* delegate_;
83 84
84 DISALLOW_COPY_AND_ASSIGN(BlockedContentTabHelper); 85 DISALLOW_COPY_AND_ASSIGN(BlockedContentTabHelper);
85 }; 86 };
86 87
87 #endif // CHROME_BROWSER_UI_BLOCKED_CONTENT_BLOCKED_CONTENT_TAB_HELPER_H_ 88 #endif // CHROME_BROWSER_UI_BLOCKED_CONTENT_BLOCKED_CONTENT_TAB_HELPER_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/blocked_content/blocked_content_container.cc ('k') | chrome/browser/ui/bookmarks/bookmark_tab_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698