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

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

Issue 172120: Revert "Revert "Allow DOMUI pages to call window.open(), giving DOMUI privileges to the new"" (Closed)
Patch Set: Created 11 years, 3 months 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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 "render_view_host_delegate_helper.h" 5 #include "render_view_host_delegate_helper.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "chrome/browser/browser.h" 8 #include "chrome/browser/browser.h"
9 #include "chrome/browser/character_encoding.h" 9 #include "chrome/browser/character_encoding.h"
10 #include "chrome/browser/profile.h" 10 #include "chrome/browser/profile.h"
11 #include "chrome/browser/renderer_host/render_view_host.h" 11 #include "chrome/browser/renderer_host/render_view_host.h"
12 #include "chrome/browser/renderer_host/render_process_host.h" 12 #include "chrome/browser/renderer_host/render_process_host.h"
13 #include "chrome/browser/renderer_host/render_widget_host.h" 13 #include "chrome/browser/renderer_host/render_widget_host.h"
14 #include "chrome/browser/renderer_host/render_widget_host_view.h" 14 #include "chrome/browser/renderer_host/render_widget_host_view.h"
15 #include "chrome/browser/renderer_host/site_instance.h" 15 #include "chrome/browser/renderer_host/site_instance.h"
16 #include "chrome/browser/tab_contents/tab_contents.h" 16 #include "chrome/browser/tab_contents/tab_contents.h"
17 #include "chrome/browser/tab_contents/tab_contents_view.h" 17 #include "chrome/browser/tab_contents/tab_contents_view.h"
18 #include "chrome/common/chrome_switches.h" 18 #include "chrome/common/chrome_switches.h"
19 #include "chrome/common/pref_names.h" 19 #include "chrome/common/pref_names.h"
20 #include "chrome/common/pref_service.h" 20 #include "chrome/common/pref_service.h"
21 21
22 void RenderViewHostDelegateViewHelper::CreateNewWindow(int route_id, 22 void RenderViewHostDelegateViewHelper::CreateNewWindow(int route_id,
23 base::WaitableEvent* modal_dialog_event, Profile* profile, 23 base::WaitableEvent* modal_dialog_event, Profile* profile,
24 SiteInstance* site) { 24 SiteInstance* site, DOMUITypeID domui_type) {
25 // Create the new web contents. This will automatically create the new 25 // Create the new web contents. This will automatically create the new
26 // TabContentsView. In the future, we may want to create the view separately. 26 // TabContentsView. In the future, we may want to create the view separately.
27 TabContents* new_contents = 27 TabContents* new_contents =
28 new TabContents(profile, 28 new TabContents(profile,
29 site, 29 site,
30 route_id, 30 route_id,
31 modal_dialog_event); 31 modal_dialog_event);
32 new_contents->set_opener_dom_ui_type(domui_type);
32 TabContentsView* new_view = new_contents->view(); 33 TabContentsView* new_view = new_contents->view();
33 34
34 // TODO(brettw) it seems bogus that we have to call this function on the 35 // TODO(brettw) it seems bogus that we have to call this function on the
35 // newly created object and give it one of its own member variables. 36 // newly created object and give it one of its own member variables.
36 new_view->CreateViewForWidget(new_contents->render_view_host()); 37 new_view->CreateViewForWidget(new_contents->render_view_host());
37 38
38 // Save the created window associated with the route so we can show it later. 39 // Save the created window associated with the route so we can show it later.
39 pending_contents_[route_id] = new_contents; 40 pending_contents_[route_id] = new_contents;
40 } 41 }
41 42
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 } 207 }
207 DCHECK(!web_prefs.default_encoding.empty()); 208 DCHECK(!web_prefs.default_encoding.empty());
208 209
209 if (is_dom_ui) { 210 if (is_dom_ui) {
210 web_prefs.loads_images_automatically = true; 211 web_prefs.loads_images_automatically = true;
211 web_prefs.javascript_enabled = true; 212 web_prefs.javascript_enabled = true;
212 } 213 }
213 214
214 return web_prefs; 215 return web_prefs;
215 } 216 }
OLDNEW
« no previous file with comments | « chrome/browser/tab_contents/render_view_host_delegate_helper.h ('k') | chrome/browser/tab_contents/render_view_host_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698