| 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 2098 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2109 WebContentsView* new_view = new_contents->view_.get(); | 2109 WebContentsView* new_view = new_contents->view_.get(); |
| 2110 | 2110 |
| 2111 // TODO(brettw): It seems bogus that we have to call this function on the | 2111 // TODO(brettw): It seems bogus that we have to call this function on the |
| 2112 // newly created object and give it one of its own member variables. | 2112 // newly created object and give it one of its own member variables. |
| 2113 new_view->CreateViewForWidget( | 2113 new_view->CreateViewForWidget( |
| 2114 new_contents->GetRenderViewHost()->GetWidget(), false); | 2114 new_contents->GetRenderViewHost()->GetWidget(), false); |
| 2115 } | 2115 } |
| 2116 // Save the created window associated with the route so we can show it | 2116 // Save the created window associated with the route so we can show it |
| 2117 // later. | 2117 // later. |
| 2118 DCHECK_NE(MSG_ROUTING_NONE, main_frame_widget_route_id); | 2118 DCHECK_NE(MSG_ROUTING_NONE, main_frame_widget_route_id); |
| 2119 CHECK(RenderWidgetHostImpl::FromID(render_process_id, |
| 2120 main_frame_widget_route_id)); |
| 2119 pending_contents_[std::make_pair( | 2121 pending_contents_[std::make_pair( |
| 2120 render_process_id, main_frame_widget_route_id)] = new_contents; | 2122 render_process_id, main_frame_widget_route_id)] = new_contents; |
| 2121 AddDestructionObserver(new_contents); | 2123 AddDestructionObserver(new_contents); |
| 2122 } | 2124 } |
| 2123 | 2125 |
| 2124 if (delegate_) { | 2126 if (delegate_) { |
| 2125 delegate_->WebContentsCreated( | 2127 delegate_->WebContentsCreated( |
| 2126 this, render_process_id, params.opener_render_frame_id, | 2128 this, render_process_id, params.opener_render_frame_id, |
| 2127 params.frame_name, params.target_url, new_contents); | 2129 params.frame_name, params.target_url, new_contents); |
| 2128 } | 2130 } |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2209 } | 2211 } |
| 2210 | 2212 |
| 2211 void WebContentsImpl::ShowCreatedWindow(int process_id, | 2213 void WebContentsImpl::ShowCreatedWindow(int process_id, |
| 2212 int main_frame_widget_route_id, | 2214 int main_frame_widget_route_id, |
| 2213 WindowOpenDisposition disposition, | 2215 WindowOpenDisposition disposition, |
| 2214 const gfx::Rect& initial_rect, | 2216 const gfx::Rect& initial_rect, |
| 2215 bool user_gesture) { | 2217 bool user_gesture) { |
| 2216 WebContentsImpl* contents = | 2218 WebContentsImpl* contents = |
| 2217 GetCreatedWindow(process_id, main_frame_widget_route_id); | 2219 GetCreatedWindow(process_id, main_frame_widget_route_id); |
| 2218 if (contents) { | 2220 if (contents) { |
| 2221 RenderWidgetHostImpl* rwh = |
| 2222 RenderWidgetHostImpl::FromID(process_id, main_frame_widget_route_id); |
| 2223 if (!rwh) { |
| 2224 // TODO(nick): Temporary for https://crbug.com/680876 |
| 2225 base::debug::DumpWithoutCrashing(); |
| 2226 return; |
| 2227 } |
| 2228 |
| 2219 WebContentsDelegate* delegate = GetDelegate(); | 2229 WebContentsDelegate* delegate = GetDelegate(); |
| 2220 contents->is_resume_pending_ = true; | 2230 contents->is_resume_pending_ = true; |
| 2221 if (!delegate || delegate->ShouldResumeRequestsForCreatedWindow()) | 2231 if (!delegate || delegate->ShouldResumeRequestsForCreatedWindow()) |
| 2222 contents->ResumeLoadingCreatedWebContents(); | 2232 contents->ResumeLoadingCreatedWebContents(); |
| 2223 | 2233 |
| 2224 if (delegate) { | 2234 if (delegate) { |
| 2225 delegate->AddNewContents(this, contents, disposition, initial_rect, | 2235 delegate->AddNewContents(this, contents, disposition, initial_rect, |
| 2226 user_gesture, NULL); | 2236 user_gesture, NULL); |
| 2227 } | 2237 } |
| 2228 | 2238 |
| 2229 RenderWidgetHostImpl* rwh = contents->GetMainFrame()->GetRenderWidgetHost(); | |
| 2230 DCHECK_EQ(main_frame_widget_route_id, rwh->GetRoutingID()); | |
| 2231 rwh->Send(new ViewMsg_Move_ACK(rwh->GetRoutingID())); | 2239 rwh->Send(new ViewMsg_Move_ACK(rwh->GetRoutingID())); |
| 2232 } | 2240 } |
| 2233 } | 2241 } |
| 2234 | 2242 |
| 2235 void WebContentsImpl::ShowCreatedWidget(int process_id, | 2243 void WebContentsImpl::ShowCreatedWidget(int process_id, |
| 2236 int route_id, | 2244 int route_id, |
| 2237 const gfx::Rect& initial_rect) { | 2245 const gfx::Rect& initial_rect) { |
| 2238 ShowCreatedWidget(process_id, route_id, false, initial_rect); | 2246 ShowCreatedWidget(process_id, route_id, false, initial_rect); |
| 2239 } | 2247 } |
| 2240 | 2248 |
| (...skipping 3178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5419 GetMainFrame()->AddMessageToConsole( | 5427 GetMainFrame()->AddMessageToConsole( |
| 5420 content::CONSOLE_MESSAGE_LEVEL_WARNING, | 5428 content::CONSOLE_MESSAGE_LEVEL_WARNING, |
| 5421 base::StringPrintf("This site does not have a valid SSL " | 5429 base::StringPrintf("This site does not have a valid SSL " |
| 5422 "certificate! Without SSL, your site's and " | 5430 "certificate! Without SSL, your site's and " |
| 5423 "visitors' data is vulnerable to theft and " | 5431 "visitors' data is vulnerable to theft and " |
| 5424 "tampering. Get a valid SSL certificate before" | 5432 "tampering. Get a valid SSL certificate before" |
| 5425 " releasing your website to the public.")); | 5433 " releasing your website to the public.")); |
| 5426 } | 5434 } |
| 5427 | 5435 |
| 5428 } // namespace content | 5436 } // namespace content |
| OLD | NEW |