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