| OLD | NEW |
| 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 <algorithm> | 5 #include <algorithm> |
| 6 #include <set> | 6 #include <set> |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "chrome/browser/tab_contents/render_view_context_menu.h" | 9 #include "chrome/browser/tab_contents/render_view_context_menu.h" |
| 10 | 10 |
| (...skipping 1325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1336 OFF_THE_RECORD, | 1336 OFF_THE_RECORD, |
| 1337 content::PAGE_TRANSITION_LINK); | 1337 content::PAGE_TRANSITION_LINK); |
| 1338 break; | 1338 break; |
| 1339 | 1339 |
| 1340 case IDC_CONTENT_CONTEXT_SAVELINKAS: { | 1340 case IDC_CONTENT_CONTEXT_SAVELINKAS: { |
| 1341 download_util::RecordDownloadSource( | 1341 download_util::RecordDownloadSource( |
| 1342 download_util::INITIATED_BY_CONTEXT_MENU); | 1342 download_util::INITIATED_BY_CONTEXT_MENU); |
| 1343 const GURL& referrer = | 1343 const GURL& referrer = |
| 1344 params_.frame_url.is_empty() ? params_.page_url : params_.frame_url; | 1344 params_.frame_url.is_empty() ? params_.page_url : params_.frame_url; |
| 1345 const GURL& url = params_.link_url; | 1345 const GURL& url = params_.link_url; |
| 1346 content::DownloadSaveInfo save_info; | 1346 scoped_ptr<content::DownloadSaveInfo> save_info( |
| 1347 save_info.prompt_for_save_location = true; | 1347 new content::DownloadSaveInfo()); |
| 1348 save_info->prompt_for_save_location = true; |
| 1348 DownloadManager* dlm = BrowserContext::GetDownloadManager(profile_); | 1349 DownloadManager* dlm = BrowserContext::GetDownloadManager(profile_); |
| 1349 scoped_ptr<DownloadUrlParameters> dl_params( | 1350 scoped_ptr<DownloadUrlParameters> dl_params( |
| 1350 DownloadUrlParameters::FromWebContents( | 1351 DownloadUrlParameters::FromWebContents( |
| 1351 source_web_contents_, url, save_info)); | 1352 source_web_contents_, url, save_info.Pass())); |
| 1352 dl_params->set_referrer( | 1353 dl_params->set_referrer( |
| 1353 content::Referrer(referrer, params_.referrer_policy)); | 1354 content::Referrer(referrer, params_.referrer_policy)); |
| 1354 dl_params->set_referrer_encoding(params_.frame_charset); | 1355 dl_params->set_referrer_encoding(params_.frame_charset); |
| 1355 dlm->DownloadUrl(dl_params.Pass()); | 1356 dlm->DownloadUrl(dl_params.Pass()); |
| 1356 break; | 1357 break; |
| 1357 } | 1358 } |
| 1358 | 1359 |
| 1359 case IDC_CONTENT_CONTEXT_SAVEAVAS: | 1360 case IDC_CONTENT_CONTEXT_SAVEAVAS: |
| 1360 case IDC_CONTENT_CONTEXT_SAVEIMAGEAS: { | 1361 case IDC_CONTENT_CONTEXT_SAVEIMAGEAS: { |
| 1361 download_util::RecordDownloadSource( | 1362 download_util::RecordDownloadSource( |
| 1362 download_util::INITIATED_BY_CONTEXT_MENU); | 1363 download_util::INITIATED_BY_CONTEXT_MENU); |
| 1363 const GURL& referrer = | 1364 const GURL& referrer = |
| 1364 params_.frame_url.is_empty() ? params_.page_url : params_.frame_url; | 1365 params_.frame_url.is_empty() ? params_.page_url : params_.frame_url; |
| 1365 const GURL& url = params_.src_url; | 1366 const GURL& url = params_.src_url; |
| 1366 content::DownloadSaveInfo save_info; | 1367 scoped_ptr<content::DownloadSaveInfo> save_info( |
| 1367 save_info.prompt_for_save_location = true; | 1368 new content::DownloadSaveInfo()); |
| 1369 save_info->prompt_for_save_location = true; |
| 1368 int64 post_id = -1; | 1370 int64 post_id = -1; |
| 1369 if (url == source_web_contents_->GetURL()) { | 1371 if (url == source_web_contents_->GetURL()) { |
| 1370 const NavigationEntry* entry = | 1372 const NavigationEntry* entry = |
| 1371 source_web_contents_->GetController().GetActiveEntry(); | 1373 source_web_contents_->GetController().GetActiveEntry(); |
| 1372 if (entry) | 1374 if (entry) |
| 1373 post_id = entry->GetPostID(); | 1375 post_id = entry->GetPostID(); |
| 1374 } | 1376 } |
| 1375 DownloadManager* dlm = BrowserContext::GetDownloadManager(profile_); | 1377 DownloadManager* dlm = BrowserContext::GetDownloadManager(profile_); |
| 1376 scoped_ptr<DownloadUrlParameters> dl_params( | 1378 scoped_ptr<DownloadUrlParameters> dl_params( |
| 1377 DownloadUrlParameters::FromWebContents( | 1379 DownloadUrlParameters::FromWebContents( |
| 1378 source_web_contents_, url, save_info)); | 1380 source_web_contents_, url, save_info.Pass())); |
| 1379 dl_params->set_referrer( | 1381 dl_params->set_referrer( |
| 1380 content::Referrer(referrer, params_.referrer_policy)); | 1382 content::Referrer(referrer, params_.referrer_policy)); |
| 1381 dl_params->set_post_id(post_id); | 1383 dl_params->set_post_id(post_id); |
| 1382 dl_params->set_prefer_cache(true); | 1384 dl_params->set_prefer_cache(true); |
| 1383 if (post_id >= 0) | 1385 if (post_id >= 0) |
| 1384 dl_params->set_method("POST"); | 1386 dl_params->set_method("POST"); |
| 1385 dlm->DownloadUrl(dl_params.Pass()); | 1387 dlm->DownloadUrl(dl_params.Pass()); |
| 1386 break; | 1388 break; |
| 1387 } | 1389 } |
| 1388 | 1390 |
| (...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1809 source_web_contents_->GetRenderViewHost()-> | 1811 source_web_contents_->GetRenderViewHost()-> |
| 1810 ExecuteMediaPlayerActionAtLocation(location, action); | 1812 ExecuteMediaPlayerActionAtLocation(location, action); |
| 1811 } | 1813 } |
| 1812 | 1814 |
| 1813 void RenderViewContextMenu::PluginActionAt( | 1815 void RenderViewContextMenu::PluginActionAt( |
| 1814 const gfx::Point& location, | 1816 const gfx::Point& location, |
| 1815 const WebPluginAction& action) { | 1817 const WebPluginAction& action) { |
| 1816 source_web_contents_->GetRenderViewHost()-> | 1818 source_web_contents_->GetRenderViewHost()-> |
| 1817 ExecutePluginActionAtLocation(location, action); | 1819 ExecutePluginActionAtLocation(location, action); |
| 1818 } | 1820 } |
| OLD | NEW |