| 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 1484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1495 | 1495 |
| 1496 case IDC_CONTENT_CONTEXT_OPENLINKOFFTHERECORD: | 1496 case IDC_CONTENT_CONTEXT_OPENLINKOFFTHERECORD: |
| 1497 OpenURL(params_.link_url, | 1497 OpenURL(params_.link_url, |
| 1498 GURL(), | 1498 GURL(), |
| 1499 params_.frame_id, | 1499 params_.frame_id, |
| 1500 OFF_THE_RECORD, | 1500 OFF_THE_RECORD, |
| 1501 content::PAGE_TRANSITION_LINK); | 1501 content::PAGE_TRANSITION_LINK); |
| 1502 break; | 1502 break; |
| 1503 | 1503 |
| 1504 case IDC_CONTENT_CONTEXT_SAVELINKAS: { | 1504 case IDC_CONTENT_CONTEXT_SAVELINKAS: { |
| 1505 download_util::RecordDownloadCount( | 1505 download_util::RecordDownloadSource( |
| 1506 download_util::INITIATED_BY_CONTEXT_MENU_COUNT); | 1506 download_util::INITIATED_BY_CONTEXT_MENU); |
| 1507 const GURL& referrer = | 1507 const GURL& referrer = |
| 1508 params_.frame_url.is_empty() ? params_.page_url : params_.frame_url; | 1508 params_.frame_url.is_empty() ? params_.page_url : params_.frame_url; |
| 1509 const GURL& url = params_.link_url; | 1509 const GURL& url = params_.link_url; |
| 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 break; | 1521 break; |
| 1522 } | 1522 } |
| 1523 | 1523 |
| 1524 case IDC_CONTENT_CONTEXT_SAVEAVAS: | 1524 case IDC_CONTENT_CONTEXT_SAVEAVAS: |
| 1525 case IDC_CONTENT_CONTEXT_SAVEIMAGEAS: { | 1525 case IDC_CONTENT_CONTEXT_SAVEIMAGEAS: { |
| 1526 download_util::RecordDownloadCount( | 1526 download_util::RecordDownloadSource( |
| 1527 download_util::INITIATED_BY_CONTEXT_MENU_COUNT); | 1527 download_util::INITIATED_BY_CONTEXT_MENU); |
| 1528 const GURL& referrer = | 1528 const GURL& referrer = |
| 1529 params_.frame_url.is_empty() ? params_.page_url : params_.frame_url; | 1529 params_.frame_url.is_empty() ? params_.page_url : params_.frame_url; |
| 1530 const GURL& url = params_.src_url; | 1530 const GURL& url = params_.src_url; |
| 1531 DownloadSaveInfo save_info; | 1531 DownloadSaveInfo save_info; |
| 1532 save_info.prompt_for_save_location = true; | 1532 save_info.prompt_for_save_location = true; |
| 1533 int64 post_id = -1; | 1533 int64 post_id = -1; |
| 1534 if (url == source_web_contents_->GetURL()) { | 1534 if (url == source_web_contents_->GetURL()) { |
| 1535 const NavigationEntry* entry = | 1535 const NavigationEntry* entry = |
| 1536 source_web_contents_->GetController().GetActiveEntry(); | 1536 source_web_contents_->GetController().GetActiveEntry(); |
| 1537 if (entry) | 1537 if (entry) |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1674 source_web_contents_->ViewSource(); | 1674 source_web_contents_->ViewSource(); |
| 1675 break; | 1675 break; |
| 1676 | 1676 |
| 1677 case IDC_CONTENT_CONTEXT_INSPECTELEMENT: | 1677 case IDC_CONTENT_CONTEXT_INSPECTELEMENT: |
| 1678 Inspect(params_.x, params_.y); | 1678 Inspect(params_.x, params_.y); |
| 1679 break; | 1679 break; |
| 1680 | 1680 |
| 1681 case IDC_CONTENT_CONTEXT_VIEWPAGEINFO: { | 1681 case IDC_CONTENT_CONTEXT_VIEWPAGEINFO: { |
| 1682 NavigationController* controller = &source_web_contents_->GetController(); | 1682 NavigationController* controller = &source_web_contents_->GetController(); |
| 1683 NavigationEntry* nav_entry = controller->GetActiveEntry(); | 1683 NavigationEntry* nav_entry = controller->GetActiveEntry(); |
| 1684 Browser* browser = Browser::GetBrowserForController(controller, NULL);
| 1684 Browser* browser = Browser::GetBrowserForController(controller, NULL); |
| 1685 browser->ShowPageInfo(nav_entry->GetURL(), nav_entry->GetSSL(), true); | 1685 browser->ShowPageInfo(nav_entry->GetURL(), nav_entry->GetSSL(), true); |
| 1686 break; | 1686 break; |
| 1687 } | 1687 } |
| 1688 | 1688 |
| 1689 case IDC_CONTENT_CONTEXT_TRANSLATE: { | 1689 case IDC_CONTENT_CONTEXT_TRANSLATE: { |
| 1690 // A translation might have been triggered by the time the menu got | 1690 // A translation might have been triggered by the time the menu got |
| 1691 // selected, do nothing in that case. | 1691 // selected, do nothing in that case. |
| 1692 TabContentsWrapper* tab_contents_wrapper = | 1692 TabContentsWrapper* tab_contents_wrapper = |
| 1693 TabContentsWrapper::GetCurrentWrapperForContents( | 1693 TabContentsWrapper::GetCurrentWrapperForContents( |
| 1694 source_web_contents_); | 1694 source_web_contents_); |
| (...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1986 source_web_contents_->GetRenderViewHost()-> | 1986 source_web_contents_->GetRenderViewHost()-> |
| 1987 ExecuteMediaPlayerActionAtLocation(location, action); | 1987 ExecuteMediaPlayerActionAtLocation(location, action); |
| 1988 } | 1988 } |
| 1989 | 1989 |
| 1990 void RenderViewContextMenu::PluginActionAt( | 1990 void RenderViewContextMenu::PluginActionAt( |
| 1991 const gfx::Point& location, | 1991 const gfx::Point& location, |
| 1992 const WebPluginAction& action) { | 1992 const WebPluginAction& action) { |
| 1993 source_web_contents_->GetRenderViewHost()-> | 1993 source_web_contents_->GetRenderViewHost()-> |
| 1994 ExecutePluginActionAtLocation(location, action); | 1994 ExecutePluginActionAtLocation(location, action); |
| 1995 } | 1995 } |
| OLD | NEW |