OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 CHROME_BROWSER_TAB_CONTENTS_RENDER_VIEW_HOST_DELEGATE_HELPER_H_ |
6 #define CHROME_BROWSER_TAB_CONTENTS_RENDER_VIEW_HOST_DELEGATE_HELPER_H_ | 6 #define CHROME_BROWSER_TAB_CONTENTS_RENDER_VIEW_HOST_DELEGATE_HELPER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 #include <string> | 10 #include <string> |
(...skipping 12 matching lines...) Expand all Loading... |
23 class RenderViewHost; | 23 class RenderViewHost; |
24 class RenderViewHostDelegate; | 24 class RenderViewHostDelegate; |
25 class RenderWidgetHost; | 25 class RenderWidgetHost; |
26 class RenderWidgetHostView; | 26 class RenderWidgetHostView; |
27 class SiteInstance; | 27 class SiteInstance; |
28 class TabContents; | 28 class TabContents; |
29 struct ViewHostMsg_CreateWindow_Params; | 29 struct ViewHostMsg_CreateWindow_Params; |
30 | 30 |
31 namespace content { | 31 namespace content { |
32 class BrowserContext; | 32 class BrowserContext; |
| 33 class ContentFrame; |
33 class RenderProcessHost; | 34 class RenderProcessHost; |
34 } | 35 } |
35 | 36 |
36 namespace gfx { | 37 namespace gfx { |
37 class Rect; | 38 class Rect; |
38 } | 39 } |
39 | 40 |
40 // Provides helper methods that provide common implementations of some | 41 // Provides helper methods that provide common implementations of some |
41 // RenderViewHostDelegate::View methods. | 42 // RenderViewHostDelegate::View methods. |
42 class RenderViewHostDelegateViewHelper : public content::NotificationObserver { | 43 class RenderViewHostDelegateViewHelper : public content::NotificationObserver { |
(...skipping 16 matching lines...) Expand all Loading... |
59 | 60 |
60 // Finds the new RenderViewHost/Delegate by route_id, initializes it for | 61 // Finds the new RenderViewHost/Delegate by route_id, initializes it for |
61 // for renderer-initiated creation, and returns the TabContents that needs | 62 // for renderer-initiated creation, and returns the TabContents that needs |
62 // to be shown, if there is one (i.e. not a BackgroundContents). Note that | 63 // to be shown, if there is one (i.e. not a BackgroundContents). Note that |
63 // this can only be called once as this call also removes it from the internal | 64 // this can only be called once as this call also removes it from the internal |
64 // map. | 65 // map. |
65 TabContents* GetCreatedWindow(int route_id); | 66 TabContents* GetCreatedWindow(int route_id); |
66 | 67 |
67 // These methods are meant to be called from TabContentsView implementations. | 68 // These methods are meant to be called from TabContentsView implementations. |
68 // They take care of notifying the TabContentsDelegate. | 69 // They take care of notifying the TabContentsDelegate. |
69 TabContents* CreateNewWindowFromTabContents( | 70 TabContents* CreateNewWindowFromContentFrame( |
70 TabContents* tab_contents, | 71 content::ContentFrame* opener, |
71 int route_id, | 72 int route_id, |
72 const ViewHostMsg_CreateWindow_Params& params); | 73 const ViewHostMsg_CreateWindow_Params& params); |
73 // Mirrors the RenderViewHostDelegate::View Show methods. | 74 // Mirrors the RenderViewHostDelegate::View Show methods. |
74 TabContents* ShowCreatedWindow(TabContents* tab_contents, | 75 TabContents* ShowCreatedWindow(TabContents* tab_contents, |
75 int route_id, | 76 int route_id, |
76 WindowOpenDisposition disposition, | 77 WindowOpenDisposition disposition, |
77 const gfx::Rect& initial_pos, | 78 const gfx::Rect& initial_pos, |
78 bool user_gesture); | 79 bool user_gesture); |
79 RenderWidgetHostView* ShowCreatedWidget(TabContents* tab_contents, | 80 RenderWidgetHostView* ShowCreatedWidget(TabContents* tab_contents, |
80 int route_id, | 81 int route_id, |
81 const gfx::Rect& initial_pos); | 82 const gfx::Rect& initial_pos); |
82 RenderWidgetHostView* ShowCreatedFullscreenWidget(TabContents* tab_contents, | 83 RenderWidgetHostView* ShowCreatedFullscreenWidget(TabContents* tab_contents, |
83 int route_id); | 84 int route_id); |
84 | 85 |
85 private: | 86 private: |
86 // content::NotificationObserver implementation | 87 // content::NotificationObserver implementation |
87 virtual void Observe(int type, | 88 virtual void Observe(int type, |
88 const content::NotificationSource& source, | 89 const content::NotificationSource& source, |
89 const content::NotificationDetails& details) OVERRIDE; | 90 const content::NotificationDetails& details) OVERRIDE; |
90 | 91 |
91 // Creates a new renderer for window.open. This will either be a | 92 // Creates a new renderer for window.open. This will either be a |
92 // BackgroundContents (if the window_container_type == | 93 // BackgroundContents (if the window_container_type == |
93 // WINDOW_CONTAINER_TYPE_BACKGROUND and permissions allow) or a TabContents. | 94 // WINDOW_CONTAINER_TYPE_BACKGROUND and permissions allow) or a TabContents. |
94 // If a TabContents is created, it is returned. Otherwise NULL is returned. | 95 // If a TabContents is created, it is returned. Otherwise NULL is returned. |
95 TabContents* CreateNewWindow( | 96 TabContents* CreateNewWindow( |
96 int route_id, | 97 int route_id, |
97 Profile* profile, | 98 Profile* profile, |
98 SiteInstance* site, | 99 SiteInstance* site, |
99 WebUI::TypeID webui_type, | 100 WebUI::TypeID webui_type, |
100 RenderViewHostDelegate* opener, | 101 content::ContentFrame* opener, |
101 WindowContainerType window_container_type, | 102 WindowContainerType window_container_type, |
102 const string16& frame_name); | 103 const string16& frame_name); |
103 | 104 |
104 BackgroundContents* MaybeCreateBackgroundContents( | 105 BackgroundContents* MaybeCreateBackgroundContents( |
105 int route_id, | 106 int route_id, |
106 Profile* profile, | 107 Profile* profile, |
107 SiteInstance* site, | 108 SiteInstance* site, |
108 const GURL& opener_url, | 109 const GURL& opener_url, |
109 const string16& frame_name); | 110 const string16& frame_name); |
110 | 111 |
(...skipping 25 matching lines...) Expand all Loading... |
136 const std::string& value); | 137 const std::string& value); |
137 static void ClearInspectorSettings(content::BrowserContext* browser_context); | 138 static void ClearInspectorSettings(content::BrowserContext* browser_context); |
138 | 139 |
139 private: | 140 private: |
140 RenderViewHostDelegateHelper(); | 141 RenderViewHostDelegateHelper(); |
141 | 142 |
142 DISALLOW_COPY_AND_ASSIGN(RenderViewHostDelegateHelper); | 143 DISALLOW_COPY_AND_ASSIGN(RenderViewHostDelegateHelper); |
143 }; | 144 }; |
144 | 145 |
145 #endif // CHROME_BROWSER_TAB_CONTENTS_RENDER_VIEW_HOST_DELEGATE_HELPER_H_ | 146 #endif // CHROME_BROWSER_TAB_CONTENTS_RENDER_VIEW_HOST_DELEGATE_HELPER_H_ |
OLD | NEW |