Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 427 destruction_observers_.end()); | 427 destruction_observers_.end()); |
| 428 } | 428 } |
| 429 | 429 |
| 430 WebContentsImpl* WebContentsImpl::CreateWithOpener( | 430 WebContentsImpl* WebContentsImpl::CreateWithOpener( |
| 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( | |
| 443 params.guest_instance_id, | |
|
lazyboy
2014/05/02 19:52:52
nit: params can fit in previous line.
Fady Samuel
2014/05/06 20:02:48
Done.
| |
| 444 params.site_instance, | |
| 445 new_contents, | |
| 446 extra_params.Pass()); | |
| 447 // We are instantiating a WebContents for browser plugin. Set its subframe | |
| 448 // bit to true. | |
| 449 new_contents->is_subframe_ = true; | |
| 450 } | |
| 437 new_contents->Init(params); | 451 new_contents->Init(params); |
| 438 return new_contents; | 452 return new_contents; |
| 439 } | 453 } |
| 440 | 454 |
| 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() { | 455 RenderFrameHostManager* WebContentsImpl::GetRenderManagerForTesting() { |
| 465 return GetRenderManager(); | 456 return GetRenderManager(); |
| 466 } | 457 } |
| 467 | 458 |
| 468 bool WebContentsImpl::OnMessageReceived(RenderViewHost* render_view_host, | 459 bool WebContentsImpl::OnMessageReceived(RenderViewHost* render_view_host, |
| 469 const IPC::Message& message) { | 460 const IPC::Message& message) { |
| 470 return OnMessageReceived(render_view_host, NULL, message); | 461 return OnMessageReceived(render_view_host, NULL, message); |
| 471 } | 462 } |
| 472 | 463 |
| 473 bool WebContentsImpl::OnMessageReceived(RenderViewHost* render_view_host, | 464 bool WebContentsImpl::OnMessageReceived(RenderViewHost* render_view_host, |
| (...skipping 3445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3919 | 3910 |
| 3920 void WebContentsImpl::OnPreferredSizeChanged(const gfx::Size& old_size) { | 3911 void WebContentsImpl::OnPreferredSizeChanged(const gfx::Size& old_size) { |
| 3921 if (!delegate_) | 3912 if (!delegate_) |
| 3922 return; | 3913 return; |
| 3923 const gfx::Size new_size = GetPreferredSize(); | 3914 const gfx::Size new_size = GetPreferredSize(); |
| 3924 if (new_size != old_size) | 3915 if (new_size != old_size) |
| 3925 delegate_->UpdatePreferredSize(this, new_size); | 3916 delegate_->UpdatePreferredSize(this, new_size); |
| 3926 } | 3917 } |
| 3927 | 3918 |
| 3928 } // namespace content | 3919 } // namespace content |
| OLD | NEW |