OLD | NEW |
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_TAB_CONTENTS_RENDER_VIEW_HOST_DELEGATE_HELPER_H_ | 5 #ifndef CONTENT_BROWSER_TAB_CONTENTS_TAB_CONTENTS_VIEW_HELPER_H_ |
6 #define CHROME_BROWSER_TAB_CONTENTS_RENDER_VIEW_HOST_DELEGATE_HELPER_H_ | 6 #define CONTENT_BROWSER_TAB_CONTENTS_TAB_CONTENTS_VIEW_HELPER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
| 13 #include "content/common/content_export.h" |
13 #include "content/public/browser/notification_observer.h" | 14 #include "content/public/browser/notification_observer.h" |
14 #include "content/public/browser/notification_registrar.h" | 15 #include "content/public/browser/notification_registrar.h" |
15 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPopupType.h" | 16 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPopupType.h" |
16 #include "webkit/glue/window_open_disposition.h" | 17 #include "webkit/glue/window_open_disposition.h" |
17 | 18 |
18 class RenderWidgetHostView; | 19 class RenderWidgetHostView; |
19 class TabContents; | 20 class TabContents; |
20 struct ViewHostMsg_CreateWindow_Params; | 21 struct ViewHostMsg_CreateWindow_Params; |
21 | 22 |
22 namespace content { | 23 namespace content { |
23 class WebContents; | 24 class WebContents; |
24 } | 25 } |
25 | 26 |
26 namespace gfx { | 27 namespace gfx { |
27 class Rect; | 28 class Rect; |
28 } | 29 } |
29 | 30 |
30 // TODO(avi): Once all the TabContentsViews implementations are in content (I'm | 31 // TODO(avi): Once all the TabContentsViews implementations are in content (I'm |
31 // looking at you, TabContentsViewViews...) then change the parameters to take | 32 // looking at you, TabContentsViewViews...) then change the parameters to take |
32 // WebContentsImpl rather than WebContents. | 33 // WebContentsImpl rather than WebContents. |
33 | 34 |
34 // Provides helper methods that provide common implementations of some | 35 // Provides helper methods that provide common implementations of some |
35 // TabContentsView methods. | 36 // TabContentsView methods. |
36 class RenderViewHostDelegateViewHelper : public content::NotificationObserver { | 37 class CONTENT_EXPORT TabContentsViewHelper |
| 38 : public content::NotificationObserver { |
37 public: | 39 public: |
38 RenderViewHostDelegateViewHelper(); | 40 TabContentsViewHelper(); |
39 virtual ~RenderViewHostDelegateViewHelper(); | 41 virtual ~TabContentsViewHelper(); |
40 | 42 |
41 // Creates a new window; call |ShowCreatedWindow| below to show it. | 43 // Creates a new window; call |ShowCreatedWindow| below to show it. |
42 TabContents* CreateNewWindow(content::WebContents* web_contents, | 44 TabContents* CreateNewWindow(content::WebContents* web_contents, |
43 int route_id, | 45 int route_id, |
44 const ViewHostMsg_CreateWindow_Params& params); | 46 const ViewHostMsg_CreateWindow_Params& params); |
45 | 47 |
46 // Creates a new popup or fullscreen widget; call |ShowCreatedWidget| below to | 48 // Creates a new popup or fullscreen widget; call |ShowCreatedWidget| below to |
47 // show it. If |is_fullscreen| is true it is a fullscreen widget, if not then | 49 // show it. If |is_fullscreen| is true it is a fullscreen widget, if not then |
48 // a pop-up. |popup_type| is only meaningful for a pop-up. | 50 // a pop-up. |popup_type| is only meaningful for a pop-up. |
49 RenderWidgetHostView* CreateNewWidget(content::WebContents* web_contents, | 51 RenderWidgetHostView* CreateNewWidget(content::WebContents* web_contents, |
(...skipping 23 matching lines...) Expand all Loading... |
73 | 75 |
74 // Finds the new RenderWidgetHost and returns it. Note that this can only be | 76 // Finds the new RenderWidgetHost and returns it. Note that this can only be |
75 // called once as this call also removes it from the internal map. | 77 // called once as this call also removes it from the internal map. |
76 RenderWidgetHostView* GetCreatedWidget(int route_id); | 78 RenderWidgetHostView* GetCreatedWidget(int route_id); |
77 | 79 |
78 // Finds the new TabContents by route_id, initializes it for | 80 // Finds the new TabContents by route_id, initializes it for |
79 // renderer-initiated creation, and returns it. Note that this can only be | 81 // renderer-initiated creation, and returns it. Note that this can only be |
80 // called once as this call also removes it from the internal map. | 82 // called once as this call also removes it from the internal map. |
81 TabContents* GetCreatedWindow(int route_id); | 83 TabContents* GetCreatedWindow(int route_id); |
82 | 84 |
83 // Tracks created RenderViewHost objects that have not been shown yet. | 85 // Tracks created TabContents objects that have not been shown yet. They are |
84 // They are identified by the route ID passed to CreateNewWindow. | 86 // identified by the route ID passed to CreateNewWindow. |
85 typedef std::map<int, TabContents*> PendingContents; | 87 typedef std::map<int, TabContents*> PendingContents; |
86 PendingContents pending_contents_; | 88 PendingContents pending_contents_; |
87 | 89 |
88 // These maps hold on to the widgets that we created on behalf of the | 90 // These maps hold on to the widgets that we created on behalf of the renderer |
89 // renderer that haven't shown yet. | 91 // that haven't shown yet. |
90 typedef std::map<int, RenderWidgetHostView*> PendingWidgetViews; | 92 typedef std::map<int, RenderWidgetHostView*> PendingWidgetViews; |
91 PendingWidgetViews pending_widget_views_; | 93 PendingWidgetViews pending_widget_views_; |
92 | 94 |
93 // Registers and unregisters us for notifications. | 95 // Registers and unregisters us for notifications. |
94 content::NotificationRegistrar registrar_; | 96 content::NotificationRegistrar registrar_; |
95 | 97 |
96 DISALLOW_COPY_AND_ASSIGN(RenderViewHostDelegateViewHelper); | 98 DISALLOW_COPY_AND_ASSIGN(TabContentsViewHelper); |
97 }; | 99 }; |
98 | 100 |
99 #endif // CHROME_BROWSER_TAB_CONTENTS_RENDER_VIEW_HOST_DELEGATE_HELPER_H_ | 101 #endif // CONTENT_BROWSER_TAB_CONTENTS_TAB_CONTENTS_VIEW_HELPER_H_ |
OLD | NEW |