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

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

Issue 2501083004: Fix View Frame Source for iframe of a file:// URL shows main frame's filename (Closed)
Patch Set: Created 4 years, 1 month 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
« 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_macros.h" 8 #include "base/metrics/histogram_macros.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "build/build_config.h" 10 #include "build/build_config.h"
(...skipping 1186 matching lines...) Expand 10 before | Expand all | Expand 10 after
1197 DCHECK(view_source_contents->GetController().CanPruneAllButLastCommitted()); 1197 DCHECK(view_source_contents->GetController().CanPruneAllButLastCommitted());
1198 view_source_contents->GetController().PruneAllButLastCommitted(); 1198 view_source_contents->GetController().PruneAllButLastCommitted();
1199 NavigationEntry* last_committed_entry = 1199 NavigationEntry* last_committed_entry =
1200 view_source_contents->GetController().GetLastCommittedEntry(); 1200 view_source_contents->GetController().GetLastCommittedEntry();
1201 if (!last_committed_entry) 1201 if (!last_committed_entry)
1202 return; 1202 return;
1203 1203
1204 GURL view_source_url = 1204 GURL view_source_url =
1205 GURL(content::kViewSourceScheme + std::string(":") + url.spec()); 1205 GURL(content::kViewSourceScheme + std::string(":") + url.spec());
1206 last_committed_entry->SetVirtualURL(view_source_url); 1206 last_committed_entry->SetVirtualURL(view_source_url);
1207 last_committed_entry->SetURL(GURL());
Charlie Reis 2016/11/17 23:04:24 Hmm, I'm not sure this is safe. There are other p
afakhry 2016/11/19 01:49:29 Yes, it gets set again later as a result of receiv
1207 1208
1208 // Do not restore scroller position. 1209 // Do not restore scroller position.
1209 last_committed_entry->SetPageState(page_state.RemoveScrollOffset()); 1210 last_committed_entry->SetPageState(page_state.RemoveScrollOffset());
1210 1211
1211 // Do not restore title, derive it from the url. 1212 // Do not restore title, derive it from the url.
1212 view_source_contents->UpdateTitleForEntry(last_committed_entry, 1213 view_source_contents->UpdateTitleForEntry(last_committed_entry,
1213 base::string16()); 1214 base::string16());
1214 1215
1215 // Now show view-source entry. 1216 // Now show view-source entry.
1216 if (browser->CanSupportWindowFeature(Browser::FEATURE_TABSTRIP)) { 1217 if (browser->CanSupportWindowFeature(Browser::FEATURE_TABSTRIP)) {
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
1299 app_name, true /* trusted_source */, gfx::Rect(), browser->profile())); 1300 app_name, true /* trusted_source */, gfx::Rect(), browser->profile()));
1300 app_browser->tab_strip_model()->AppendWebContents(contents, true); 1301 app_browser->tab_strip_model()->AppendWebContents(contents, true);
1301 1302
1302 contents->GetMutableRendererPrefs()->can_accept_load_drops = false; 1303 contents->GetMutableRendererPrefs()->can_accept_load_drops = false;
1303 contents->GetRenderViewHost()->SyncRendererPrefs(); 1304 contents->GetRenderViewHost()->SyncRendererPrefs();
1304 app_browser->window()->Show(); 1305 app_browser->window()->Show();
1305 } 1306 }
1306 #endif // BUILDFLAG(ENABLE_EXTENSIONS) 1307 #endif // BUILDFLAG(ENABLE_EXTENSIONS)
1307 1308
1308 } // namespace chrome 1309 } // 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