OLD | NEW |
---|---|
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 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
371 RenderFrameHost* RenderViewContextMenuBase::GetRenderFrameHost() { | 371 RenderFrameHost* RenderViewContextMenuBase::GetRenderFrameHost() { |
372 return RenderFrameHost::FromID(render_process_id_, render_frame_id_); | 372 return RenderFrameHost::FromID(render_process_id_, render_frame_id_); |
373 } | 373 } |
374 | 374 |
375 // Controller functions -------------------------------------------------------- | 375 // Controller functions -------------------------------------------------------- |
376 | 376 |
377 void RenderViewContextMenuBase::OpenURL( | 377 void RenderViewContextMenuBase::OpenURL( |
378 const GURL& url, const GURL& referring_url, | 378 const GURL& url, const GURL& referring_url, |
379 WindowOpenDisposition disposition, | 379 WindowOpenDisposition disposition, |
380 ui::PageTransition transition) { | 380 ui::PageTransition transition) { |
381 OpenURL(url, referring_url, disposition, transition, ""); | |
382 } | |
383 | |
384 void RenderViewContextMenuBase::OpenURL( | |
385 const GURL& url, const GURL& referring_url, | |
386 WindowOpenDisposition disposition, | |
387 ui::PageTransition transition, | |
388 const std::string& extra_headers) { | |
381 content::Referrer referrer = content::Referrer::SanitizeForRequest( | 389 content::Referrer referrer = content::Referrer::SanitizeForRequest( |
382 url, | 390 url, |
383 content::Referrer(referring_url.GetAsReferrer(), | 391 content::Referrer(referring_url.GetAsReferrer(), |
384 params_.referrer_policy)); | 392 params_.referrer_policy)); |
385 | 393 |
386 if (params_.link_url == url && disposition != OFF_THE_RECORD) | 394 if (params_.link_url == url && disposition != OFF_THE_RECORD) |
387 params_.custom_context.link_followed = url; | 395 params_.custom_context.link_followed = url; |
388 | 396 |
389 WebContents* new_contents = source_web_contents_->OpenURL(OpenURLParams( | 397 OpenURLParams open_url_params(url, referrer, disposition, transition, false); |
390 url, referrer, disposition, transition, false)); | 398 if (!extra_headers.empty()) { |
Alexei Svitkine (slow)
2015/02/20 18:37:27
Nit: No {}'s
Not at Google. Contact bengr
2015/02/21 00:11:17
Done.
| |
399 open_url_params.extra_headers = extra_headers; | |
400 } | |
401 WebContents* new_contents = source_web_contents_->OpenURL(open_url_params); | |
391 if (!new_contents) | 402 if (!new_contents) |
392 return; | 403 return; |
393 | 404 |
394 NotifyURLOpened(url, new_contents); | 405 NotifyURLOpened(url, new_contents); |
395 } | 406 } |
396 | 407 |
397 bool RenderViewContextMenuBase::IsCustomItemChecked(int id) const { | 408 bool RenderViewContextMenuBase::IsCustomItemChecked(int id) const { |
398 return IsCustomItemCheckedInternal(params_.custom_items, id); | 409 return IsCustomItemCheckedInternal(params_.custom_items, id); |
399 } | 410 } |
400 | 411 |
401 bool RenderViewContextMenuBase::IsCustomItemEnabled(int id) const { | 412 bool RenderViewContextMenuBase::IsCustomItemEnabled(int id) const { |
402 return IsCustomItemEnabledInternal(params_.custom_items, id); | 413 return IsCustomItemEnabledInternal(params_.custom_items, id); |
403 } | 414 } |
404 | 415 |
OLD | NEW |