| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <cmath> | 9 #include <cmath> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 2038 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2049 // Create the new web contents. This will automatically create the new | 2049 // Create the new web contents. This will automatically create the new |
| 2050 // WebContentsView. In the future, we may want to create the view separately. | 2050 // WebContentsView. In the future, we may want to create the view separately. |
| 2051 CreateParams create_params(GetBrowserContext(), site_instance.get()); | 2051 CreateParams create_params(GetBrowserContext(), site_instance.get()); |
| 2052 create_params.routing_id = route_id; | 2052 create_params.routing_id = route_id; |
| 2053 create_params.main_frame_routing_id = main_frame_route_id; | 2053 create_params.main_frame_routing_id = main_frame_route_id; |
| 2054 create_params.main_frame_widget_routing_id = main_frame_widget_route_id; | 2054 create_params.main_frame_widget_routing_id = main_frame_widget_route_id; |
| 2055 create_params.main_frame_name = params.frame_name; | 2055 create_params.main_frame_name = params.frame_name; |
| 2056 create_params.opener_render_process_id = render_process_id; | 2056 create_params.opener_render_process_id = render_process_id; |
| 2057 create_params.opener_render_frame_id = params.opener_render_frame_id; | 2057 create_params.opener_render_frame_id = params.opener_render_frame_id; |
| 2058 create_params.opener_suppressed = params.opener_suppressed; | 2058 create_params.opener_suppressed = params.opener_suppressed; |
| 2059 if (params.disposition == NEW_BACKGROUND_TAB) | 2059 if (params.disposition == WindowOpenDisposition::NEW_BACKGROUND_TAB) |
| 2060 create_params.initially_hidden = true; | 2060 create_params.initially_hidden = true; |
| 2061 create_params.renderer_initiated_creation = | 2061 create_params.renderer_initiated_creation = |
| 2062 main_frame_route_id != MSG_ROUTING_NONE; | 2062 main_frame_route_id != MSG_ROUTING_NONE; |
| 2063 | 2063 |
| 2064 WebContentsImpl* new_contents = NULL; | 2064 WebContentsImpl* new_contents = NULL; |
| 2065 if (!is_guest) { | 2065 if (!is_guest) { |
| 2066 create_params.context = view_->GetNativeView(); | 2066 create_params.context = view_->GetNativeView(); |
| 2067 create_params.initial_size = GetContainerBounds().size(); | 2067 create_params.initial_size = GetContainerBounds().size(); |
| 2068 new_contents = static_cast<WebContentsImpl*>( | 2068 new_contents = static_cast<WebContentsImpl*>( |
| 2069 WebContents::Create(create_params)); | 2069 WebContents::Create(create_params)); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2110 // When the opener is suppressed, the original renderer cannot access the | 2110 // When the opener is suppressed, the original renderer cannot access the |
| 2111 // new window. As a result, we need to show and navigate the window here. | 2111 // new window. As a result, we need to show and navigate the window here. |
| 2112 bool was_blocked = false; | 2112 bool was_blocked = false; |
| 2113 if (delegate_) { | 2113 if (delegate_) { |
| 2114 gfx::Rect initial_rect; | 2114 gfx::Rect initial_rect; |
| 2115 delegate_->AddNewContents( | 2115 delegate_->AddNewContents( |
| 2116 this, new_contents, params.disposition, initial_rect, | 2116 this, new_contents, params.disposition, initial_rect, |
| 2117 params.user_gesture, &was_blocked); | 2117 params.user_gesture, &was_blocked); |
| 2118 } | 2118 } |
| 2119 if (!was_blocked) { | 2119 if (!was_blocked) { |
| 2120 OpenURLParams open_params(params.target_url, params.referrer, CURRENT_TAB, | 2120 OpenURLParams open_params(params.target_url, params.referrer, |
| 2121 WindowOpenDisposition::CURRENT_TAB, |
| 2121 ui::PAGE_TRANSITION_LINK, | 2122 ui::PAGE_TRANSITION_LINK, |
| 2122 true /* is_renderer_initiated */); | 2123 true /* is_renderer_initiated */); |
| 2123 open_params.user_gesture = params.user_gesture; | 2124 open_params.user_gesture = params.user_gesture; |
| 2124 | 2125 |
| 2125 if (delegate_ && !is_guest && | 2126 if (delegate_ && !is_guest && |
| 2126 !delegate_->ShouldResumeRequestsForCreatedWindow()) { | 2127 !delegate_->ShouldResumeRequestsForCreatedWindow()) { |
| 2127 // We are in asynchronous add new contents path, delay opening url | 2128 // We are in asynchronous add new contents path, delay opening url |
| 2128 new_contents->delayed_open_url_params_.reset( | 2129 new_contents->delayed_open_url_params_.reset( |
| 2129 new OpenURLParams(open_params)); | 2130 new OpenURLParams(open_params)); |
| 2130 } else { | 2131 } else { |
| (...skipping 3073 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5204 for (RenderViewHost* render_view_host : render_view_host_set) | 5205 for (RenderViewHost* render_view_host : render_view_host_set) |
| 5205 render_view_host->OnWebkitPreferencesChanged(); | 5206 render_view_host->OnWebkitPreferencesChanged(); |
| 5206 } | 5207 } |
| 5207 | 5208 |
| 5208 void WebContentsImpl::SetJavaScriptDialogManagerForTesting( | 5209 void WebContentsImpl::SetJavaScriptDialogManagerForTesting( |
| 5209 JavaScriptDialogManager* dialog_manager) { | 5210 JavaScriptDialogManager* dialog_manager) { |
| 5210 dialog_manager_ = dialog_manager; | 5211 dialog_manager_ = dialog_manager; |
| 5211 } | 5212 } |
| 5212 | 5213 |
| 5213 } // namespace content | 5214 } // namespace content |
| OLD | NEW |