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

Side by Side Diff: chrome/browser/ui/browser_commands.cc

Issue 304313003: Allow view-source of pages fully-blocked by Blink's XSS filter. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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 "chrome/browser/ui/browser_commands.h" 5 #include "chrome/browser/ui/browser_commands.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
9 #include "base/prefs/pref_service.h" 9 #include "base/prefs/pref_service.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 1126 matching lines...) Expand 10 before | Expand all | Expand 10 after
1137 1137
1138 void ViewSource(Browser* browser, WebContents* contents) { 1138 void ViewSource(Browser* browser, WebContents* contents) {
1139 DCHECK(contents); 1139 DCHECK(contents);
1140 1140
1141 // Use the last committed entry, since the pending entry hasn't loaded yet and 1141 // Use the last committed entry, since the pending entry hasn't loaded yet and
1142 // won't be copied into the cloned tab. 1142 // won't be copied into the cloned tab.
1143 NavigationEntry* entry = contents->GetController().GetLastCommittedEntry(); 1143 NavigationEntry* entry = contents->GetController().GetLastCommittedEntry();
1144 if (!entry) 1144 if (!entry)
1145 return; 1145 return;
1146 1146
1147 // If blink sent us to its blocked-page URL, show the source of the previous
1148 // page (which generated the block) instead.
1149 if (entry->GetURL() == GURL("data:,Blocked")) {
sky 2014/06/01 19:55:11 Is "data:,Blocked" not a legal url that could be e
1150 entry = contents->GetController().GetEntryAtOffset(-1);
1151 if (!entry)
1152 return;
1153 }
1154
1147 ViewSource(browser, contents, entry->GetURL(), entry->GetPageState()); 1155 ViewSource(browser, contents, entry->GetURL(), entry->GetPageState());
1148 } 1156 }
1149 1157
1150 void ViewSource(Browser* browser, 1158 void ViewSource(Browser* browser,
1151 WebContents* contents, 1159 WebContents* contents,
1152 const GURL& url, 1160 const GURL& url,
1153 const content::PageState& page_state) { 1161 const content::PageState& page_state) {
1154 content::RecordAction(UserMetricsAction("ViewSource")); 1162 content::RecordAction(UserMetricsAction("ViewSource"));
1155 DCHECK(contents); 1163 DCHECK(contents);
1156 1164
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
1264 browser->profile(), 1272 browser->profile(),
1265 browser->host_desktop_type())); 1273 browser->host_desktop_type()));
1266 app_browser->tab_strip_model()->AppendWebContents(contents, true); 1274 app_browser->tab_strip_model()->AppendWebContents(contents, true);
1267 1275
1268 contents->GetMutableRendererPrefs()->can_accept_load_drops = false; 1276 contents->GetMutableRendererPrefs()->can_accept_load_drops = false;
1269 contents->GetRenderViewHost()->SyncRendererPrefs(); 1277 contents->GetRenderViewHost()->SyncRendererPrefs();
1270 app_browser->window()->Show(); 1278 app_browser->window()->Show();
1271 } 1279 }
1272 1280
1273 } // namespace chrome 1281 } // namespace chrome
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698