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 "chrome/browser/renderer_context_menu/render_view_context_menu.h" | 5 #include "chrome/browser/renderer_context_menu/render_view_context_menu.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <set> | 10 #include <set> |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 #include "content/public/browser/render_process_host.h" | 101 #include "content/public/browser/render_process_host.h" |
102 #include "content/public/browser/render_view_host.h" | 102 #include "content/public/browser/render_view_host.h" |
103 #include "content/public/browser/render_widget_host_view.h" | 103 #include "content/public/browser/render_widget_host_view.h" |
104 #include "content/public/browser/ssl_status.h" | 104 #include "content/public/browser/ssl_status.h" |
105 #include "content/public/browser/storage_partition.h" | 105 #include "content/public/browser/storage_partition.h" |
106 #include "content/public/browser/web_contents.h" | 106 #include "content/public/browser/web_contents.h" |
107 #include "content/public/common/menu_item.h" | 107 #include "content/public/common/menu_item.h" |
108 #include "content/public/common/url_utils.h" | 108 #include "content/public/common/url_utils.h" |
109 #include "extensions/features/features.h" | 109 #include "extensions/features/features.h" |
110 #include "net/base/escape.h" | 110 #include "net/base/escape.h" |
| 111 #include "net/traffic_annotation/network_traffic_annotation.h" |
111 #include "ppapi/features/features.h" | 112 #include "ppapi/features/features.h" |
112 #include "printing/features/features.h" | 113 #include "printing/features/features.h" |
113 #include "services/service_manager/public/cpp/interface_provider.h" | 114 #include "services/service_manager/public/cpp/interface_provider.h" |
114 #include "third_party/WebKit/public/public_features.h" | 115 #include "third_party/WebKit/public/public_features.h" |
115 #include "third_party/WebKit/public/web/WebContextMenuData.h" | 116 #include "third_party/WebKit/public/web/WebContextMenuData.h" |
116 #include "third_party/WebKit/public/web/WebMediaPlayerAction.h" | 117 #include "third_party/WebKit/public/web/WebMediaPlayerAction.h" |
117 #include "third_party/WebKit/public/web/WebPluginAction.h" | 118 #include "third_party/WebKit/public/web/WebPluginAction.h" |
118 #include "ui/base/clipboard/clipboard.h" | 119 #include "ui/base/clipboard/clipboard.h" |
119 #include "ui/base/clipboard/scoped_clipboard_writer.h" | 120 #include "ui/base/clipboard/scoped_clipboard_writer.h" |
120 #include "ui/base/l10n/l10n_util.h" | 121 #include "ui/base/l10n/l10n_util.h" |
(...skipping 2093 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2214 new DownloadUrlParameters( | 2215 new DownloadUrlParameters( |
2215 url, render_frame_host->GetProcess()->GetID(), | 2216 url, render_frame_host->GetProcess()->GetID(), |
2216 render_frame_host->GetRenderViewHost()->GetRoutingID(), | 2217 render_frame_host->GetRenderViewHost()->GetRoutingID(), |
2217 render_frame_host->GetRoutingID(), | 2218 render_frame_host->GetRoutingID(), |
2218 storage_partition->GetURLRequestContext())); | 2219 storage_partition->GetURLRequestContext())); |
2219 dl_params->set_referrer(CreateReferrer(url, params_)); | 2220 dl_params->set_referrer(CreateReferrer(url, params_)); |
2220 dl_params->set_referrer_encoding(params_.frame_charset); | 2221 dl_params->set_referrer_encoding(params_.frame_charset); |
2221 dl_params->set_suggested_name(params_.suggested_filename); | 2222 dl_params->set_suggested_name(params_.suggested_filename); |
2222 dl_params->set_prompt(true); | 2223 dl_params->set_prompt(true); |
2223 | 2224 |
2224 BrowserContext::GetDownloadManager(browser_context_)->DownloadUrl( | 2225 BrowserContext::GetDownloadManager(browser_context_) |
2225 std::move(dl_params)); | 2226 ->DownloadUrl(std::move(dl_params), NO_TRAFFIC_ANNOTATION_YET); |
2226 } | 2227 } |
2227 | 2228 |
2228 void RenderViewContextMenu::ExecSaveAs() { | 2229 void RenderViewContextMenu::ExecSaveAs() { |
2229 bool is_large_data_url = params_.has_image_contents && | 2230 bool is_large_data_url = params_.has_image_contents && |
2230 params_.src_url.is_empty(); | 2231 params_.src_url.is_empty(); |
2231 if (params_.media_type == WebContextMenuData::kMediaTypeCanvas || | 2232 if (params_.media_type == WebContextMenuData::kMediaTypeCanvas || |
2232 (params_.media_type == WebContextMenuData::kMediaTypeImage && | 2233 (params_.media_type == WebContextMenuData::kMediaTypeImage && |
2233 is_large_data_url)) { | 2234 is_large_data_url)) { |
2234 RenderFrameHost* frame_host = GetRenderFrameHost(); | 2235 RenderFrameHost* frame_host = GetRenderFrameHost(); |
2235 if (frame_host) | 2236 if (frame_host) |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2457 void RenderViewContextMenu::PluginActionAt( | 2458 void RenderViewContextMenu::PluginActionAt( |
2458 const gfx::Point& location, | 2459 const gfx::Point& location, |
2459 const WebPluginAction& action) { | 2460 const WebPluginAction& action) { |
2460 source_web_contents_->GetRenderViewHost()-> | 2461 source_web_contents_->GetRenderViewHost()-> |
2461 ExecutePluginActionAtLocation(location, action); | 2462 ExecutePluginActionAtLocation(location, action); |
2462 } | 2463 } |
2463 | 2464 |
2464 Browser* RenderViewContextMenu::GetBrowser() const { | 2465 Browser* RenderViewContextMenu::GetBrowser() const { |
2465 return chrome::FindBrowserWithWebContents(embedder_web_contents_); | 2466 return chrome::FindBrowserWithWebContents(embedder_web_contents_); |
2466 } | 2467 } |
OLD | NEW |