Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(65)

Side by Side Diff: content/browser/web_contents/web_contents_impl.cc

Issue 2666193002: Switch RenderViewContextMenu to use RequestOpenURL (Closed)
Patch Set: Requested fixes Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 =
2580 RenderFrameHost::FromID(params.render_process_id, params.render_frame_id);
2581
nasko 2017/02/14 01:20:11 I realized we discussed one thing I forgot to ment
Patrick Noland 2017/02/14 21:33:59 Done.
2582 if (new_contents && render_frame_host && new_contents != this) {
2583 for (auto& observer : observers_) {
2584 observer.DidOpenRequestedURL(new_contents, render_frame_host, params.url,
2585 params.referrer, params.disposition,
2586 params.transition,
2587 params.started_from_context_menu);
2588 }
2589 }
2590
2578 return new_contents; 2591 return new_contents;
2579 } 2592 }
2580 2593
2581 bool WebContentsImpl::Send(IPC::Message* message) { 2594 bool WebContentsImpl::Send(IPC::Message* message) {
2582 if (!GetRenderViewHost()) { 2595 if (!GetRenderViewHost()) {
2583 delete message; 2596 delete message;
2584 return false; 2597 return false;
2585 } 2598 }
2586 2599
2587 return GetRenderViewHost()->Send(message); 2600 return GetRenderViewHost()->Send(message);
(...skipping 773 matching lines...) Expand 10 before | Expand all | Expand 10 after
3361 NotifyNavigationStateChanged(changed_flags); 3374 NotifyNavigationStateChanged(changed_flags);
3362 } 3375 }
3363 3376
3364 void WebContentsImpl::DidStartNavigationToPendingEntry(const GURL& url, 3377 void WebContentsImpl::DidStartNavigationToPendingEntry(const GURL& url,
3365 ReloadType reload_type) { 3378 ReloadType reload_type) {
3366 // Notify observers about navigation. 3379 // Notify observers about navigation.
3367 for (auto& observer : observers_) 3380 for (auto& observer : observers_)
3368 observer.DidStartNavigationToPendingEntry(url, reload_type); 3381 observer.DidStartNavigationToPendingEntry(url, reload_type);
3369 } 3382 }
3370 3383
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) { 3384 bool WebContentsImpl::ShouldTransferNavigation(bool is_main_frame_navigation) {
3391 if (!delegate_) 3385 if (!delegate_)
3392 return true; 3386 return true;
3393 return delegate_->ShouldTransferNavigation(is_main_frame_navigation); 3387 return delegate_->ShouldTransferNavigation(is_main_frame_navigation);
3394 } 3388 }
3395 3389
3396 bool WebContentsImpl::ShouldPreserveAbortedURLs() { 3390 bool WebContentsImpl::ShouldPreserveAbortedURLs() {
3397 if (!delegate_) 3391 if (!delegate_)
3398 return false; 3392 return false;
3399 return delegate_->ShouldPreserveAbortedURLs(this); 3393 return delegate_->ShouldPreserveAbortedURLs(this);
(...skipping 1975 matching lines...) Expand 10 before | Expand all | Expand 10 after
5375 GetMainFrame()->AddMessageToConsole( 5369 GetMainFrame()->AddMessageToConsole(
5376 content::CONSOLE_MESSAGE_LEVEL_WARNING, 5370 content::CONSOLE_MESSAGE_LEVEL_WARNING,
5377 base::StringPrintf("This site does not have a valid SSL " 5371 base::StringPrintf("This site does not have a valid SSL "
5378 "certificate! Without SSL, your site's and " 5372 "certificate! Without SSL, your site's and "
5379 "visitors' data is vulnerable to theft and " 5373 "visitors' data is vulnerable to theft and "
5380 "tampering. Get a valid SSL certificate before" 5374 "tampering. Get a valid SSL certificate before"
5381 " releasing your website to the public.")); 5375 " releasing your website to the public."));
5382 } 5376 }
5383 5377
5384 } // namespace content 5378 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698