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

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: Add xss_detected_ bool and use it. 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
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 1128 matching lines...) Expand 10 before | Expand all | Expand 10 after
1139 1139
1140 void ViewSource(Browser* browser, WebContents* contents) { 1140 void ViewSource(Browser* browser, WebContents* contents) {
1141 DCHECK(contents); 1141 DCHECK(contents);
1142 1142
1143 // Use the last committed entry, since the pending entry hasn't loaded yet and 1143 // Use the last committed entry, since the pending entry hasn't loaded yet and
1144 // won't be copied into the cloned tab. 1144 // won't be copied into the cloned tab.
1145 NavigationEntry* entry = contents->GetController().GetLastCommittedEntry(); 1145 NavigationEntry* entry = contents->GetController().GetLastCommittedEntry();
1146 if (!entry) 1146 if (!entry)
1147 return; 1147 return;
1148 1148
1149 // If blink sent us to its blocked-page URL, show the source of the previous
brettw 2014/06/18 21:51:41 Can this explain in more detail what happens when
Tom Sepez 2014/06/18 22:13:22 Done.
1150 // page (which generated the block) instead.
1151 if (entry->GetURL() == GURL("data:,")) {
1152 NavigationEntry* previous = contents->GetController().GetEntryAtOffset(-1);
1153 if (previous && previous->GetXssDetected())
1154 entry = previous;
1155 }
1156
1149 ViewSource(browser, contents, entry->GetURL(), entry->GetPageState()); 1157 ViewSource(browser, contents, entry->GetURL(), entry->GetPageState());
1150 } 1158 }
1151 1159
1152 void ViewSource(Browser* browser, 1160 void ViewSource(Browser* browser,
1153 WebContents* contents, 1161 WebContents* contents,
1154 const GURL& url, 1162 const GURL& url,
1155 const content::PageState& page_state) { 1163 const content::PageState& page_state) {
1156 content::RecordAction(UserMetricsAction("ViewSource")); 1164 content::RecordAction(UserMetricsAction("ViewSource"));
1157 DCHECK(contents); 1165 DCHECK(contents);
1158 1166
(...skipping 105 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 | content/browser/frame_host/navigation_entry_impl.h » ('j') | content/browser/frame_host/navigation_entry_impl.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698