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 2557 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2568 | 2568 |
2569 if (delegate_) | 2569 if (delegate_) |
2570 delegate_->ResizeDueToAutoResize(this, new_size); | 2570 delegate_->ResizeDueToAutoResize(this, new_size); |
2571 } | 2571 } |
2572 | 2572 |
2573 WebContents* WebContentsImpl::OpenURL(const OpenURLParams& params) { | 2573 WebContents* WebContentsImpl::OpenURL(const OpenURLParams& params) { |
2574 if (!delegate_) | 2574 if (!delegate_) |
2575 return NULL; | 2575 return NULL; |
2576 | 2576 |
2577 WebContents* new_contents = delegate_->OpenURLFromTab(this, params); | 2577 WebContents* new_contents = delegate_->OpenURLFromTab(this, params); |
2578 | |
2579 RenderFrameHost* render_frame_host = | |
Charlie Reis
2017/02/16 00:21:10
nit: source_render_frame_host
Patrick Noland
2017/02/16 00:57:12
Done.
| |
2580 RenderFrameHost::FromID(params.render_process_id, params.render_frame_id); | |
2581 | |
2582 if (render_frame_host && params.source_site_instance) { | |
2583 CHECK(render_frame_host->GetSiteInstance() == | |
Charlie Reis
2017/02/16 00:21:10
minor nit: Does CHECK_EQ work here, or is the comp
Patrick Noland
2017/02/16 00:57:12
Done.
| |
2584 params.source_site_instance.get()); | |
2585 } | |
2586 | |
2587 if (new_contents && render_frame_host && new_contents != this) { | |
2588 for (auto& observer : observers_) { | |
2589 observer.DidOpenRequestedURL(new_contents, render_frame_host, params.url, | |
2590 params.referrer, params.disposition, | |
2591 params.transition, | |
2592 params.started_from_context_menu); | |
2593 } | |
2594 } | |
2595 | |
2578 return new_contents; | 2596 return new_contents; |
2579 } | 2597 } |
2580 | 2598 |
2581 bool WebContentsImpl::Send(IPC::Message* message) { | 2599 bool WebContentsImpl::Send(IPC::Message* message) { |
2582 if (!GetRenderViewHost()) { | 2600 if (!GetRenderViewHost()) { |
2583 delete message; | 2601 delete message; |
2584 return false; | 2602 return false; |
2585 } | 2603 } |
2586 | 2604 |
2587 return GetRenderViewHost()->Send(message); | 2605 return GetRenderViewHost()->Send(message); |
(...skipping 773 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3361 NotifyNavigationStateChanged(changed_flags); | 3379 NotifyNavigationStateChanged(changed_flags); |
3362 } | 3380 } |
3363 | 3381 |
3364 void WebContentsImpl::DidStartNavigationToPendingEntry(const GURL& url, | 3382 void WebContentsImpl::DidStartNavigationToPendingEntry(const GURL& url, |
3365 ReloadType reload_type) { | 3383 ReloadType reload_type) { |
3366 // Notify observers about navigation. | 3384 // Notify observers about navigation. |
3367 for (auto& observer : observers_) | 3385 for (auto& observer : observers_) |
3368 observer.DidStartNavigationToPendingEntry(url, reload_type); | 3386 observer.DidStartNavigationToPendingEntry(url, reload_type); |
3369 } | 3387 } |
3370 | 3388 |
3371 void WebContentsImpl::RequestOpenURL(RenderFrameHostImpl* render_frame_host, | |
3372 const OpenURLParams& params) { | |
3373 // OpenURL can blow away the source RFH. Use the process/frame routing ID as a | |
3374 // weak pointer of sorts. | |
3375 const int32_t process_id = render_frame_host->GetProcess()->GetID(); | |
3376 const int32_t frame_id = render_frame_host->GetRoutingID(); | |
3377 | |
3378 WebContents* new_contents = OpenURL(params); | |
3379 | |
3380 if (new_contents && RenderFrameHost::FromID(process_id, frame_id)) { | |
3381 // Notify observers. | |
3382 for (auto& observer : observers_) { | |
3383 observer.DidOpenRequestedURL(new_contents, render_frame_host, params.url, | |
3384 params.referrer, params.disposition, | |
3385 params.transition); | |
3386 } | |
3387 } | |
3388 } | |
3389 | |
3390 bool WebContentsImpl::ShouldTransferNavigation(bool is_main_frame_navigation) { | 3389 bool WebContentsImpl::ShouldTransferNavigation(bool is_main_frame_navigation) { |
3391 if (!delegate_) | 3390 if (!delegate_) |
3392 return true; | 3391 return true; |
3393 return delegate_->ShouldTransferNavigation(is_main_frame_navigation); | 3392 return delegate_->ShouldTransferNavigation(is_main_frame_navigation); |
3394 } | 3393 } |
3395 | 3394 |
3396 bool WebContentsImpl::ShouldPreserveAbortedURLs() { | 3395 bool WebContentsImpl::ShouldPreserveAbortedURLs() { |
3397 if (!delegate_) | 3396 if (!delegate_) |
3398 return false; | 3397 return false; |
3399 return delegate_->ShouldPreserveAbortedURLs(this); | 3398 return delegate_->ShouldPreserveAbortedURLs(this); |
(...skipping 1975 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5375 GetMainFrame()->AddMessageToConsole( | 5374 GetMainFrame()->AddMessageToConsole( |
5376 content::CONSOLE_MESSAGE_LEVEL_WARNING, | 5375 content::CONSOLE_MESSAGE_LEVEL_WARNING, |
5377 base::StringPrintf("This site does not have a valid SSL " | 5376 base::StringPrintf("This site does not have a valid SSL " |
5378 "certificate! Without SSL, your site's and " | 5377 "certificate! Without SSL, your site's and " |
5379 "visitors' data is vulnerable to theft and " | 5378 "visitors' data is vulnerable to theft and " |
5380 "tampering. Get a valid SSL certificate before" | 5379 "tampering. Get a valid SSL certificate before" |
5381 " releasing your website to the public.")); | 5380 " releasing your website to the public.")); |
5382 } | 5381 } |
5383 | 5382 |
5384 } // namespace content | 5383 } // namespace content |
OLD | NEW |