OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/extensions/extension_view_host.h" | 5 #include "chrome/browser/extensions/extension_view_host.h" |
6 | 6 |
7 #include "base/strings/string_piece.h" | 7 #include "base/strings/string_piece.h" |
8 #include "chrome/browser/browser_process.h" | 8 #include "chrome/browser/browser_process.h" |
9 #include "chrome/browser/chrome_notification_types.h" | 9 #include "chrome/browser/chrome_notification_types.h" |
10 #include "chrome/browser/extensions/extension_view.h" | 10 #include "chrome/browser/extensions/extension_view.h" |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 bool ExtensionViewHost::IsBackgroundPage() const { | 139 bool ExtensionViewHost::IsBackgroundPage() const { |
140 DCHECK(view_); | 140 DCHECK(view_); |
141 return false; | 141 return false; |
142 } | 142 } |
143 | 143 |
144 // content::WebContentsDelegate overrides: | 144 // content::WebContentsDelegate overrides: |
145 | 145 |
146 WebContents* ExtensionViewHost::OpenURLFromTab( | 146 WebContents* ExtensionViewHost::OpenURLFromTab( |
147 WebContents* source, | 147 WebContents* source, |
148 const OpenURLParams& params) { | 148 const OpenURLParams& params) { |
| 149 // Supporting CURRENT_TAB is necessary for renderer-initiated, cross-site |
| 150 // frame navigations with --isolate-extensions or --site-per-process. These |
| 151 // navigations cause cross-process transfers which utilize this function with |
| 152 // CURRENT_TAB. This means that the navigation should happen in the same |
| 153 // ExtensionViewHost window. |
| 154 bool is_transfer = |
| 155 params.transferred_global_request_id != content::GlobalRequestID(); |
| 156 if (params.disposition == CURRENT_TAB && is_transfer) |
| 157 return WebContentsDelegate::OpenURLFromTab(host_contents(), params); |
| 158 |
149 // Whitelist the dispositions we will allow to be opened. | 159 // Whitelist the dispositions we will allow to be opened. |
150 switch (params.disposition) { | 160 switch (params.disposition) { |
151 case SINGLETON_TAB: | 161 case SINGLETON_TAB: |
152 case NEW_FOREGROUND_TAB: | 162 case NEW_FOREGROUND_TAB: |
153 case NEW_BACKGROUND_TAB: | 163 case NEW_BACKGROUND_TAB: |
154 case NEW_POPUP: | 164 case NEW_POPUP: |
155 case NEW_WINDOW: | 165 case NEW_WINDOW: |
156 case SAVE_TO_DISK: | 166 case SAVE_TO_DISK: |
157 case OFF_THE_RECORD: { | 167 case OFF_THE_RECORD: { |
158 // Only allow these from hosts that are bound to a browser (e.g. popups). | 168 // Only allow these from hosts that are bound to a browser (e.g. popups). |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 const content::NotificationSource& source, | 308 const content::NotificationSource& source, |
299 const content::NotificationDetails& details) { | 309 const content::NotificationDetails& details) { |
300 DCHECK_EQ(type, extensions::NOTIFICATION_EXTENSION_BACKGROUND_PAGE_READY); | 310 DCHECK_EQ(type, extensions::NOTIFICATION_EXTENSION_BACKGROUND_PAGE_READY); |
301 DCHECK(ExtensionSystem::Get(browser_context()) | 311 DCHECK(ExtensionSystem::Get(browser_context()) |
302 ->runtime_data() | 312 ->runtime_data() |
303 ->IsBackgroundPageReady(extension())); | 313 ->IsBackgroundPageReady(extension())); |
304 LoadInitialURL(); | 314 LoadInitialURL(); |
305 } | 315 } |
306 | 316 |
307 } // namespace extensions | 317 } // namespace extensions |
OLD | NEW |