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