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 1331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1342 OFF_THE_RECORD, | 1342 OFF_THE_RECORD, |
1343 content::PAGE_TRANSITION_LINK); | 1343 content::PAGE_TRANSITION_LINK); |
1344 break; | 1344 break; |
1345 | 1345 |
1346 case IDC_CONTENT_CONTEXT_SAVELINKAS: { | 1346 case IDC_CONTENT_CONTEXT_SAVELINKAS: { |
1347 download_util::RecordDownloadSource( | 1347 download_util::RecordDownloadSource( |
1348 download_util::INITIATED_BY_CONTEXT_MENU); | 1348 download_util::INITIATED_BY_CONTEXT_MENU); |
1349 const GURL& referrer = | 1349 const GURL& referrer = |
1350 params_.frame_url.is_empty() ? params_.page_url : params_.frame_url; | 1350 params_.frame_url.is_empty() ? params_.page_url : params_.frame_url; |
1351 const GURL& url = params_.link_url; | 1351 const GURL& url = params_.link_url; |
1352 content::DownloadSaveInfo save_info; | 1352 scoped_ptr<content::DownloadSaveInfo> save_info( |
1353 save_info.prompt_for_save_location = true; | 1353 new content::DownloadSaveInfo()); |
| 1354 save_info->prompt_for_save_location = true; |
1354 DownloadManager* dlm = BrowserContext::GetDownloadManager(profile_); | 1355 DownloadManager* dlm = BrowserContext::GetDownloadManager(profile_); |
1355 scoped_ptr<DownloadUrlParameters> dl_params( | 1356 scoped_ptr<DownloadUrlParameters> dl_params( |
1356 DownloadUrlParameters::FromWebContents( | 1357 DownloadUrlParameters::FromWebContents( |
1357 source_web_contents_, url, save_info)); | 1358 source_web_contents_, url, save_info.Pass())); |
1358 dl_params->set_referrer( | 1359 dl_params->set_referrer( |
1359 content::Referrer(referrer, params_.referrer_policy)); | 1360 content::Referrer(referrer, params_.referrer_policy)); |
1360 dl_params->set_referrer_encoding(params_.frame_charset); | 1361 dl_params->set_referrer_encoding(params_.frame_charset); |
1361 dlm->DownloadUrl(dl_params.Pass()); | 1362 dlm->DownloadUrl(dl_params.Pass()); |
1362 break; | 1363 break; |
1363 } | 1364 } |
1364 | 1365 |
1365 case IDC_CONTENT_CONTEXT_SAVEAVAS: | 1366 case IDC_CONTENT_CONTEXT_SAVEAVAS: |
1366 case IDC_CONTENT_CONTEXT_SAVEIMAGEAS: { | 1367 case IDC_CONTENT_CONTEXT_SAVEIMAGEAS: { |
1367 download_util::RecordDownloadSource( | 1368 download_util::RecordDownloadSource( |
1368 download_util::INITIATED_BY_CONTEXT_MENU); | 1369 download_util::INITIATED_BY_CONTEXT_MENU); |
1369 const GURL& referrer = | 1370 const GURL& referrer = |
1370 params_.frame_url.is_empty() ? params_.page_url : params_.frame_url; | 1371 params_.frame_url.is_empty() ? params_.page_url : params_.frame_url; |
1371 const GURL& url = params_.src_url; | 1372 const GURL& url = params_.src_url; |
1372 content::DownloadSaveInfo save_info; | 1373 scoped_ptr<content::DownloadSaveInfo> save_info( |
1373 save_info.prompt_for_save_location = true; | 1374 new content::DownloadSaveInfo()); |
| 1375 save_info->prompt_for_save_location = true; |
1374 int64 post_id = -1; | 1376 int64 post_id = -1; |
1375 if (url == source_web_contents_->GetURL()) { | 1377 if (url == source_web_contents_->GetURL()) { |
1376 const NavigationEntry* entry = | 1378 const NavigationEntry* entry = |
1377 source_web_contents_->GetController().GetActiveEntry(); | 1379 source_web_contents_->GetController().GetActiveEntry(); |
1378 if (entry) | 1380 if (entry) |
1379 post_id = entry->GetPostID(); | 1381 post_id = entry->GetPostID(); |
1380 } | 1382 } |
1381 DownloadManager* dlm = BrowserContext::GetDownloadManager(profile_); | 1383 DownloadManager* dlm = BrowserContext::GetDownloadManager(profile_); |
1382 scoped_ptr<DownloadUrlParameters> dl_params( | 1384 scoped_ptr<DownloadUrlParameters> dl_params( |
1383 DownloadUrlParameters::FromWebContents( | 1385 DownloadUrlParameters::FromWebContents( |
1384 source_web_contents_, url, save_info)); | 1386 source_web_contents_, url, save_info.Pass())); |
1385 dl_params->set_referrer( | 1387 dl_params->set_referrer( |
1386 content::Referrer(referrer, params_.referrer_policy)); | 1388 content::Referrer(referrer, params_.referrer_policy)); |
1387 dl_params->set_post_id(post_id); | 1389 dl_params->set_post_id(post_id); |
1388 dl_params->set_prefer_cache(true); | 1390 dl_params->set_prefer_cache(true); |
1389 if (post_id >= 0) | 1391 if (post_id >= 0) |
1390 dl_params->set_method("POST"); | 1392 dl_params->set_method("POST"); |
1391 dlm->DownloadUrl(dl_params.Pass()); | 1393 dlm->DownloadUrl(dl_params.Pass()); |
1392 break; | 1394 break; |
1393 } | 1395 } |
1394 | 1396 |
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1815 source_web_contents_->GetRenderViewHost()-> | 1817 source_web_contents_->GetRenderViewHost()-> |
1816 ExecuteMediaPlayerActionAtLocation(location, action); | 1818 ExecuteMediaPlayerActionAtLocation(location, action); |
1817 } | 1819 } |
1818 | 1820 |
1819 void RenderViewContextMenu::PluginActionAt( | 1821 void RenderViewContextMenu::PluginActionAt( |
1820 const gfx::Point& location, | 1822 const gfx::Point& location, |
1821 const WebPluginAction& action) { | 1823 const WebPluginAction& action) { |
1822 source_web_contents_->GetRenderViewHost()-> | 1824 source_web_contents_->GetRenderViewHost()-> |
1823 ExecutePluginActionAtLocation(location, action); | 1825 ExecutePluginActionAtLocation(location, action); |
1824 } | 1826 } |
OLD | NEW |