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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 1469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1480 const NewWindowInfo& new_window_info = it->second; | 1480 const NewWindowInfo& new_window_info = it->second; |
1481 | 1481 |
1482 // Retrieve the opener partition info if we have it. | 1482 // Retrieve the opener partition info if we have it. |
1483 const GURL& site_url = new_contents->GetSiteInstance()->GetSiteURL(); | 1483 const GURL& site_url = new_contents->GetSiteInstance()->GetSiteURL(); |
1484 std::string storage_partition_id = GetStoragePartitionIdFromSiteURL(site_url); | 1484 std::string storage_partition_id = GetStoragePartitionIdFromSiteURL(site_url); |
1485 | 1485 |
1486 base::DictionaryValue request_info; | 1486 base::DictionaryValue request_info; |
1487 request_info.SetInteger(webview::kInitialHeight, initial_bounds.height()); | 1487 request_info.SetInteger(webview::kInitialHeight, initial_bounds.height()); |
1488 request_info.SetInteger(webview::kInitialWidth, initial_bounds.width()); | 1488 request_info.SetInteger(webview::kInitialWidth, initial_bounds.width()); |
1489 request_info.Set(webview::kTargetURL, | 1489 request_info.Set(webview::kTargetURL, |
1490 new base::StringValue(new_window_info.url.spec())); | 1490 new base::Value(new_window_info.url.spec())); |
1491 request_info.Set(webview::kName, new base::StringValue(new_window_info.name)); | 1491 request_info.Set(webview::kName, new base::Value(new_window_info.name)); |
1492 request_info.SetInteger(webview::kWindowID, guest->guest_instance_id()); | 1492 request_info.SetInteger(webview::kWindowID, guest->guest_instance_id()); |
1493 // We pass in partition info so that window-s created through newwindow | 1493 // We pass in partition info so that window-s created through newwindow |
1494 // API can use it to set their partition attribute. | 1494 // API can use it to set their partition attribute. |
1495 request_info.Set(webview::kStoragePartitionId, | 1495 request_info.Set(webview::kStoragePartitionId, |
1496 new base::StringValue(storage_partition_id)); | 1496 new base::Value(storage_partition_id)); |
1497 request_info.Set( | 1497 request_info.Set(webview::kWindowOpenDisposition, |
1498 webview::kWindowOpenDisposition, | 1498 new base::Value(WindowOpenDispositionToString(disposition))); |
1499 new base::StringValue(WindowOpenDispositionToString(disposition))); | |
1500 | 1499 |
1501 web_view_permission_helper_-> | 1500 web_view_permission_helper_-> |
1502 RequestPermission(WEB_VIEW_PERMISSION_TYPE_NEW_WINDOW, | 1501 RequestPermission(WEB_VIEW_PERMISSION_TYPE_NEW_WINDOW, |
1503 request_info, | 1502 request_info, |
1504 base::Bind(&WebViewGuest::OnWebViewNewWindowResponse, | 1503 base::Bind(&WebViewGuest::OnWebViewNewWindowResponse, |
1505 weak_ptr_factory_.GetWeakPtr(), | 1504 weak_ptr_factory_.GetWeakPtr(), |
1506 guest->guest_instance_id()), | 1505 guest->guest_instance_id()), |
1507 false /* allowed_by_default */); | 1506 false /* allowed_by_default */); |
1508 } | 1507 } |
1509 | 1508 |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1559 std::unique_ptr<base::DictionaryValue> args(new base::DictionaryValue()); | 1558 std::unique_ptr<base::DictionaryValue> args(new base::DictionaryValue()); |
1560 DispatchEventToView(base::MakeUnique<GuestViewEvent>( | 1559 DispatchEventToView(base::MakeUnique<GuestViewEvent>( |
1561 webview::kEventExitFullscreen, std::move(args))); | 1560 webview::kEventExitFullscreen, std::move(args))); |
1562 } | 1561 } |
1563 // Since we changed fullscreen state, sending a Resize message ensures that | 1562 // Since we changed fullscreen state, sending a Resize message ensures that |
1564 // renderer/ sees the change. | 1563 // renderer/ sees the change. |
1565 web_contents()->GetRenderViewHost()->GetWidget()->WasResized(); | 1564 web_contents()->GetRenderViewHost()->GetWidget()->WasResized(); |
1566 } | 1565 } |
1567 | 1566 |
1568 } // namespace extensions | 1567 } // namespace extensions |
OLD | NEW |