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

Unified Diff: chrome/browser/tab_contents/render_view_context_menu.cc

Issue 165068: Enabling "Save as..." in view:source page.... (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 11 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/browser.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/tab_contents/render_view_context_menu.cc
===================================================================
--- chrome/browser/tab_contents/render_view_context_menu.cc (revision 24078)
+++ chrome/browser/tab_contents/render_view_context_menu.cc (working copy)
@@ -307,7 +307,7 @@
// The images shown in the most visited thumbnails do not currently open
// in a new tab as they should. Disabling this context menu option for
// now, as a quick hack, before we resolve this issue (Issue = 2608).
- // TODO (sidchat): Enable this option once this issue is resolved.
+ // TODO(sidchat): Enable this option once this issue is resolved.
if (params_.src_url.scheme() == chrome::kChromeUIScheme)
return false;
return true;
@@ -352,8 +352,17 @@
case IDS_CONTENT_CONTEXT_OPENVIDEONEWTAB:
return true;
- case IDS_CONTENT_CONTEXT_SAVEPAGEAS:
- return SavePackage::IsSavableURL(source_tab_contents_->GetURL());
+ case IDS_CONTENT_CONTEXT_SAVEPAGEAS: {
+ // Instead of using GetURL here, we use url() (which is the "real" url of
+ // the page) from the NavigationEntry because its reflects their origin
+ // rather than the display one (returned by GetURL) which may be
+ // different (like having "view-source:" on the front).
+ NavigationEntry* active_entry =
+ source_tab_contents_->controller().GetActiveEntry();
+ GURL savable_url = (active_entry) ? active_entry->url() :
+ GURL::EmptyGURL();
+ return SavePackage::IsSavableURL(savable_url);
+ }
case IDS_CONTENT_CONTEXT_OPENFRAMENEWTAB:
case IDS_CONTENT_CONTEXT_OPENFRAMENEWWINDOW:
« no previous file with comments | « chrome/browser/browser.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698