| 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 | 11 |
| 11 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
| 12 #include "content/browser/webui/web_ui.h" | 13 #include "content/browser/webui/web_ui.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 "content/public/common/window_container_type.h" | 16 #include "content/public/common/window_container_type.h" |
| 16 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPopupType.h" | 17 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPopupType.h" |
| 17 #include "ui/gfx/rect.h" | |
| 18 #include "webkit/glue/webpreferences.h" | 18 #include "webkit/glue/webpreferences.h" |
| 19 #include "webkit/glue/window_open_disposition.h" | 19 #include "webkit/glue/window_open_disposition.h" |
| 20 | 20 |
| 21 class BackgroundContents; | 21 class BackgroundContents; |
| 22 class Profile; | 22 class Profile; |
| 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 RenderProcessHost; | 33 class RenderProcessHost; |
| 34 } | 34 } |
| 35 | 35 |
| 36 namespace gfx { |
| 37 class Rect; |
| 38 } |
| 39 |
| 36 // Provides helper methods that provide common implementations of some | 40 // Provides helper methods that provide common implementations of some |
| 37 // RenderViewHostDelegate::View methods. | 41 // RenderViewHostDelegate::View methods. |
| 38 class RenderViewHostDelegateViewHelper : public content::NotificationObserver { | 42 class RenderViewHostDelegateViewHelper : public content::NotificationObserver { |
| 39 public: | 43 public: |
| 40 RenderViewHostDelegateViewHelper(); | 44 RenderViewHostDelegateViewHelper(); |
| 41 virtual ~RenderViewHostDelegateViewHelper(); | 45 virtual ~RenderViewHostDelegateViewHelper(); |
| 42 | 46 |
| 43 // Creates a new renderer for window.open. This will either be a | |
| 44 // BackgroundContents (if the window_container_type == | |
| 45 // WINDOW_CONTAINER_TYPE_BACKGROUND and permissions allow) or a TabContents. | |
| 46 // If a TabContents is created, it is returned. Otherwise NULL is returned. | |
| 47 TabContents* CreateNewWindow( | |
| 48 int route_id, | |
| 49 Profile* profile, | |
| 50 SiteInstance* site, | |
| 51 WebUI::TypeID webui_type, | |
| 52 RenderViewHostDelegate* opener, | |
| 53 WindowContainerType window_container_type, | |
| 54 const string16& frame_name); | |
| 55 | |
| 56 // Creates a new RenderWidgetHost and saves it for later retrieval by | 47 // Creates a new RenderWidgetHost and saves it for later retrieval by |
| 57 // GetCreatedWidget. | 48 // GetCreatedWidget. |
| 58 RenderWidgetHostView* CreateNewWidget(int route_id, | 49 RenderWidgetHostView* CreateNewWidget(int route_id, |
| 59 WebKit::WebPopupType popup_type, | 50 WebKit::WebPopupType popup_type, |
| 60 content::RenderProcessHost* process); | 51 content::RenderProcessHost* process); |
| 61 | 52 |
| 62 RenderWidgetHostView* CreateNewFullscreenWidget( | 53 RenderWidgetHostView* CreateNewFullscreenWidget( |
| 63 int route_id, content::RenderProcessHost* process); | 54 int route_id, content::RenderProcessHost* process); |
| 64 | 55 |
| 65 // Finds the new RenderWidgetHost and returns it. Note that this can only be | 56 // Finds the new RenderWidgetHost and returns it. Note that this can only be |
| (...skipping 24 matching lines...) Expand all Loading... |
| 90 const gfx::Rect& initial_pos); | 81 const gfx::Rect& initial_pos); |
| 91 RenderWidgetHostView* ShowCreatedFullscreenWidget(TabContents* tab_contents, | 82 RenderWidgetHostView* ShowCreatedFullscreenWidget(TabContents* tab_contents, |
| 92 int route_id); | 83 int route_id); |
| 93 | 84 |
| 94 private: | 85 private: |
| 95 // content::NotificationObserver implementation | 86 // content::NotificationObserver implementation |
| 96 virtual void Observe(int type, | 87 virtual void Observe(int type, |
| 97 const content::NotificationSource& source, | 88 const content::NotificationSource& source, |
| 98 const content::NotificationDetails& details) OVERRIDE; | 89 const content::NotificationDetails& details) OVERRIDE; |
| 99 | 90 |
| 91 // Creates a new renderer for window.open. This will either be a |
| 92 // BackgroundContents (if the window_container_type == |
| 93 // WINDOW_CONTAINER_TYPE_BACKGROUND and permissions allow) or a TabContents. |
| 94 // If a TabContents is created, it is returned. Otherwise NULL is returned. |
| 95 TabContents* CreateNewWindow( |
| 96 int route_id, |
| 97 Profile* profile, |
| 98 SiteInstance* site, |
| 99 WebUI::TypeID webui_type, |
| 100 RenderViewHostDelegate* opener, |
| 101 WindowContainerType window_container_type, |
| 102 const string16& frame_name); |
| 103 |
| 100 BackgroundContents* MaybeCreateBackgroundContents( | 104 BackgroundContents* MaybeCreateBackgroundContents( |
| 101 int route_id, | 105 int route_id, |
| 102 Profile* profile, | 106 Profile* profile, |
| 103 SiteInstance* site, | 107 SiteInstance* site, |
| 104 const GURL& opener_url, | 108 const GURL& opener_url, |
| 105 const string16& frame_name); | 109 const string16& frame_name); |
| 106 | 110 |
| 107 // Tracks created RenderViewHost objects that have not been shown yet. | 111 // Tracks created RenderViewHost objects that have not been shown yet. |
| 108 // They are identified by the route ID passed to CreateNewWindow. | 112 // They are identified by the route ID passed to CreateNewWindow. |
| 109 typedef std::map<int, RenderViewHost*> PendingContents; | 113 typedef std::map<int, RenderViewHost*> PendingContents; |
| (...skipping 22 matching lines...) Expand all Loading... |
| 132 const std::string& value); | 136 const std::string& value); |
| 133 static void ClearInspectorSettings(content::BrowserContext* browser_context); | 137 static void ClearInspectorSettings(content::BrowserContext* browser_context); |
| 134 | 138 |
| 135 private: | 139 private: |
| 136 RenderViewHostDelegateHelper(); | 140 RenderViewHostDelegateHelper(); |
| 137 | 141 |
| 138 DISALLOW_COPY_AND_ASSIGN(RenderViewHostDelegateHelper); | 142 DISALLOW_COPY_AND_ASSIGN(RenderViewHostDelegateHelper); |
| 139 }; | 143 }; |
| 140 | 144 |
| 141 #endif // CHROME_BROWSER_TAB_CONTENTS_RENDER_VIEW_HOST_DELEGATE_HELPER_H_ | 145 #endif // CHROME_BROWSER_TAB_CONTENTS_RENDER_VIEW_HOST_DELEGATE_HELPER_H_ |
| OLD | NEW |