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

Side by Side Diff: chrome/browser/tab_contents/render_view_host_delegate_helper.cc

Issue 8760024: Cross-process postMessage (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Current checkpoint Created 9 years 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
OLDNEW
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 #include "chrome/browser/tab_contents/render_view_host_delegate_helper.h" 5 #include "chrome/browser/tab_contents/render_view_host_delegate_helper.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/string_util.h" 8 #include "base/string_util.h"
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "chrome/browser/background/background_contents_service.h" 10 #include "chrome/browser/background/background_contents_service.h"
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 // Passed all the checks, so this should be created as a BackgroundContents. 133 // Passed all the checks, so this should be created as a BackgroundContents.
134 return service->CreateBackgroundContents(site, route_id, profile, frame_name, 134 return service->CreateBackgroundContents(site, route_id, profile, frame_name,
135 ASCIIToUTF16(extension->id())); 135 ASCIIToUTF16(extension->id()));
136 } 136 }
137 137
138 TabContents* RenderViewHostDelegateViewHelper::CreateNewWindow( 138 TabContents* RenderViewHostDelegateViewHelper::CreateNewWindow(
139 int route_id, 139 int route_id,
140 Profile* profile, 140 Profile* profile,
141 SiteInstance* site, 141 SiteInstance* site,
142 WebUI::TypeID webui_type, 142 WebUI::TypeID webui_type,
143 RenderViewHostDelegate* opener, 143 content::ContentFrame* opener,
144 WindowContainerType window_container_type, 144 WindowContainerType window_container_type,
145 const string16& frame_name) { 145 const string16& frame_name) {
146 if (window_container_type == WINDOW_CONTAINER_TYPE_BACKGROUND) { 146 if (window_container_type == WINDOW_CONTAINER_TYPE_BACKGROUND) {
147 BackgroundContents* contents = MaybeCreateBackgroundContents( 147 BackgroundContents* contents = MaybeCreateBackgroundContents(
148 route_id, 148 route_id,
149 profile, 149 profile,
150 site, 150 site,
151 opener->GetURL(), 151 opener->tab_contents().GetURL(),
152 frame_name); 152 frame_name);
153 if (contents) { 153 if (contents) {
154 pending_contents_[route_id] = 154 pending_contents_[route_id] =
155 contents->tab_contents()->render_view_host(); 155 contents->tab_contents()->render_view_host();
156 return NULL; 156 return NULL;
157 } 157 }
158 } 158 }
159 159
160 TabContents* base_tab_contents = opener->GetAsTabContents(); 160 TabContents* base_tab_contents = &opener->tab_contents();
161 161
162 // Do not create the new TabContents if the opener is a prerender TabContents. 162 // Do not create the new TabContents if the opener is a prerender TabContents.
163 prerender::PrerenderManager* prerender_manager = 163 prerender::PrerenderManager* prerender_manager =
164 prerender::PrerenderManagerFactory::GetForProfile(profile); 164 prerender::PrerenderManagerFactory::GetForProfile(profile);
165 if (prerender_manager && 165 if (prerender_manager &&
166 prerender_manager->IsTabContentsPrerendering(base_tab_contents)) { 166 prerender_manager->IsTabContentsPrerendering(base_tab_contents)) {
167 return NULL; 167 return NULL;
168 } 168 }
169 169
170 // Create the new web contents. This will automatically create the new 170 // Create the new web contents. This will automatically create the new
171 // TabContentsView. In the future, we may want to create the view separately. 171 // TabContentsView. In the future, we may want to create the view separately.
172 TabContents* new_contents = 172 TabContents* new_contents =
173 new TabContents(profile, 173 new TabContents(profile,
174 site, 174 site,
175 route_id, 175 route_id,
176 base_tab_contents, 176 opener,
177 NULL); 177 NULL);
178 new_contents->set_opener_web_ui_type(webui_type); 178 new_contents->set_opener_web_ui_type(webui_type);
179 TabContentsView* new_view = new_contents->view(); 179 TabContentsView* new_view = new_contents->view();
180 180
181 // TODO(brettw) it seems bogus that we have to call this function on the 181 // TODO(brettw) it seems bogus that we have to call this function on the
182 // newly created object and give it one of its own member variables. 182 // newly created object and give it one of its own member variables.
183 new_view->CreateViewForWidget(new_contents->render_view_host()); 183 new_view->CreateViewForWidget(new_contents->render_view_host());
184 184
185 // Save the created window associated with the route so we can show it later. 185 // Save the created window associated with the route so we can show it later.
186 pending_contents_[route_id] = new_contents->render_view_host(); 186 pending_contents_[route_id] = new_contents->render_view_host();
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 248
249 RenderWidgetHost* widget_host = widget_host_view->GetRenderWidgetHost(); 249 RenderWidgetHost* widget_host = widget_host_view->GetRenderWidgetHost();
250 if (!widget_host->process()->HasConnection()) { 250 if (!widget_host->process()->HasConnection()) {
251 // The view has gone away or the renderer crashed. Nothing to do. 251 // The view has gone away or the renderer crashed. Nothing to do.
252 return NULL; 252 return NULL;
253 } 253 }
254 254
255 return widget_host_view; 255 return widget_host_view;
256 } 256 }
257 257
258 TabContents* RenderViewHostDelegateViewHelper::CreateNewWindowFromTabContents( 258 TabContents* RenderViewHostDelegateViewHelper::CreateNewWindowFromContentFrame(
259 TabContents* tab_contents, 259 content::ContentFrame* opener,
260 int route_id, 260 int route_id,
261 const ViewHostMsg_CreateWindow_Params& params) { 261 const ViewHostMsg_CreateWindow_Params& params) {
262 TabContents* tab_contents = &opener->tab_contents();
262 TabContents* new_contents = CreateNewWindow( 263 TabContents* new_contents = CreateNewWindow(
263 route_id, 264 route_id,
264 Profile::FromBrowserContext(tab_contents->browser_context()), 265 Profile::FromBrowserContext(tab_contents->browser_context()),
265 tab_contents->GetSiteInstance(), 266 tab_contents->GetSiteInstance(),
266 tab_contents->GetWebUITypeForCurrentState(), 267 tab_contents->GetWebUITypeForCurrentState(),
267 tab_contents, 268 opener,
268 params.window_container_type, 269 params.window_container_type,
269 params.frame_name); 270 params.frame_name);
270 271
271 if (new_contents) { 272 if (new_contents) {
272 if (tab_contents->delegate()) 273 if (tab_contents->delegate())
273 tab_contents->delegate()->TabContentsCreated(new_contents); 274 tab_contents->delegate()->TabContentsCreated(new_contents);
274 275
275 RetargetingDetails details; 276 RetargetingDetails details;
276 details.source_tab_contents = tab_contents; 277 details.source_tab_contents = tab_contents;
277 details.source_frame_id = params.opener_frame_id; 278 details.source_frame_id = params.opener_frame_id;
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after
590 DictionaryValue* inspector_settings = update.Get(); 591 DictionaryValue* inspector_settings = update.Get();
591 inspector_settings->SetWithoutPathExpansion(key, 592 inspector_settings->SetWithoutPathExpansion(key,
592 Value::CreateStringValue(value)); 593 Value::CreateStringValue(value));
593 } 594 }
594 595
595 void RenderViewHostDelegateHelper::ClearInspectorSettings( 596 void RenderViewHostDelegateHelper::ClearInspectorSettings(
596 content::BrowserContext* browser_context) { 597 content::BrowserContext* browser_context) {
597 Profile::FromBrowserContext(browser_context)->GetPrefs()-> 598 Profile::FromBrowserContext(browser_context)->GetPrefs()->
598 ClearPref(prefs::kWebKitInspectorSettings); 599 ClearPref(prefs::kWebKitInspectorSettings);
599 } 600 }
OLDNEW
« no previous file with comments | « chrome/browser/tab_contents/render_view_host_delegate_helper.h ('k') | chrome/browser/tab_contents/tab_contents_view_gtk.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698