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

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

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

Powered by Google App Engine
This is Rietveld 408576698