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

Side by Side Diff: components/renderer_context_menu/render_view_context_menu_base.cc

Issue 2666193002: Switch RenderViewContextMenu to use RequestOpenURL (Closed)
Patch Set: Add started_from_context_menu 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "components/renderer_context_menu/render_view_context_menu_base.h" 5 #include "components/renderer_context_menu/render_view_context_menu_base.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <utility> 8 #include <utility>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 bool started_from_context_menu) { 380 bool started_from_context_menu) {
381 content::Referrer referrer = content::Referrer::SanitizeForRequest( 381 content::Referrer referrer = content::Referrer::SanitizeForRequest(
382 url, 382 url,
383 content::Referrer(referring_url.GetAsReferrer(), 383 content::Referrer(referring_url.GetAsReferrer(),
384 params_.referrer_policy)); 384 params_.referrer_policy));
385 385
386 if (params_.link_url == url && 386 if (params_.link_url == url &&
387 disposition != WindowOpenDisposition::OFF_THE_RECORD) 387 disposition != WindowOpenDisposition::OFF_THE_RECORD)
388 params_.custom_context.link_followed = url; 388 params_.custom_context.link_followed = url;
389 389
390 OpenURLParams open_url_params(url, referrer, disposition, transition, false, 390 OpenURLParams open_url_params(url, referrer, disposition, transition, false,
Charlie Reis 2017/02/02 23:34:22 Side note: The "false" parameter here is why this
391 started_from_context_menu); 391 started_from_context_menu);
392 if (!extra_headers.empty()) 392 if (!extra_headers.empty())
393 open_url_params.extra_headers = extra_headers; 393 open_url_params.extra_headers = extra_headers;
394 394
395 WebContents* new_contents = source_web_contents_->OpenURL(open_url_params); 395 source_web_contents_->RequestOpenURL(GetRenderFrameHost(), open_url_params);
396 if (!new_contents)
397 return;
398
399 NotifyURLOpened(url, new_contents);
Charlie Reis 2017/02/02 23:34:22 This looks like it would be dead code if we remove
nasko 2017/02/07 19:39:34 I don't think it is safe to remove. Last time I lo
Patrick Noland 2017/02/10 22:42:55 Yes, NotifyURLOpened would be dead code and safe t
400 } 396 }
401 397
402 bool RenderViewContextMenuBase::IsCustomItemChecked(int id) const { 398 bool RenderViewContextMenuBase::IsCustomItemChecked(int id) const {
403 return IsCustomItemCheckedInternal(params_.custom_items, id); 399 return IsCustomItemCheckedInternal(params_.custom_items, id);
404 } 400 }
405 401
406 bool RenderViewContextMenuBase::IsCustomItemEnabled(int id) const { 402 bool RenderViewContextMenuBase::IsCustomItemEnabled(int id) const {
407 return IsCustomItemEnabledInternal(params_.custom_items, id); 403 return IsCustomItemEnabledInternal(params_.custom_items, id);
408 } 404 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698