| 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 "chrome/browser/guest_view/web_view/web_view_guest.h" | 5 #include "chrome/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 "chrome/browser/chrome_notification_types.h" | 10 #include "chrome/browser/chrome_notification_types.h" |
| (...skipping 1161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1172 PendingWindowMap::iterator it = pending_new_windows_.find(guest); | 1172 PendingWindowMap::iterator it = pending_new_windows_.find(guest); |
| 1173 if (it == pending_new_windows_.end()) | 1173 if (it == pending_new_windows_.end()) |
| 1174 return; | 1174 return; |
| 1175 const NewWindowInfo& new_window_info = it->second; | 1175 const NewWindowInfo& new_window_info = it->second; |
| 1176 | 1176 |
| 1177 // Retrieve the opener partition info if we have it. | 1177 // Retrieve the opener partition info if we have it. |
| 1178 const GURL& site_url = new_contents->GetSiteInstance()->GetSiteURL(); | 1178 const GURL& site_url = new_contents->GetSiteInstance()->GetSiteURL(); |
| 1179 std::string storage_partition_id = GetStoragePartitionIdFromSiteURL(site_url); | 1179 std::string storage_partition_id = GetStoragePartitionIdFromSiteURL(site_url); |
| 1180 | 1180 |
| 1181 base::DictionaryValue request_info; | 1181 base::DictionaryValue request_info; |
| 1182 request_info.Set(webview::kInitialHeight, | 1182 request_info.SetInteger(webview::kInitialHeight, initial_bounds.height()); |
| 1183 base::Value::CreateIntegerValue(initial_bounds.height())); | 1183 request_info.SetInteger(webview::kInitialWidth, initial_bounds.width()); |
| 1184 request_info.Set(webview::kInitialWidth, | |
| 1185 base::Value::CreateIntegerValue(initial_bounds.width())); | |
| 1186 request_info.Set(webview::kTargetURL, | 1184 request_info.Set(webview::kTargetURL, |
| 1187 new base::StringValue(new_window_info.url.spec())); | 1185 new base::StringValue(new_window_info.url.spec())); |
| 1188 request_info.Set(webview::kName, new base::StringValue(new_window_info.name)); | 1186 request_info.Set(webview::kName, new base::StringValue(new_window_info.name)); |
| 1189 request_info.Set(webview::kWindowID, | 1187 request_info.SetInteger(webview::kWindowID, guest->GetGuestInstanceID()); |
| 1190 base::Value::CreateIntegerValue( | |
| 1191 guest->GetGuestInstanceID())); | |
| 1192 // We pass in partition info so that window-s created through newwindow | 1188 // We pass in partition info so that window-s created through newwindow |
| 1193 // API can use it to set their partition attribute. | 1189 // API can use it to set their partition attribute. |
| 1194 request_info.Set(webview::kStoragePartitionId, | 1190 request_info.Set(webview::kStoragePartitionId, |
| 1195 new base::StringValue(storage_partition_id)); | 1191 new base::StringValue(storage_partition_id)); |
| 1196 request_info.Set( | 1192 request_info.Set( |
| 1197 webview::kWindowOpenDisposition, | 1193 webview::kWindowOpenDisposition, |
| 1198 new base::StringValue(WindowOpenDispositionToString(disposition))); | 1194 new base::StringValue(WindowOpenDispositionToString(disposition))); |
| 1199 | 1195 |
| 1200 web_view_permission_helper_-> | 1196 web_view_permission_helper_-> |
| 1201 RequestPermission(WEB_VIEW_PERMISSION_TYPE_NEW_WINDOW, | 1197 RequestPermission(WEB_VIEW_PERMISSION_TYPE_NEW_WINDOW, |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1238 bool allow, | 1234 bool allow, |
| 1239 const std::string& user_input) { | 1235 const std::string& user_input) { |
| 1240 WebViewGuest* guest = | 1236 WebViewGuest* guest = |
| 1241 WebViewGuest::From(embedder_render_process_id(), new_window_instance_id); | 1237 WebViewGuest::From(embedder_render_process_id(), new_window_instance_id); |
| 1242 if (!guest) | 1238 if (!guest) |
| 1243 return; | 1239 return; |
| 1244 | 1240 |
| 1245 if (!allow) | 1241 if (!allow) |
| 1246 guest->Destroy(); | 1242 guest->Destroy(); |
| 1247 } | 1243 } |
| OLD | NEW |