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 1144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1155 } | 1155 } |
1156 break; | 1156 break; |
1157 } | 1157 } |
1158 default: | 1158 default: |
1159 NOTREACHED(); | 1159 NOTREACHED(); |
1160 } | 1160 } |
1161 } | 1161 } |
1162 | 1162 |
1163 void WebContentsImpl::Init(const WebContents::CreateParams& params) { | 1163 void WebContentsImpl::Init(const WebContents::CreateParams& params) { |
1164 render_manager_.Init( | 1164 render_manager_.Init( |
1165 params.browser_context, params.site_instance, params.routing_id); | 1165 params.browser_context, params.site_instance, params.routing_id, |
| 1166 params.main_frame_routing_id); |
1166 | 1167 |
1167 view_.reset(GetContentClient()->browser()-> | 1168 view_.reset(GetContentClient()->browser()-> |
1168 OverrideCreateWebContentsView(this, &render_view_host_delegate_view_)); | 1169 OverrideCreateWebContentsView(this, &render_view_host_delegate_view_)); |
1169 if (view_) { | 1170 if (view_) { |
1170 CHECK(render_view_host_delegate_view_); | 1171 CHECK(render_view_host_delegate_view_); |
1171 } else { | 1172 } else { |
1172 WebContentsViewDelegate* delegate = | 1173 WebContentsViewDelegate* delegate = |
1173 GetContentClient()->browser()->GetWebContentsViewDelegate(this); | 1174 GetContentClient()->browser()->GetWebContentsViewDelegate(this); |
1174 | 1175 |
1175 if (browser_plugin_guest_) { | 1176 if (browser_plugin_guest_) { |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1371 } | 1372 } |
1372 } | 1373 } |
1373 | 1374 |
1374 void WebContentsImpl::LostMouseLock() { | 1375 void WebContentsImpl::LostMouseLock() { |
1375 if (delegate_) | 1376 if (delegate_) |
1376 delegate_->LostMouseLock(); | 1377 delegate_->LostMouseLock(); |
1377 } | 1378 } |
1378 | 1379 |
1379 void WebContentsImpl::CreateNewWindow( | 1380 void WebContentsImpl::CreateNewWindow( |
1380 int route_id, | 1381 int route_id, |
| 1382 int main_frame_route_id, |
1381 const ViewHostMsg_CreateWindow_Params& params, | 1383 const ViewHostMsg_CreateWindow_Params& params, |
1382 SessionStorageNamespace* session_storage_namespace) { | 1384 SessionStorageNamespace* session_storage_namespace) { |
1383 if (delegate_ && !delegate_->ShouldCreateWebContents( | 1385 if (delegate_ && !delegate_->ShouldCreateWebContents( |
1384 this, route_id, params.window_container_type, params.frame_name, | 1386 this, route_id, params.window_container_type, params.frame_name, |
1385 params.target_url)) { | 1387 params.target_url)) { |
1386 GetRenderViewHost()->GetProcess()->ResumeRequestsForView(route_id); | 1388 GetRenderViewHost()->GetProcess()->ResumeRequestsForView(route_id); |
| 1389 GetRenderViewHost()->GetProcess()->ResumeRequestsForView( |
| 1390 main_frame_route_id); |
1387 return; | 1391 return; |
1388 } | 1392 } |
1389 | 1393 |
1390 // We usually create the new window in the same BrowsingInstance (group of | 1394 // We usually create the new window in the same BrowsingInstance (group of |
1391 // script-related windows), by passing in the current SiteInstance. However, | 1395 // script-related windows), by passing in the current SiteInstance. However, |
1392 // if the opener is being suppressed (in a non-guest), we create a new | 1396 // if the opener is being suppressed (in a non-guest), we create a new |
1393 // SiteInstance in its own BrowsingInstance. | 1397 // SiteInstance in its own BrowsingInstance. |
1394 bool is_guest = GetRenderProcessHost()->IsGuest(); | 1398 bool is_guest = GetRenderProcessHost()->IsGuest(); |
1395 | 1399 |
1396 scoped_refptr<SiteInstance> site_instance = | 1400 scoped_refptr<SiteInstance> site_instance = |
(...skipping 20 matching lines...) Expand all Loading... |
1417 DOMStorageContextImpl* dom_storage_context = | 1421 DOMStorageContextImpl* dom_storage_context = |
1418 static_cast<DOMStorageContextImpl*>(partition->GetDOMStorageContext()); | 1422 static_cast<DOMStorageContextImpl*>(partition->GetDOMStorageContext()); |
1419 SessionStorageNamespaceImpl* session_storage_namespace_impl = | 1423 SessionStorageNamespaceImpl* session_storage_namespace_impl = |
1420 static_cast<SessionStorageNamespaceImpl*>(session_storage_namespace); | 1424 static_cast<SessionStorageNamespaceImpl*>(session_storage_namespace); |
1421 CHECK(session_storage_namespace_impl->IsFromContext(dom_storage_context)); | 1425 CHECK(session_storage_namespace_impl->IsFromContext(dom_storage_context)); |
1422 new_contents->GetController().SetSessionStorageNamespace( | 1426 new_contents->GetController().SetSessionStorageNamespace( |
1423 partition_id, | 1427 partition_id, |
1424 session_storage_namespace); | 1428 session_storage_namespace); |
1425 CreateParams create_params(GetBrowserContext(), site_instance); | 1429 CreateParams create_params(GetBrowserContext(), site_instance); |
1426 create_params.routing_id = route_id; | 1430 create_params.routing_id = route_id; |
| 1431 create_params.main_frame_routing_id = main_frame_route_id; |
1427 if (!is_guest) { | 1432 if (!is_guest) { |
1428 create_params.context = view_->GetNativeView(); | 1433 create_params.context = view_->GetNativeView(); |
1429 create_params.initial_size = view_->GetContainerSize(); | 1434 create_params.initial_size = view_->GetContainerSize(); |
1430 } else { | 1435 } else { |
1431 // This makes |new_contents| act as a guest. | 1436 // This makes |new_contents| act as a guest. |
1432 // For more info, see comment above class BrowserPluginGuest. | 1437 // For more info, see comment above class BrowserPluginGuest. |
1433 int instance_id = GetBrowserPluginGuestManager()->get_next_instance_id(); | 1438 int instance_id = GetBrowserPluginGuestManager()->get_next_instance_id(); |
1434 WebContentsImpl* new_contents_impl = | 1439 WebContentsImpl* new_contents_impl = |
1435 static_cast<WebContentsImpl*>(new_contents); | 1440 static_cast<WebContentsImpl*>(new_contents); |
1436 new_contents_impl->browser_plugin_guest_.reset( | 1441 new_contents_impl->browser_plugin_guest_.reset( |
(...skipping 2138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3575 } | 3580 } |
3576 | 3581 |
3577 BrowserPluginGuestManager* | 3582 BrowserPluginGuestManager* |
3578 WebContentsImpl::GetBrowserPluginGuestManager() const { | 3583 WebContentsImpl::GetBrowserPluginGuestManager() const { |
3579 return static_cast<BrowserPluginGuestManager*>( | 3584 return static_cast<BrowserPluginGuestManager*>( |
3580 GetBrowserContext()->GetUserData( | 3585 GetBrowserContext()->GetUserData( |
3581 browser_plugin::kBrowserPluginGuestManagerKeyName)); | 3586 browser_plugin::kBrowserPluginGuestManagerKeyName)); |
3582 } | 3587 } |
3583 | 3588 |
3584 } // namespace content | 3589 } // namespace content |
OLD | NEW |