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

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

Issue 261013005: BrowserPlugin: Move CreateGuest to chrome (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@guestview_manager_simplify_api
Patch Set: Removed unnecessary includes Created 6 years, 7 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 409 matching lines...) Expand 10 before | Expand all | Expand 10 after
420 FOR_EACH_OBSERVER(WebContentsObserver, 420 FOR_EACH_OBSERVER(WebContentsObserver,
421 observers_, 421 observers_,
422 WebContentsImplDestroyed()); 422 WebContentsImplDestroyed());
423 423
424 SetDelegate(NULL); 424 SetDelegate(NULL);
425 425
426 STLDeleteContainerPairSecondPointers(destruction_observers_.begin(), 426 STLDeleteContainerPairSecondPointers(destruction_observers_.begin(),
427 destruction_observers_.end()); 427 destruction_observers_.end());
428 } 428 }
429 429
430 WebContentsImpl* WebContentsImpl::CreateWithOpener( 430 WebContentsImpl* WebContentsImpl::CreateWithOpener(
jam 2014/05/06 23:43:53 what is the callstack when this method is called w
Fady Samuel 2014/05/07 00:07:47 This bouncing from content to chrome and back shou
431 const WebContents::CreateParams& params, 431 const WebContents::CreateParams& params,
432 WebContentsImpl* opener) { 432 WebContentsImpl* opener) {
433 TRACE_EVENT0("browser", "WebContentsImpl::CreateWithOpener"); 433 TRACE_EVENT0("browser", "WebContentsImpl::CreateWithOpener");
434 WebContentsImpl* new_contents = new WebContentsImpl( 434 WebContentsImpl* new_contents = new WebContentsImpl(
435 params.browser_context, opener); 435 params.browser_context, opener);
436 436
437 if (params.guest_instance_id) {
438 scoped_ptr<base::DictionaryValue> extra_params(
439 params.guest_extra_params->DeepCopy());
440 // This makes |new_contents| act as a guest.
441 // For more info, see comment above class BrowserPluginGuest.
442 BrowserPluginGuest::Create(params.guest_instance_id,
443 params.site_instance,
444 new_contents,
445 extra_params.Pass());
446 // We are instantiating a WebContents for browser plugin. Set its subframe
447 // bit to true.
448 new_contents->is_subframe_ = true;
449 }
437 new_contents->Init(params); 450 new_contents->Init(params);
438 return new_contents; 451 return new_contents;
439 } 452 }
440 453
441 // static
442 BrowserPluginGuest* WebContentsImpl::CreateGuest(
443 BrowserContext* browser_context,
444 SiteInstance* site_instance,
445 int guest_instance_id,
446 scoped_ptr<base::DictionaryValue> extra_params) {
447 WebContentsImpl* new_contents = new WebContentsImpl(browser_context, NULL);
448
449 // This makes |new_contents| act as a guest.
450 // For more info, see comment above class BrowserPluginGuest.
451 BrowserPluginGuest::Create(
452 guest_instance_id, site_instance, new_contents, extra_params.Pass());
453
454 WebContents::CreateParams create_params(browser_context, site_instance);
455 new_contents->Init(create_params);
456
457 // We are instantiating a WebContents for browser plugin. Set its subframe bit
458 // to true.
459 new_contents->is_subframe_ = true;
460
461 return new_contents->browser_plugin_guest_.get();
462 }
463
464 RenderFrameHostManager* WebContentsImpl::GetRenderManagerForTesting() { 454 RenderFrameHostManager* WebContentsImpl::GetRenderManagerForTesting() {
465 return GetRenderManager(); 455 return GetRenderManager();
466 } 456 }
467 457
468 bool WebContentsImpl::OnMessageReceived(RenderViewHost* render_view_host, 458 bool WebContentsImpl::OnMessageReceived(RenderViewHost* render_view_host,
469 const IPC::Message& message) { 459 const IPC::Message& message) {
470 return OnMessageReceived(render_view_host, NULL, message); 460 return OnMessageReceived(render_view_host, NULL, message);
471 } 461 }
472 462
473 bool WebContentsImpl::OnMessageReceived(RenderViewHost* render_view_host, 463 bool WebContentsImpl::OnMessageReceived(RenderViewHost* render_view_host,
(...skipping 3506 matching lines...) Expand 10 before | Expand all | Expand 10 after
3980 3970
3981 void WebContentsImpl::OnPreferredSizeChanged(const gfx::Size& old_size) { 3971 void WebContentsImpl::OnPreferredSizeChanged(const gfx::Size& old_size) {
3982 if (!delegate_) 3972 if (!delegate_)
3983 return; 3973 return;
3984 const gfx::Size new_size = GetPreferredSize(); 3974 const gfx::Size new_size = GetPreferredSize();
3985 if (new_size != old_size) 3975 if (new_size != old_size)
3986 delegate_->UpdatePreferredSize(this, new_size); 3976 delegate_->UpdatePreferredSize(this, new_size);
3987 } 3977 }
3988 3978
3989 } // namespace content 3979 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698