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

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

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

Powered by Google App Engine
This is Rietveld 408576698