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

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

Issue 438733002: Revert https://src.chromium.org/viewvc/chrome?view=rev&revision=283728 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | content/browser/frame_host/navigation_entry_impl.h » ('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 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 1139 matching lines...) Expand 10 before | Expand all | Expand 10 after
1150 1150
1151 void ViewSource(Browser* browser, WebContents* contents) { 1151 void ViewSource(Browser* browser, WebContents* contents) {
1152 DCHECK(contents); 1152 DCHECK(contents);
1153 1153
1154 // Use the last committed entry, since the pending entry hasn't loaded yet and 1154 // Use the last committed entry, since the pending entry hasn't loaded yet and
1155 // won't be copied into the cloned tab. 1155 // won't be copied into the cloned tab.
1156 NavigationEntry* entry = contents->GetController().GetLastCommittedEntry(); 1156 NavigationEntry* entry = contents->GetController().GetLastCommittedEntry();
1157 if (!entry) 1157 if (!entry)
1158 return; 1158 return;
1159 1159
1160 // The URL "data:," is a special case, since Blink uses it when it wants to
1161 // show a "blocked page" from its reflected XSS filter. When the XSS filter
1162 // triggers, the current entry gets marked as containing an XSS, and then a
1163 // new navigation to "data:," occurs on top of it. Showing that page in place
1164 // of the "data:," URL permits examination of the cause of the reflection.
1165 if (entry->GetURL() == GURL("data:,")) {
1166 NavigationEntry* previous = contents->GetController().GetEntryAtOffset(-1);
1167 if (previous && previous->GetXssDetected())
1168 entry = previous;
1169 }
1170
1171 ViewSource(browser, contents, entry->GetURL(), entry->GetPageState()); 1160 ViewSource(browser, contents, entry->GetURL(), entry->GetPageState());
1172 } 1161 }
1173 1162
1174 void ViewSource(Browser* browser, 1163 void ViewSource(Browser* browser,
1175 WebContents* contents, 1164 WebContents* contents,
1176 const GURL& url, 1165 const GURL& url,
1177 const content::PageState& page_state) { 1166 const content::PageState& page_state) {
1178 content::RecordAction(UserMetricsAction("ViewSource")); 1167 content::RecordAction(UserMetricsAction("ViewSource"));
1179 DCHECK(contents); 1168 DCHECK(contents);
1180 1169
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
1286 browser->profile(), 1275 browser->profile(),
1287 browser->host_desktop_type())); 1276 browser->host_desktop_type()));
1288 app_browser->tab_strip_model()->AppendWebContents(contents, true); 1277 app_browser->tab_strip_model()->AppendWebContents(contents, true);
1289 1278
1290 contents->GetMutableRendererPrefs()->can_accept_load_drops = false; 1279 contents->GetMutableRendererPrefs()->can_accept_load_drops = false;
1291 contents->GetRenderViewHost()->SyncRendererPrefs(); 1280 contents->GetRenderViewHost()->SyncRendererPrefs();
1292 app_browser->window()->Show(); 1281 app_browser->window()->Show();
1293 } 1282 }
1294 1283
1295 } // namespace chrome 1284 } // namespace chrome
OLDNEW
« no previous file with comments | « no previous file | content/browser/frame_host/navigation_entry_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698