| 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 965 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 976 is_pending_new_window = true; | 976 is_pending_new_window = true; |
| 977 } | 977 } |
| 978 } | 978 } |
| 979 | 979 |
| 980 // Only read the src attribute if this is not a New Window API flow. | 980 // Only read the src attribute if this is not a New Window API flow. |
| 981 if (!is_pending_new_window) { | 981 if (!is_pending_new_window) { |
| 982 std::string src; | 982 std::string src; |
| 983 params.GetString(webview::kAttributeSrc, &src); | 983 params.GetString(webview::kAttributeSrc, &src); |
| 984 NavigateGuest(src, false /* force_navigation */); | 984 NavigateGuest(src, false /* force_navigation */); |
| 985 } | 985 } |
| 986 | |
| 987 } | 986 } |
| 988 | 987 |
| 989 void WebViewGuest::ShowContextMenu( | 988 void WebViewGuest::ShowContextMenu( |
| 990 int request_id, | 989 int request_id, |
| 991 const WebViewGuestDelegate::MenuItemVector* items) { | 990 const WebViewGuestDelegate::MenuItemVector* items) { |
| 992 if (web_view_guest_delegate_) | 991 if (web_view_guest_delegate_) |
| 993 web_view_guest_delegate_->OnShowContextMenu(request_id, items); | 992 web_view_guest_delegate_->OnShowContextMenu(request_id, items); |
| 994 } | 993 } |
| 995 | 994 |
| 996 void WebViewGuest::SetName(const std::string& name) { | 995 void WebViewGuest::SetName(const std::string& name) { |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1070 | 1069 |
| 1071 // Set up the parameters to load |data_url| with the specified |base_url|. | 1070 // Set up the parameters to load |data_url| with the specified |base_url|. |
| 1072 content::NavigationController::LoadURLParams load_params(data_gurl); | 1071 content::NavigationController::LoadURLParams load_params(data_gurl); |
| 1073 load_params.load_type = content::NavigationController::LOAD_TYPE_DATA; | 1072 load_params.load_type = content::NavigationController::LOAD_TYPE_DATA; |
| 1074 load_params.base_url_for_data_url = base_gurl; | 1073 load_params.base_url_for_data_url = base_gurl; |
| 1075 load_params.virtual_url_for_data_url = virtual_gurl; | 1074 load_params.virtual_url_for_data_url = virtual_gurl; |
| 1076 load_params.override_user_agent = | 1075 load_params.override_user_agent = |
| 1077 content::NavigationController::UA_OVERRIDE_INHERIT; | 1076 content::NavigationController::UA_OVERRIDE_INHERIT; |
| 1078 | 1077 |
| 1079 // Navigate to the data URL. | 1078 // Navigate to the data URL. |
| 1080 web_contents()->GetController().LoadURLWithParams(load_params); | 1079 GuestViewBase::LoadURLWithParams(load_params); |
| 1081 | 1080 |
| 1082 return true; | 1081 return true; |
| 1083 } | 1082 } |
| 1084 | 1083 |
| 1085 void WebViewGuest::AddNewContents(content::WebContents* source, | 1084 void WebViewGuest::AddNewContents(content::WebContents* source, |
| 1086 content::WebContents* new_contents, | 1085 content::WebContents* new_contents, |
| 1087 WindowOpenDisposition disposition, | 1086 WindowOpenDisposition disposition, |
| 1088 const gfx::Rect& initial_rect, | 1087 const gfx::Rect& initial_rect, |
| 1089 bool user_gesture, | 1088 bool user_gesture, |
| 1090 bool* was_blocked) { | 1089 bool* was_blocked) { |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1198 // other schemes (e.g., WebUI or extensions), and no permissions or bindings | 1197 // other schemes (e.g., WebUI or extensions), and no permissions or bindings |
| 1199 // can be granted to the guest process. | 1198 // can be granted to the guest process. |
| 1200 content::NavigationController::LoadURLParams load_url_params(validated_url); | 1199 content::NavigationController::LoadURLParams load_url_params(validated_url); |
| 1201 load_url_params.referrer = referrer; | 1200 load_url_params.referrer = referrer; |
| 1202 load_url_params.transition_type = transition_type; | 1201 load_url_params.transition_type = transition_type; |
| 1203 load_url_params.extra_headers = std::string(); | 1202 load_url_params.extra_headers = std::string(); |
| 1204 if (is_overriding_user_agent_) { | 1203 if (is_overriding_user_agent_) { |
| 1205 load_url_params.override_user_agent = | 1204 load_url_params.override_user_agent = |
| 1206 content::NavigationController::UA_OVERRIDE_TRUE; | 1205 content::NavigationController::UA_OVERRIDE_TRUE; |
| 1207 } | 1206 } |
| 1208 web_contents()->GetController().LoadURLWithParams(load_url_params); | 1207 GuestViewBase::LoadURLWithParams(load_url_params); |
| 1209 | 1208 |
| 1210 src_ = validated_url; | 1209 src_ = validated_url; |
| 1211 } | 1210 } |
| 1212 | 1211 |
| 1213 void WebViewGuest::RequestNewWindowPermission( | 1212 void WebViewGuest::RequestNewWindowPermission( |
| 1214 WindowOpenDisposition disposition, | 1213 WindowOpenDisposition disposition, |
| 1215 const gfx::Rect& initial_bounds, | 1214 const gfx::Rect& initial_bounds, |
| 1216 bool user_gesture, | 1215 bool user_gesture, |
| 1217 content::WebContents* new_contents) { | 1216 content::WebContents* new_contents) { |
| 1218 auto guest = WebViewGuest::FromWebContents(new_contents); | 1217 auto guest = WebViewGuest::FromWebContents(new_contents); |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1269 WebViewGuest::From(owner_web_contents()->GetRenderProcessHost()->GetID(), | 1268 WebViewGuest::From(owner_web_contents()->GetRenderProcessHost()->GetID(), |
| 1270 new_window_instance_id); | 1269 new_window_instance_id); |
| 1271 if (!guest) | 1270 if (!guest) |
| 1272 return; | 1271 return; |
| 1273 | 1272 |
| 1274 if (!allow) | 1273 if (!allow) |
| 1275 guest->Destroy(); | 1274 guest->Destroy(); |
| 1276 } | 1275 } |
| 1277 | 1276 |
| 1278 } // namespace extensions | 1277 } // namespace extensions |
| OLD | NEW |