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 OpenURLWithExtraHeaders(url, referring_url, disposition, transition, ""); |
| 382 } |
| 383 |
| 384 void RenderViewContextMenuBase::OpenURLWithExtraHeaders( |
| 385 const GURL& url, |
| 386 const GURL& referring_url, |
| 387 WindowOpenDisposition disposition, |
| 388 ui::PageTransition transition, |
| 389 const std::string& extra_headers) { |
381 content::Referrer referrer = content::Referrer::SanitizeForRequest( | 390 content::Referrer referrer = content::Referrer::SanitizeForRequest( |
382 url, | 391 url, |
383 content::Referrer(referring_url.GetAsReferrer(), | 392 content::Referrer(referring_url.GetAsReferrer(), |
384 params_.referrer_policy)); | 393 params_.referrer_policy)); |
385 | 394 |
386 if (params_.link_url == url && disposition != OFF_THE_RECORD) | 395 if (params_.link_url == url && disposition != OFF_THE_RECORD) |
387 params_.custom_context.link_followed = url; | 396 params_.custom_context.link_followed = url; |
388 | 397 |
389 WebContents* new_contents = source_web_contents_->OpenURL(OpenURLParams( | 398 OpenURLParams open_url_params(url, referrer, disposition, transition, false); |
390 url, referrer, disposition, transition, false)); | 399 if (!extra_headers.empty()) |
| 400 open_url_params.extra_headers = extra_headers; |
| 401 |
| 402 WebContents* new_contents = source_web_contents_->OpenURL(open_url_params); |
391 if (!new_contents) | 403 if (!new_contents) |
392 return; | 404 return; |
393 | 405 |
394 NotifyURLOpened(url, new_contents); | 406 NotifyURLOpened(url, new_contents); |
395 } | 407 } |
396 | 408 |
397 bool RenderViewContextMenuBase::IsCustomItemChecked(int id) const { | 409 bool RenderViewContextMenuBase::IsCustomItemChecked(int id) const { |
398 return IsCustomItemCheckedInternal(params_.custom_items, id); | 410 return IsCustomItemCheckedInternal(params_.custom_items, id); |
399 } | 411 } |
400 | 412 |
401 bool RenderViewContextMenuBase::IsCustomItemEnabled(int id) const { | 413 bool RenderViewContextMenuBase::IsCustomItemEnabled(int id) const { |
402 return IsCustomItemEnabledInternal(params_.custom_items, id); | 414 return IsCustomItemEnabledInternal(params_.custom_items, id); |
403 } | 415 } |
404 | 416 |
OLD | NEW |