| 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/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
| (...skipping 2360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2371 void WebContentsImpl::OnBrowserPluginCreateGuest( | 2371 void WebContentsImpl::OnBrowserPluginCreateGuest( |
| 2372 int instance_id, | 2372 int instance_id, |
| 2373 const std::string& storage_partition_id, | 2373 const std::string& storage_partition_id, |
| 2374 bool persist_storage) { | 2374 bool persist_storage) { |
| 2375 // This creates a BrowserPluginEmbedder, which handles all the BrowserPlugin | 2375 // This creates a BrowserPluginEmbedder, which handles all the BrowserPlugin |
| 2376 // specific messages for this WebContents (through its | 2376 // specific messages for this WebContents (through its |
| 2377 // BrowserPluginEmbedderHelper). This means that any message from browser | 2377 // BrowserPluginEmbedderHelper). This means that any message from browser |
| 2378 // plugin renderer prior to CreateGuest will be ignored. | 2378 // plugin renderer prior to CreateGuest will be ignored. |
| 2379 // For more info, see comment above classes BrowserPluginEmbedder and | 2379 // For more info, see comment above classes BrowserPluginEmbedder and |
| 2380 // BrowserPluginGuest. | 2380 // BrowserPluginGuest. |
| 2381 // The first BrowserPluginHostMsg_CreateGuest message from this WebContents' |
| 2382 // embedder render process is handled here. Once BrowserPluginEmbedder is |
| 2383 // created, all subsequent BrowserPluginHostMsg_CreateGuest messages are |
| 2384 // intercepted by the BrowserPluginEmbedderHelper and handled by the |
| 2385 // BrowserPluginEmbedder. Thus, this code will not be executed if a |
| 2386 // BrowserPluginEmbedder exists for this WebContents. |
| 2381 CHECK(!browser_plugin_embedder_.get()); | 2387 CHECK(!browser_plugin_embedder_.get()); |
| 2382 | |
| 2383 browser_plugin_embedder_.reset( | 2388 browser_plugin_embedder_.reset( |
| 2384 content::BrowserPluginEmbedder::Create(this, GetRenderViewHost())); | 2389 content::BrowserPluginEmbedder::Create(this, GetRenderViewHost())); |
| 2385 browser_plugin_embedder_->CreateGuest(GetRenderViewHost(), | 2390 browser_plugin_embedder_->CreateGuest(GetRenderViewHost(), |
| 2386 instance_id, | 2391 instance_id, |
| 2387 storage_partition_id, | 2392 storage_partition_id, |
| 2388 persist_storage); | 2393 persist_storage); |
| 2389 } | 2394 } |
| 2390 | 2395 |
| 2391 void WebContentsImpl::OnBrowserPluginNavigateGuest( | |
| 2392 int instance_id, | |
| 2393 const std::string& src, | |
| 2394 const BrowserPluginHostMsg_ResizeGuest_Params& resize_params) { | |
| 2395 browser_plugin_embedder_->NavigateGuest(GetRenderViewHost(), | |
| 2396 instance_id, | |
| 2397 src, | |
| 2398 resize_params); | |
| 2399 } | |
| 2400 | |
| 2401 // Notifies the RenderWidgetHost instance about the fact that the page is | 2396 // Notifies the RenderWidgetHost instance about the fact that the page is |
| 2402 // loading, or done loading and calls the base implementation. | 2397 // loading, or done loading and calls the base implementation. |
| 2403 void WebContentsImpl::SetIsLoading(bool is_loading, | 2398 void WebContentsImpl::SetIsLoading(bool is_loading, |
| 2404 LoadNotificationDetails* details) { | 2399 LoadNotificationDetails* details) { |
| 2405 if (is_loading == is_loading_) | 2400 if (is_loading == is_loading_) |
| 2406 return; | 2401 return; |
| 2407 | 2402 |
| 2408 if (!is_loading) { | 2403 if (!is_loading) { |
| 2409 load_state_ = net::LoadStateWithParam(net::LOAD_STATE_IDLE, string16()); | 2404 load_state_ = net::LoadStateWithParam(net::LOAD_STATE_IDLE, string16()); |
| 2410 load_state_host_.clear(); | 2405 load_state_host_.clear(); |
| (...skipping 979 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3390 } | 3385 } |
| 3391 } | 3386 } |
| 3392 | 3387 |
| 3393 content::BrowserPluginGuest* WebContentsImpl::GetBrowserPluginGuest() { | 3388 content::BrowserPluginGuest* WebContentsImpl::GetBrowserPluginGuest() { |
| 3394 return browser_plugin_guest_.get(); | 3389 return browser_plugin_guest_.get(); |
| 3395 } | 3390 } |
| 3396 | 3391 |
| 3397 content::BrowserPluginEmbedder* WebContentsImpl::GetBrowserPluginEmbedder() { | 3392 content::BrowserPluginEmbedder* WebContentsImpl::GetBrowserPluginEmbedder() { |
| 3398 return browser_plugin_embedder_.get(); | 3393 return browser_plugin_embedder_.get(); |
| 3399 } | 3394 } |
| OLD | NEW |