| 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 1507 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1518 DownloadSaveInfo save_info; | 1518 DownloadSaveInfo save_info; |
| 1519 save_info.prompt_for_save_location = true; | 1519 save_info.prompt_for_save_location = true; |
| 1520 DownloadManager* dlm = | 1520 DownloadManager* dlm = |
| 1521 DownloadServiceFactory::GetForProfile(profile_)->GetDownloadManager(); | 1521 DownloadServiceFactory::GetForProfile(profile_)->GetDownloadManager(); |
| 1522 dlm->DownloadUrl(url, | 1522 dlm->DownloadUrl(url, |
| 1523 referrer, | 1523 referrer, |
| 1524 params_.frame_charset, | 1524 params_.frame_charset, |
| 1525 false, // Don't prefer_cache | 1525 false, // Don't prefer_cache |
| 1526 -1, // No POST id | 1526 -1, // No POST id |
| 1527 save_info, | 1527 save_info, |
| 1528 source_web_contents_); | 1528 source_web_contents_, |
| 1529 DownloadManager::OnStartedCallback()); |
| 1529 break; | 1530 break; |
| 1530 } | 1531 } |
| 1531 | 1532 |
| 1532 case IDC_CONTENT_CONTEXT_SAVEAVAS: | 1533 case IDC_CONTENT_CONTEXT_SAVEAVAS: |
| 1533 case IDC_CONTENT_CONTEXT_SAVEIMAGEAS: { | 1534 case IDC_CONTENT_CONTEXT_SAVEIMAGEAS: { |
| 1534 download_util::RecordDownloadSource( | 1535 download_util::RecordDownloadSource( |
| 1535 download_util::INITIATED_BY_CONTEXT_MENU); | 1536 download_util::INITIATED_BY_CONTEXT_MENU); |
| 1536 const GURL& referrer = | 1537 const GURL& referrer = |
| 1537 params_.frame_url.is_empty() ? params_.page_url : params_.frame_url; | 1538 params_.frame_url.is_empty() ? params_.page_url : params_.frame_url; |
| 1538 const GURL& url = params_.src_url; | 1539 const GURL& url = params_.src_url; |
| 1539 DownloadSaveInfo save_info; | 1540 DownloadSaveInfo save_info; |
| 1540 save_info.prompt_for_save_location = true; | 1541 save_info.prompt_for_save_location = true; |
| 1541 int64 post_id = -1; | 1542 int64 post_id = -1; |
| 1542 if (url == source_web_contents_->GetURL()) { | 1543 if (url == source_web_contents_->GetURL()) { |
| 1543 const NavigationEntry* entry = | 1544 const NavigationEntry* entry = |
| 1544 source_web_contents_->GetController().GetActiveEntry(); | 1545 source_web_contents_->GetController().GetActiveEntry(); |
| 1545 if (entry) | 1546 if (entry) |
| 1546 post_id = entry->GetPostID(); | 1547 post_id = entry->GetPostID(); |
| 1547 } | 1548 } |
| 1548 DownloadManager* dlm = | 1549 DownloadManager* dlm = |
| 1549 DownloadServiceFactory::GetForProfile(profile_)->GetDownloadManager(); | 1550 DownloadServiceFactory::GetForProfile(profile_)->GetDownloadManager(); |
| 1550 dlm->DownloadUrl(url, | 1551 dlm->DownloadUrl(url, |
| 1551 referrer, | 1552 referrer, |
| 1552 "", | 1553 "", |
| 1553 true, // prefer_cache | 1554 true, // prefer_cache |
| 1554 post_id, | 1555 post_id, |
| 1555 save_info, | 1556 save_info, |
| 1556 source_web_contents_); | 1557 source_web_contents_, |
| 1558 DownloadManager::OnStartedCallback()); |
| 1557 break; | 1559 break; |
| 1558 } | 1560 } |
| 1559 | 1561 |
| 1560 case IDC_CONTENT_CONTEXT_COPYLINKLOCATION: | 1562 case IDC_CONTENT_CONTEXT_COPYLINKLOCATION: |
| 1561 WriteURLToClipboard(params_.unfiltered_link_url); | 1563 WriteURLToClipboard(params_.unfiltered_link_url); |
| 1562 break; | 1564 break; |
| 1563 | 1565 |
| 1564 case IDC_CONTENT_CONTEXT_COPYIMAGELOCATION: | 1566 case IDC_CONTENT_CONTEXT_COPYIMAGELOCATION: |
| 1565 case IDC_CONTENT_CONTEXT_COPYAVLOCATION: | 1567 case IDC_CONTENT_CONTEXT_COPYAVLOCATION: |
| 1566 WriteURLToClipboard(params_.src_url); | 1568 WriteURLToClipboard(params_.src_url); |
| (...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1998 source_web_contents_->GetRenderViewHost()-> | 2000 source_web_contents_->GetRenderViewHost()-> |
| 1999 ExecuteMediaPlayerActionAtLocation(location, action); | 2001 ExecuteMediaPlayerActionAtLocation(location, action); |
| 2000 } | 2002 } |
| 2001 | 2003 |
| 2002 void RenderViewContextMenu::PluginActionAt( | 2004 void RenderViewContextMenu::PluginActionAt( |
| 2003 const gfx::Point& location, | 2005 const gfx::Point& location, |
| 2004 const WebPluginAction& action) { | 2006 const WebPluginAction& action) { |
| 2005 source_web_contents_->GetRenderViewHost()-> | 2007 source_web_contents_->GetRenderViewHost()-> |
| 2006 ExecutePluginActionAtLocation(location, action); | 2008 ExecutePluginActionAtLocation(location, action); |
| 2007 } | 2009 } |
| OLD | NEW |