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

Side by Side Diff: content/browser/web_contents/web_contents_impl.cc

Issue 336283002: Remove GuestWebContentsCreated (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@simplify_creation
Patch Set: Merge with ToT Created 6 years, 5 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
« no previous file with comments | « content/browser/browser_plugin/browser_plugin_guest.cc ('k') | content/content_browser.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "content/browser/web_contents/web_contents_impl.h" 5 #include "content/browser/web_contents/web_contents_impl.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after
433 destruction_observers_.end()); 433 destruction_observers_.end());
434 } 434 }
435 435
436 WebContentsImpl* WebContentsImpl::CreateWithOpener( 436 WebContentsImpl* WebContentsImpl::CreateWithOpener(
437 const WebContents::CreateParams& params, 437 const WebContents::CreateParams& params,
438 WebContentsImpl* opener) { 438 WebContentsImpl* opener) {
439 TRACE_EVENT0("browser", "WebContentsImpl::CreateWithOpener"); 439 TRACE_EVENT0("browser", "WebContentsImpl::CreateWithOpener");
440 WebContentsImpl* new_contents = new WebContentsImpl( 440 WebContentsImpl* new_contents = new WebContentsImpl(
441 params.browser_context, params.opener_suppressed ? NULL : opener); 441 params.browser_context, params.opener_suppressed ? NULL : opener);
442 442
443 if (params.guest_instance_id) { 443 if (params.guest_delegate) {
444 scoped_ptr<base::DictionaryValue> extra_params;
445 if (params.guest_extra_params)
446 extra_params.reset(params.guest_extra_params->DeepCopy());
447 // This makes |new_contents| act as a guest. 444 // This makes |new_contents| act as a guest.
448 // For more info, see comment above class BrowserPluginGuest. 445 // For more info, see comment above class BrowserPluginGuest.
449 BrowserPluginGuest::Create(params.guest_instance_id, 446 BrowserPluginGuest::Create(params.guest_delegate->GetGuestInstanceID(),
450 params.site_instance,
451 new_contents, 447 new_contents,
452 extra_params.Pass(), 448 params.guest_delegate);
453 opener ? opener->GetBrowserPluginGuest() : NULL);
454 // We are instantiating a WebContents for browser plugin. Set its subframe 449 // We are instantiating a WebContents for browser plugin. Set its subframe
455 // bit to true. 450 // bit to true.
456 new_contents->is_subframe_ = true; 451 new_contents->is_subframe_ = true;
457 } 452 }
458 new_contents->Init(params); 453 new_contents->Init(params);
459 return new_contents; 454 return new_contents;
460 } 455 }
461 456
462 RenderFrameHostManager* WebContentsImpl::GetRenderManagerForTesting() { 457 RenderFrameHostManager* WebContentsImpl::GetRenderManagerForTesting() {
463 return GetRenderManager(); 458 return GetRenderManager();
(...skipping 958 matching lines...) Expand 10 before | Expand all | Expand 10 after
1422 // Create the new web contents. This will automatically create the new 1417 // Create the new web contents. This will automatically create the new
1423 // WebContentsView. In the future, we may want to create the view separately. 1418 // WebContentsView. In the future, we may want to create the view separately.
1424 CreateParams create_params(GetBrowserContext(), site_instance.get()); 1419 CreateParams create_params(GetBrowserContext(), site_instance.get());
1425 create_params.routing_id = route_id; 1420 create_params.routing_id = route_id;
1426 create_params.main_frame_routing_id = main_frame_route_id; 1421 create_params.main_frame_routing_id = main_frame_route_id;
1427 create_params.opener = this; 1422 create_params.opener = this;
1428 create_params.opener_suppressed = params.opener_suppressed; 1423 create_params.opener_suppressed = params.opener_suppressed;
1429 if (params.disposition == NEW_BACKGROUND_TAB) 1424 if (params.disposition == NEW_BACKGROUND_TAB)
1430 create_params.initially_hidden = true; 1425 create_params.initially_hidden = true;
1431 1426
1427 WebContentsImpl* new_contents = NULL;
1432 if (!is_guest) { 1428 if (!is_guest) {
1433 create_params.context = view_->GetNativeView(); 1429 create_params.context = view_->GetNativeView();
1434 create_params.initial_size = GetContainerBounds().size(); 1430 create_params.initial_size = GetContainerBounds().size();
1435 } else { 1431 new_contents = static_cast<WebContentsImpl*>(
1436 create_params.guest_instance_id = 1432 WebContents::Create(create_params));
1437 GetBrowserContext()->GetGuestManager()->GetNextInstanceID(); 1433 } else {
1434 new_contents = GetBrowserPluginGuest()->CreateNewGuestWindow(create_params);
1438 } 1435 }
1439 WebContentsImpl* new_contents = static_cast<WebContentsImpl*>(
1440 WebContents::Create(create_params));
1441 new_contents->GetController().SetSessionStorageNamespace( 1436 new_contents->GetController().SetSessionStorageNamespace(
1442 partition_id, 1437 partition_id,
1443 session_storage_namespace); 1438 session_storage_namespace);
1444 new_contents->RenderViewCreated(new_contents->GetRenderViewHost()); 1439 new_contents->RenderViewCreated(new_contents->GetRenderViewHost());
1445 1440
1446 // Save the window for later if we're not suppressing the opener (since it 1441 // Save the window for later if we're not suppressing the opener (since it
1447 // will be shown immediately). 1442 // will be shown immediately).
1448 if (!params.opener_suppressed) { 1443 if (!params.opener_suppressed) {
1449 if (!is_guest) { 1444 if (!is_guest) {
1450 WebContentsView* new_view = new_contents->view_.get(); 1445 WebContentsView* new_view = new_contents->view_.get();
(...skipping 2649 matching lines...) Expand 10 before | Expand all | Expand 10 after
4100 if (new_size != old_size) 4095 if (new_size != old_size)
4101 delegate_->UpdatePreferredSize(this, new_size); 4096 delegate_->UpdatePreferredSize(this, new_size);
4102 } 4097 }
4103 4098
4104 void WebContentsImpl::ResumeResponseDeferredAtStart() { 4099 void WebContentsImpl::ResumeResponseDeferredAtStart() {
4105 FrameTreeNode* node = frame_tree_.root(); 4100 FrameTreeNode* node = frame_tree_.root();
4106 node->render_manager()->ResumeResponseDeferredAtStart(); 4101 node->render_manager()->ResumeResponseDeferredAtStart();
4107 } 4102 }
4108 4103
4109 } // namespace content 4104 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/browser_plugin/browser_plugin_guest.cc ('k') | content/content_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698