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

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

Issue 15041004: Replace PruneAllButActive with PruneAllButVisible. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Change to CHECK. Created 7 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/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
(...skipping 990 matching lines...) Expand 10 before | Expand all | Expand 10 after
1001 void ViewSource(Browser* browser, 1001 void ViewSource(Browser* browser,
1002 WebContents* contents, 1002 WebContents* contents,
1003 const GURL& url, 1003 const GURL& url,
1004 const content::PageState& page_state) { 1004 const content::PageState& page_state) {
1005 content::RecordAction(UserMetricsAction("ViewSource")); 1005 content::RecordAction(UserMetricsAction("ViewSource"));
1006 DCHECK(contents); 1006 DCHECK(contents);
1007 1007
1008 // Note that Clone does not copy the pending or transient entries, so the 1008 // Note that Clone does not copy the pending or transient entries, so the
1009 // active entry in view_source_contents will be the last committed entry. 1009 // active entry in view_source_contents will be the last committed entry.
1010 WebContents* view_source_contents = contents->Clone(); 1010 WebContents* view_source_contents = contents->Clone();
1011 view_source_contents->GetController().PruneAllButActive(); 1011 DCHECK(view_source_contents->GetController().CanPruneAllButVisible());
1012 view_source_contents->GetController().PruneAllButVisible();
1012 NavigationEntry* active_entry = 1013 NavigationEntry* active_entry =
1013 view_source_contents->GetController().GetActiveEntry(); 1014 view_source_contents->GetController().GetActiveEntry();
1014 if (!active_entry) 1015 if (!active_entry)
1015 return; 1016 return;
1016 1017
1017 GURL view_source_url = GURL(kViewSourceScheme + std::string(":") + 1018 GURL view_source_url = GURL(kViewSourceScheme + std::string(":") +
1018 url.spec()); 1019 url.spec());
1019 active_entry->SetVirtualURL(view_source_url); 1020 active_entry->SetVirtualURL(view_source_url);
1020 1021
1021 // Do not restore scroller position. 1022 // Do not restore scroller position.
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
1098 Browser::TYPE_POPUP, app_name, gfx::Rect(), browser->profile(), 1099 Browser::TYPE_POPUP, app_name, gfx::Rect(), browser->profile(),
1099 browser->host_desktop_type())); 1100 browser->host_desktop_type()));
1100 app_browser->tab_strip_model()->AppendWebContents(contents, true); 1101 app_browser->tab_strip_model()->AppendWebContents(contents, true);
1101 1102
1102 contents->GetMutableRendererPrefs()->can_accept_load_drops = false; 1103 contents->GetMutableRendererPrefs()->can_accept_load_drops = false;
1103 contents->GetRenderViewHost()->SyncRendererPrefs(); 1104 contents->GetRenderViewHost()->SyncRendererPrefs();
1104 app_browser->window()->Show(); 1105 app_browser->window()->Show();
1105 } 1106 }
1106 1107
1107 } // namespace chrome 1108 } // namespace chrome
OLDNEW
« no previous file with comments | « chrome/browser/prerender/prerender_manager.cc ('k') | chrome/browser/ui/browser_instant_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698