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

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

Issue 2086423005: Using WebContents::UpdateTitleForEntry() instead of NavigationEntry::SetTitle() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix compile error Created 4 years, 5 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
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/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 1182 matching lines...) Expand 10 before | Expand all | Expand 10 after
1193 return; 1193 return;
1194 1194
1195 GURL view_source_url = 1195 GURL view_source_url =
1196 GURL(content::kViewSourceScheme + std::string(":") + url.spec()); 1196 GURL(content::kViewSourceScheme + std::string(":") + url.spec());
1197 last_committed_entry->SetVirtualURL(view_source_url); 1197 last_committed_entry->SetVirtualURL(view_source_url);
1198 1198
1199 // Do not restore scroller position. 1199 // Do not restore scroller position.
1200 last_committed_entry->SetPageState(page_state.RemoveScrollOffset()); 1200 last_committed_entry->SetPageState(page_state.RemoveScrollOffset());
1201 1201
1202 // Do not restore title, derive it from the url. 1202 // Do not restore title, derive it from the url.
1203 last_committed_entry->SetTitle(base::string16()); 1203 view_source_contents->UpdateTitleForEntry(last_committed_entry,
1204 base::string16());
Charlie Reis 2016/07/13 21:02:23 I think this should be safe. Technically we might
afakhry 2016/07/13 22:10:27 Acknowledged.
1204 1205
1205 // Now show view-source entry. 1206 // Now show view-source entry.
1206 if (browser->CanSupportWindowFeature(Browser::FEATURE_TABSTRIP)) { 1207 if (browser->CanSupportWindowFeature(Browser::FEATURE_TABSTRIP)) {
1207 // If this is a tabbed browser, just create a duplicate tab inside the same 1208 // If this is a tabbed browser, just create a duplicate tab inside the same
1208 // window next to the tab being duplicated. 1209 // window next to the tab being duplicated.
1209 int index = browser->tab_strip_model()->GetIndexOfWebContents(contents); 1210 int index = browser->tab_strip_model()->GetIndexOfWebContents(contents);
1210 int add_types = TabStripModel::ADD_ACTIVE | 1211 int add_types = TabStripModel::ADD_ACTIVE |
1211 TabStripModel::ADD_INHERIT_GROUP; 1212 TabStripModel::ADD_INHERIT_GROUP;
1212 browser->tab_strip_model()->InsertWebContentsAt( 1213 browser->tab_strip_model()->InsertWebContentsAt(
1213 index + 1, 1214 index + 1,
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
1289 app_name, true /* trusted_source */, gfx::Rect(), browser->profile())); 1290 app_name, true /* trusted_source */, gfx::Rect(), browser->profile()));
1290 app_browser->tab_strip_model()->AppendWebContents(contents, true); 1291 app_browser->tab_strip_model()->AppendWebContents(contents, true);
1291 1292
1292 contents->GetMutableRendererPrefs()->can_accept_load_drops = false; 1293 contents->GetMutableRendererPrefs()->can_accept_load_drops = false;
1293 contents->GetRenderViewHost()->SyncRendererPrefs(); 1294 contents->GetRenderViewHost()->SyncRendererPrefs();
1294 app_browser->window()->Show(); 1295 app_browser->window()->Show();
1295 } 1296 }
1296 #endif // defined(ENABLE_EXTENSIONS) 1297 #endif // defined(ENABLE_EXTENSIONS)
1297 1298
1298 } // namespace chrome 1299 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698