Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(323)

Side by Side Diff: chrome/browser/tab_contents/render_view_context_menu.cc

Issue 8135017: Refactor downloads into a ProfileKeyedService. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Incorporated latest rounds of comments from John. Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/profiles/profile_impl.cc ('k') | chrome/browser/ui/browser.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1465 matching lines...) Expand 10 before | Expand all | Expand 10 after
1498 case IDC_CONTENT_CONTEXT_SAVEAVAS: 1500 case IDC_CONTENT_CONTEXT_SAVEAVAS:
1499 case IDC_CONTENT_CONTEXT_SAVEIMAGEAS: 1501 case IDC_CONTENT_CONTEXT_SAVEIMAGEAS:
1500 case IDC_CONTENT_CONTEXT_SAVELINKAS: { 1502 case IDC_CONTENT_CONTEXT_SAVELINKAS: {
1501 download_stats::RecordDownloadCount( 1503 download_stats::RecordDownloadCount(
1502 download_stats::INITIATED_BY_CONTEXT_MENU_COUNT); 1504 download_stats::INITIATED_BY_CONTEXT_MENU_COUNT);
1503 const GURL& referrer = 1505 const GURL& referrer =
1504 params_.frame_url.is_empty() ? params_.page_url : params_.frame_url; 1506 params_.frame_url.is_empty() ? params_.page_url : params_.frame_url;
1505 const GURL& url = 1507 const GURL& url =
1506 (id == IDC_CONTENT_CONTEXT_SAVELINKAS ? params_.link_url : 1508 (id == IDC_CONTENT_CONTEXT_SAVELINKAS ? params_.link_url :
1507 params_.src_url); 1509 params_.src_url);
1508 DownloadManager* dlm = profile_->GetDownloadManager(); 1510 DownloadManager* dlm =
1511 DownloadServiceFactory::GetForProfile(profile_)->GetDownloadManager();
1509 dlm->DownloadUrl(url, referrer, params_.frame_charset, 1512 dlm->DownloadUrl(url, referrer, params_.frame_charset,
1510 source_tab_contents_); 1513 source_tab_contents_);
1511 break; 1514 break;
1512 } 1515 }
1513 1516
1514 case IDC_CONTENT_CONTEXT_COPYLINKLOCATION: 1517 case IDC_CONTENT_CONTEXT_COPYLINKLOCATION:
1515 WriteURLToClipboard(params_.unfiltered_link_url); 1518 WriteURLToClipboard(params_.unfiltered_link_url);
1516 break; 1519 break;
1517 1520
1518 case IDC_CONTENT_CONTEXT_COPYIMAGELOCATION: 1521 case IDC_CONTENT_CONTEXT_COPYIMAGELOCATION:
(...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after
1949 profile_->GetPrefs()->GetString(prefs::kAcceptLanguages), 1952 profile_->GetPrefs()->GetString(prefs::kAcceptLanguages),
1950 g_browser_process->clipboard()); 1953 g_browser_process->clipboard());
1951 } 1954 }
1952 1955
1953 void RenderViewContextMenu::MediaPlayerActionAt( 1956 void RenderViewContextMenu::MediaPlayerActionAt(
1954 const gfx::Point& location, 1957 const gfx::Point& location,
1955 const WebMediaPlayerAction& action) { 1958 const WebMediaPlayerAction& action) {
1956 source_tab_contents_->render_view_host()-> 1959 source_tab_contents_->render_view_host()->
1957 ExecuteMediaPlayerActionAtLocation(location, action); 1960 ExecuteMediaPlayerActionAtLocation(location, action);
1958 } 1961 }
OLDNEW
« no previous file with comments | « chrome/browser/profiles/profile_impl.cc ('k') | chrome/browser/ui/browser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698