OLD | NEW |
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 996 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 view_source_contents->GetController().PruneAllButActive(); |
1012 NavigationEntry* active_entry = | 1012 NavigationEntry* active_entry = |
1013 view_source_contents->GetController().GetActiveEntry(); | 1013 view_source_contents->GetController().GetActiveEntry(); |
1014 if (!active_entry) | 1014 if (!active_entry) |
1015 return; | 1015 return; |
1016 | 1016 |
1017 GURL view_source_url = GURL(kViewSourceScheme + std::string(":") + | 1017 GURL view_source_url = |
1018 url.spec()); | 1018 GURL(content::kViewSourceScheme + std::string(":") + url.spec()); |
1019 active_entry->SetVirtualURL(view_source_url); | 1019 active_entry->SetVirtualURL(view_source_url); |
1020 | 1020 |
1021 // Do not restore scroller position. | 1021 // Do not restore scroller position. |
1022 active_entry->SetPageState(page_state.RemoveScrollOffset()); | 1022 active_entry->SetPageState(page_state.RemoveScrollOffset()); |
1023 | 1023 |
1024 // Do not restore title, derive it from the url. | 1024 // Do not restore title, derive it from the url. |
1025 active_entry->SetTitle(string16()); | 1025 active_entry->SetTitle(string16()); |
1026 | 1026 |
1027 // Now show view-source entry. | 1027 // Now show view-source entry. |
1028 if (browser->CanSupportWindowFeature(Browser::FEATURE_TABSTRIP)) { | 1028 if (browser->CanSupportWindowFeature(Browser::FEATURE_TABSTRIP)) { |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1098 Browser::TYPE_POPUP, app_name, gfx::Rect(), browser->profile(), | 1098 Browser::TYPE_POPUP, app_name, gfx::Rect(), browser->profile(), |
1099 browser->host_desktop_type())); | 1099 browser->host_desktop_type())); |
1100 app_browser->tab_strip_model()->AppendWebContents(contents, true); | 1100 app_browser->tab_strip_model()->AppendWebContents(contents, true); |
1101 | 1101 |
1102 contents->GetMutableRendererPrefs()->can_accept_load_drops = false; | 1102 contents->GetMutableRendererPrefs()->can_accept_load_drops = false; |
1103 contents->GetRenderViewHost()->SyncRendererPrefs(); | 1103 contents->GetRenderViewHost()->SyncRendererPrefs(); |
1104 app_browser->window()->Show(); | 1104 app_browser->window()->Show(); |
1105 } | 1105 } |
1106 | 1106 |
1107 } // namespace chrome | 1107 } // namespace chrome |
OLD | NEW |