OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "chrome/browser/bookmarks/bookmark_editor.h" | 10 #include "chrome/browser/bookmarks/bookmark_editor.h" |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 } | 111 } |
112 default: | 112 default: |
113 break; | 113 break; |
114 } | 114 } |
115 return current_tab->web_contents(); | 115 return current_tab->web_contents(); |
116 } | 116 } |
117 | 117 |
118 void ReloadInternal(Browser* browser, | 118 void ReloadInternal(Browser* browser, |
119 WindowOpenDisposition disposition, | 119 WindowOpenDisposition disposition, |
120 bool ignore_cache) { | 120 bool ignore_cache) { |
121 // If we are showing an interstitial, treat this as an OpenURL. | |
122 WebContents* current_tab = GetActiveWebContents(browser); | |
123 if (current_tab && current_tab->ShowingInterstitialPage()) { | |
124 NavigationEntry* entry = current_tab->GetController().GetActiveEntry(); | |
125 DCHECK(entry); // Should exist if interstitial is showing. | |
126 browser->OpenURL(OpenURLParams( | |
127 entry->GetURL(), Referrer(), disposition, | |
128 content::PAGE_TRANSITION_RELOAD, false)); | |
129 return; | |
130 } | |
131 | |
132 // As this is caused by a user action, give the focus to the page. | 121 // As this is caused by a user action, give the focus to the page. |
133 // | 122 // |
134 // Also notify RenderViewHostDelegate of the user gesture; this is | 123 // Also notify RenderViewHostDelegate of the user gesture; this is |
135 // normally done in Browser::Navigate, but a reload bypasses Navigate. | 124 // normally done in Browser::Navigate, but a reload bypasses Navigate. |
136 WebContents* web_contents = GetOrCloneTabForDisposition(browser, disposition); | 125 WebContents* web_contents = GetOrCloneTabForDisposition(browser, disposition); |
137 web_contents->UserGestureDone(); | 126 web_contents->UserGestureDone(); |
138 if (!web_contents->FocusLocationBarByDefault()) | 127 if (!web_contents->FocusLocationBarByDefault()) |
139 web_contents->Focus(); | 128 web_contents->Focus(); |
140 if (ignore_cache) | 129 if (ignore_cache) |
141 web_contents->GetController().ReloadIgnoringCache(true); | 130 web_contents->GetController().ReloadIgnoringCache(true); |
(...skipping 840 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
982 if (!tab_contents) | 971 if (!tab_contents) |
983 tab_contents = new TabContents(contents); | 972 tab_contents = new TabContents(contents); |
984 app_browser->tab_strip_model()->AppendTabContents(tab_contents, true); | 973 app_browser->tab_strip_model()->AppendTabContents(tab_contents, true); |
985 | 974 |
986 contents->GetMutableRendererPrefs()->can_accept_load_drops = false; | 975 contents->GetMutableRendererPrefs()->can_accept_load_drops = false; |
987 contents->GetRenderViewHost()->SyncRendererPrefs(); | 976 contents->GetRenderViewHost()->SyncRendererPrefs(); |
988 app_browser->window()->Show(); | 977 app_browser->window()->Show(); |
989 } | 978 } |
990 | 979 |
991 } // namespace chrome | 980 } // namespace chrome |
OLD | NEW |