| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 | 7 |
| 8 #include "chrome/browser/tab_contents/render_view_context_menu.h" | 8 #include "chrome/browser/tab_contents/render_view_context_menu.h" |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| 11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "base/metrics/histogram.h" | 12 #include "base/metrics/histogram.h" |
| 13 #include "base/stl_util.h" | 13 #include "base/stl_util.h" |
| 14 #include "base/string_util.h" | 14 #include "base/string_util.h" |
| 15 #include "base/time.h" | 15 #include "base/time.h" |
| 16 #include "base/utf_string_conversions.h" | 16 #include "base/utf_string_conversions.h" |
| 17 #include "chrome/app/chrome_command_ids.h" | 17 #include "chrome/app/chrome_command_ids.h" |
| 18 #include "chrome/browser/autocomplete/autocomplete_classifier.h" | 18 #include "chrome/browser/autocomplete/autocomplete_classifier.h" |
| 19 #include "chrome/browser/autocomplete/autocomplete_edit.h" | 19 #include "chrome/browser/autocomplete/autocomplete_edit.h" |
| 20 #include "chrome/browser/autocomplete/autocomplete_match.h" | 20 #include "chrome/browser/autocomplete/autocomplete_match.h" |
| 21 #include "chrome/browser/browser_process.h" | 21 #include "chrome/browser/browser_process.h" |
| 22 #include "chrome/browser/debugger/devtools_window.h" | 22 #include "chrome/browser/debugger/devtools_window.h" |
| 23 #include "chrome/browser/download/download_service.h" |
| 24 #include "chrome/browser/download/download_service_factory.h" |
| 23 #include "chrome/browser/extensions/extension_event_router.h" | 25 #include "chrome/browser/extensions/extension_event_router.h" |
| 24 #include "chrome/browser/extensions/extension_service.h" | 26 #include "chrome/browser/extensions/extension_service.h" |
| 25 #include "chrome/browser/google/google_util.h" | 27 #include "chrome/browser/google/google_util.h" |
| 26 #include "chrome/browser/net/browser_url_util.h" | 28 #include "chrome/browser/net/browser_url_util.h" |
| 27 #include "chrome/browser/prefs/incognito_mode_prefs.h" | 29 #include "chrome/browser/prefs/incognito_mode_prefs.h" |
| 28 #include "chrome/browser/prefs/pref_member.h" | 30 #include "chrome/browser/prefs/pref_member.h" |
| 29 #include "chrome/browser/prefs/pref_service.h" | 31 #include "chrome/browser/prefs/pref_service.h" |
| 30 #include "chrome/browser/printing/print_preview_tab_controller.h" | 32 #include "chrome/browser/printing/print_preview_tab_controller.h" |
| 31 #include "chrome/browser/printing/print_view_manager.h" | 33 #include "chrome/browser/printing/print_view_manager.h" |
| 32 #include "chrome/browser/profiles/profile.h" | 34 #include "chrome/browser/profiles/profile.h" |
| (...skipping 1464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1497 case IDC_CONTENT_CONTEXT_SAVEAVAS: | 1499 case IDC_CONTENT_CONTEXT_SAVEAVAS: |
| 1498 case IDC_CONTENT_CONTEXT_SAVEIMAGEAS: | 1500 case IDC_CONTENT_CONTEXT_SAVEIMAGEAS: |
| 1499 case IDC_CONTENT_CONTEXT_SAVELINKAS: { | 1501 case IDC_CONTENT_CONTEXT_SAVELINKAS: { |
| 1500 download_stats::RecordDownloadCount( | 1502 download_stats::RecordDownloadCount( |
| 1501 download_stats::INITIATED_BY_CONTEXT_MENU_COUNT); | 1503 download_stats::INITIATED_BY_CONTEXT_MENU_COUNT); |
| 1502 const GURL& referrer = | 1504 const GURL& referrer = |
| 1503 params_.frame_url.is_empty() ? params_.page_url : params_.frame_url; | 1505 params_.frame_url.is_empty() ? params_.page_url : params_.frame_url; |
| 1504 const GURL& url = | 1506 const GURL& url = |
| 1505 (id == IDC_CONTENT_CONTEXT_SAVELINKAS ? params_.link_url : | 1507 (id == IDC_CONTENT_CONTEXT_SAVELINKAS ? params_.link_url : |
| 1506 params_.src_url); | 1508 params_.src_url); |
| 1507 DownloadManager* dlm = profile_->GetDownloadManager(); | 1509 DownloadManager* dlm = |
| 1510 DownloadServiceFactory::GetForProfile(profile_)->GetDownloadManager(); |
| 1508 dlm->DownloadUrl(url, referrer, params_.frame_charset, | 1511 dlm->DownloadUrl(url, referrer, params_.frame_charset, |
| 1509 source_tab_contents_); | 1512 source_tab_contents_); |
| 1510 break; | 1513 break; |
| 1511 } | 1514 } |
| 1512 | 1515 |
| 1513 case IDC_CONTENT_CONTEXT_COPYLINKLOCATION: | 1516 case IDC_CONTENT_CONTEXT_COPYLINKLOCATION: |
| 1514 WriteURLToClipboard(params_.unfiltered_link_url); | 1517 WriteURLToClipboard(params_.unfiltered_link_url); |
| 1515 break; | 1518 break; |
| 1516 | 1519 |
| 1517 case IDC_CONTENT_CONTEXT_COPYIMAGELOCATION: | 1520 case IDC_CONTENT_CONTEXT_COPYIMAGELOCATION: |
| (...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1940 profile_->GetPrefs()->GetString(prefs::kAcceptLanguages), | 1943 profile_->GetPrefs()->GetString(prefs::kAcceptLanguages), |
| 1941 g_browser_process->clipboard()); | 1944 g_browser_process->clipboard()); |
| 1942 } | 1945 } |
| 1943 | 1946 |
| 1944 void RenderViewContextMenu::MediaPlayerActionAt( | 1947 void RenderViewContextMenu::MediaPlayerActionAt( |
| 1945 const gfx::Point& location, | 1948 const gfx::Point& location, |
| 1946 const WebMediaPlayerAction& action) { | 1949 const WebMediaPlayerAction& action) { |
| 1947 source_tab_contents_->render_view_host()-> | 1950 source_tab_contents_->render_view_host()-> |
| 1948 ExecuteMediaPlayerActionAtLocation(location, action); | 1951 ExecuteMediaPlayerActionAtLocation(location, action); |
| 1949 } | 1952 } |
| OLD | NEW |