OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "extensions/browser/guest_view/web_view/web_view_guest.h" | 5 #include "extensions/browser/guest_view/web_view/web_view_guest.h" |
6 | 6 |
7 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
8 #include "base/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "content/public/browser/browser_context.h" | 10 #include "content/public/browser/browser_context.h" |
(...skipping 1104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1115 new_window_info.changed = new_window_info.url != info.url; | 1115 new_window_info.changed = new_window_info.url != info.url; |
1116 it->second = new_window_info; | 1116 it->second = new_window_info; |
1117 return nullptr; | 1117 return nullptr; |
1118 } | 1118 } |
1119 if (params.disposition == CURRENT_TAB) { | 1119 if (params.disposition == CURRENT_TAB) { |
1120 // This can happen for cross-site redirects. | 1120 // This can happen for cross-site redirects. |
1121 LoadURLWithParams(params.url, params.referrer, params.transition, source); | 1121 LoadURLWithParams(params.url, params.referrer, params.transition, source); |
1122 return source; | 1122 return source; |
1123 } | 1123 } |
1124 | 1124 |
1125 CreateNewGuestWebViewWindow(params); | 1125 // Chrome Apps expect a newwindow event in response to Ctrl+Click. |
1126 return nullptr; | 1126 if (in_extension()) { |
| 1127 CreateNewGuestWebViewWindow(params); |
| 1128 return nullptr; |
| 1129 } |
| 1130 |
| 1131 if (!owner_web_contents()->GetDelegate()) |
| 1132 return nullptr; |
| 1133 return owner_web_contents()->GetDelegate()->OpenURLFromTab( |
| 1134 owner_web_contents(), params); |
1127 } | 1135 } |
1128 | 1136 |
1129 void WebViewGuest::WebContentsCreated(WebContents* source_contents, | 1137 void WebViewGuest::WebContentsCreated(WebContents* source_contents, |
1130 int opener_render_frame_id, | 1138 int opener_render_frame_id, |
1131 const base::string16& frame_name, | 1139 const base::string16& frame_name, |
1132 const GURL& target_url, | 1140 const GURL& target_url, |
1133 content::WebContents* new_contents) { | 1141 content::WebContents* new_contents) { |
1134 auto guest = WebViewGuest::FromWebContents(new_contents); | 1142 auto guest = WebViewGuest::FromWebContents(new_contents); |
1135 CHECK(guest); | 1143 CHECK(guest); |
1136 guest->SetOpener(this); | 1144 guest->SetOpener(this); |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1215 WebViewGuest::From(owner_web_contents()->GetRenderProcessHost()->GetID(), | 1223 WebViewGuest::From(owner_web_contents()->GetRenderProcessHost()->GetID(), |
1216 new_window_instance_id); | 1224 new_window_instance_id); |
1217 if (!guest) | 1225 if (!guest) |
1218 return; | 1226 return; |
1219 | 1227 |
1220 if (!allow) | 1228 if (!allow) |
1221 guest->Destroy(); | 1229 guest->Destroy(); |
1222 } | 1230 } |
1223 | 1231 |
1224 } // namespace extensions | 1232 } // namespace extensions |
OLD | NEW |