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

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: Fixed lifetime Created 6 years, 6 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) 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 420 matching lines...) Expand 10 before | Expand all | Expand 10 after
431 destruction_observers_.end()); 431 destruction_observers_.end());
432 } 432 }
433 433
434 WebContentsImpl* WebContentsImpl::CreateWithOpener( 434 WebContentsImpl* WebContentsImpl::CreateWithOpener(
435 const WebContents::CreateParams& params, 435 const WebContents::CreateParams& params,
436 WebContentsImpl* opener) { 436 WebContentsImpl* opener) {
437 TRACE_EVENT0("browser", "WebContentsImpl::CreateWithOpener"); 437 TRACE_EVENT0("browser", "WebContentsImpl::CreateWithOpener");
438 WebContentsImpl* new_contents = new WebContentsImpl( 438 WebContentsImpl* new_contents = new WebContentsImpl(
439 params.browser_context, params.opener_suppressed ? NULL : opener); 439 params.browser_context, params.opener_suppressed ? NULL : opener);
440 440
441 if (params.guest_instance_id) { 441 if (params.guest_delegate) {
442 scoped_ptr<base::DictionaryValue> extra_params;
443 if (params.guest_extra_params)
444 extra_params.reset(params.guest_extra_params->DeepCopy());
445 // This makes |new_contents| act as a guest. 442 // This makes |new_contents| act as a guest.
446 // For more info, see comment above class BrowserPluginGuest. 443 // For more info, see comment above class BrowserPluginGuest.
447 BrowserPluginGuest::Create(params.guest_instance_id, 444 BrowserPluginGuest::Create(params.guest_delegate->GetGuestInstanceID(),
448 params.site_instance,
449 new_contents, 445 new_contents,
450 extra_params.Pass(), 446 params.guest_delegate);
451 opener ? opener->GetBrowserPluginGuest() : NULL);
452 // We are instantiating a WebContents for browser plugin. Set its subframe 447 // We are instantiating a WebContents for browser plugin. Set its subframe
453 // bit to true. 448 // bit to true.
454 new_contents->is_subframe_ = true; 449 new_contents->is_subframe_ = true;
455 } 450 }
456 new_contents->Init(params); 451 new_contents->Init(params);
457 return new_contents; 452 return new_contents;
458 } 453 }
459 454
460 RenderFrameHostManager* WebContentsImpl::GetRenderManagerForTesting() { 455 RenderFrameHostManager* WebContentsImpl::GetRenderManagerForTesting() {
461 return GetRenderManager(); 456 return GetRenderManager();
(...skipping 953 matching lines...) Expand 10 before | Expand all | Expand 10 after
1415 // Create the new web contents. This will automatically create the new 1410 // Create the new web contents. This will automatically create the new
1416 // WebContentsView. In the future, we may want to create the view separately. 1411 // WebContentsView. In the future, we may want to create the view separately.
1417 CreateParams create_params(GetBrowserContext(), site_instance.get()); 1412 CreateParams create_params(GetBrowserContext(), site_instance.get());
1418 create_params.routing_id = route_id; 1413 create_params.routing_id = route_id;
1419 create_params.main_frame_routing_id = main_frame_route_id; 1414 create_params.main_frame_routing_id = main_frame_route_id;
1420 create_params.opener = this; 1415 create_params.opener = this;
1421 create_params.opener_suppressed = params.opener_suppressed; 1416 create_params.opener_suppressed = params.opener_suppressed;
1422 if (params.disposition == NEW_BACKGROUND_TAB) 1417 if (params.disposition == NEW_BACKGROUND_TAB)
1423 create_params.initially_hidden = true; 1418 create_params.initially_hidden = true;
1424 1419
1420 WebContentsImpl* new_contents = NULL;
1425 if (!is_guest) { 1421 if (!is_guest) {
1426 create_params.context = view_->GetNativeView(); 1422 create_params.context = view_->GetNativeView();
1427 create_params.initial_size = GetContainerBounds().size(); 1423 create_params.initial_size = GetContainerBounds().size();
1428 } else { 1424 new_contents = static_cast<WebContentsImpl*>(
1429 create_params.guest_instance_id = 1425 WebContents::Create(create_params));
1430 GetBrowserContext()->GetGuestManager()->GetNextInstanceID(); 1426 } else {
1427 new_contents = GetBrowserPluginGuest()->CreateNewGuestWindow(
1428 &create_params);
lazyboy 2014/06/17 23:46:46 |create_params| being a (mutable) pointer to Creat
Fady Samuel 2014/06/18 21:08:34 Done.
1431 } 1429 }
1432 WebContentsImpl* new_contents = static_cast<WebContentsImpl*>(
1433 WebContents::Create(create_params));
1434 new_contents->GetController().SetSessionStorageNamespace( 1430 new_contents->GetController().SetSessionStorageNamespace(
lazyboy 2014/06/17 23:46:46 DCHECK(new_contents)
Fady Samuel 2014/06/18 21:08:34 Unnecessary. We will always segfault here.
1435 partition_id, 1431 partition_id,
1436 session_storage_namespace); 1432 session_storage_namespace);
1437 new_contents->RenderViewCreated(new_contents->GetRenderViewHost()); 1433 new_contents->RenderViewCreated(new_contents->GetRenderViewHost());
1438 1434
1439 // Save the window for later if we're not suppressing the opener (since it 1435 // Save the window for later if we're not suppressing the opener (since it
1440 // will be shown immediately). 1436 // will be shown immediately).
1441 if (!params.opener_suppressed) { 1437 if (!params.opener_suppressed) {
1442 if (!is_guest) { 1438 if (!is_guest) {
1443 WebContentsView* new_view = new_contents->view_.get(); 1439 WebContentsView* new_view = new_contents->view_.get();
1444 1440
(...skipping 2623 matching lines...) Expand 10 before | Expand all | Expand 10 after
4068 4064
4069 void WebContentsImpl::OnPreferredSizeChanged(const gfx::Size& old_size) { 4065 void WebContentsImpl::OnPreferredSizeChanged(const gfx::Size& old_size) {
4070 if (!delegate_) 4066 if (!delegate_)
4071 return; 4067 return;
4072 const gfx::Size new_size = GetPreferredSize(); 4068 const gfx::Size new_size = GetPreferredSize();
4073 if (new_size != old_size) 4069 if (new_size != old_size)
4074 delegate_->UpdatePreferredSize(this, new_size); 4070 delegate_->UpdatePreferredSize(this, new_size);
4075 } 4071 }
4076 4072
4077 } // namespace content 4073 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698